Showing posts with label file. Show all posts
Showing posts with label file. Show all posts
Published May 10, 2018 by

How to Upload a File to Google Drive from the Terminal/Command Line

We are doing several Linux projects regularly, and we will need to be sure we are backing them up. I wanted to quickly back up a copy of my files and so I went looking for an easy way to upload a file to Google Drive, and I found it with gdrive.

Here is the tutorial on how to upload a file to Google Drive from the command line or terminal.


1. Go to the root directory and download gdrive.
 # cd ~  
 # wget https://docs.google.com/uc?id=0B3X9GlR6EmbnWksyTEtCM0VfaFE&export=download  

2. You should see a file in your directory called something like uc?id=0B3X9GlR6EmbnWksyTEtCM0VfaFE. and rename this file to gdrive.
 # mv uc?id=0B3X9GlR6EmbnWksyTEtCM0VfaFE gdrive  

3. Give execute permission to gdrive.

 # chmod +x gdrive  

4. Install the file to /usr folder.

 # sduo install gdrive /usr/local/bin/gdrive  

5. Now we will need to give access to Google Drive to allow this program to connect to your account. To do this, insert below command.

 # gdrive list  

6. Copy the link it gives you to your browser and chooses your google drive account.


7. Click Allow button to give access.


8. Copy the generated verification code and insert into a terminal.


9. Now we are done... Let's upload a file.

 # gdrive upload /file_path  

For example,

 # gdrive upload /opt/subhash.txt  

10. Go to google drive and check it's uploaded.
Read More
Published January 21, 2018 by

Different File Archive Types of Linux

In this article, we are learning and understand on different and popular file archive types of Linux with example.

.tar

TAR stands for Tape Archive. tar is the simple format in which files are combined into a larger file. Handled by the tar command at the command-line. Tar files are not automatically compressed. The chief benefit of tar files is that they record permission and ownership details, making them ideal for backup.

# tar -czf serverkaka.tar /home/serverkaka/subhash/              ## For Archive
# tar -xzf serverkaka.tar                                                         ## For Extract


.tar.gz

Tar archives that have been additionally compressed using the gzip software, usually at the point of creation. Sometimes the .tgz file extension is used instead of .tar.gz.

# tar -czf serverkaka.tar.gz /home/serverkaka/subhash/          ## For Archive
# tar -xzf serverkaka.tar.gz                                                     ## For Extract

.tar.bz2

Tar archives that have been additionally compressed using the bzip2 software, usually at the point of creation. Bzip2 compression leads to the smallest files of all, so is preferable. Sometimes the .tbz file extension is used instead of .tar.bz2.

# tar -cjf serverkaka.tar.bz2 /home/serverkaka/subhash/          ## For Archive
# tar -xjf serverkaka.tar.bz2                                                     ## For Extract

.zip

As with Windows, zip files are compressed archives. Zip files have not gained much traction in the Linux/Unix world because of legal concerns some years ago. This is no longer an issue, but other archive formats such as gzip and bzip2 are simply more established.

# zip -r serverkaka.zip /home/serverkaka/subhash/               ## For Archive
# unzip serverkaka.zip                                                          ## For Extract
Read More
Published January 21, 2018 by

Key Board Shortcuts for Linux System and File Explorer

Here some keyboard shortcuts can make your Linux uses more easy and effective.

For Bash/Terminal

Key Combination
Details
Up/down cursor key
Scroll through command history
Ctrl + left/right arrow
Move cursor from word to word
Tab Button
Auto complete command or filename/path
Ctrl+ A
Move to beginning of line
Ctrl + E
Move to end of line
Ctrl + W + Backspace
Delete word behind cursor
Alt + D
Delete word in front of cursor
Ctrl + U
Delete beginning of line
Ctrl + K
Delete to end of line
Ctrl + Y
Restore text you’ve deleted
Ctrl + L
Clear screen/Terminal
Ctrl + C
Quit current Program/Process
Ctrl + Z
Switch current program to background
Ctrl + R
Search through command history
Ctrl + D
Logout
Ctrl + T
Swap the two characters behind cursor

For File Explorer/System

Key Combination
Details
Alt + left arrow
Move back in the file browsing history
Alt + right arrow
Move forward in the file browsing history
Alt + up arrow
Switch to the parent folder of the one you’re currently in
Ali + Home button
Switch to the user’s /home folder
Ctrl + Alt + enter
Show properties of selected file/folder
Ctrl + Shift+ N
Create new folder
Ctrl + Alt+ T
Open Terminal
Ctrl + R
Refresh the file listing, showing any changes made since the listing appeared
Ctrl++
Zoom In
Ctrl+-
Zoom Out
Ctrl + 0 (Zero)
Zoom to Default
Ctrl + W
Quit file browsing window
Shift + Ctrl + W
Quit all file browsing window
Ctrl + N
New browsing window
Ctrl + D
Add current location as bookmark
Ctrl + B
Edit bookmark
Ctrl + T
New Tab
Ctrl + A
Select All files
Ctrl + O
Open selected file/folder
Ctrl + H
Show/hide hidden files
Ctrl + L
Go to location
Ctrl + 1
Switch to icon view
Ctrl + 2
Switch to list view
Ctrl + 3
Switch to compact view
F2
Rename selected file/folder
F9
Show/hide side pane
Delete
Delete file/folder (Move to Trash)
Shift + Delete
Permanently delete file/folder
Read More
Published January 21, 2018 by

Linux Directory Structure (Linux File System Hierarchy)

When we have installed the Linux operating system in our system that time, Linux create many directories. But many of people or beginners are not aware of the use of all directories.

So in this article, I create a simple information about uses of all directories and location of all types of data.


Directory
Details
/bin
Essential software typically needed to get the system running
/boot
Files related to the boot menu/loader
/dev
Virtual files representing hardware devices
/etc
System configuration files
/home
User's personal folders
/lib
Support or library files required by software or applications
/media
Contains subfolders where storage devices can be mounted
/proc
Virtual folder containing files representing stats and settings
/root
Personal folder for the root user
/sbin
Essential software for system maintenance, used only for the root user
/tmp
Temporary files/folders
/usr
Essentially, subdirectories containing most software used on the system, including system libraries and documentation
/var
Data that is vital to the running of the system and that is constantly being updated
Read More