Nautilus
Nautilus is the file manager for Ubuntu. Hence, it is a core application. The keystrokes below simplify user interface:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
Ctrl+N # new window Ctrl+Q # close all windows Ctrl+Shift+N # new folder Fn+F2 # rename folder Ctrl+T # new tab Alt+[1-9] # go to tab Ctrl+W # close tab Ctrl+B # open bookmarks Shift+Up/Down # scroll bookmarks Ctrl+D # bookmark open folder Ctrl+H # toggle hidden files/directories Ctrl+F # search files/direcotries Ctrl+R # reload/refresh view Ctrl+[+/-] # zoom in/out ##-----------------------------------------------------------------------------------------## |
Change Directories
It is easy to change directories using the the shell commands below:
1 2 3 4 5 6 7 8 9 10 |
cd or cd ~ # change to home director (see $HOME) cd - # toggle between last two directoriesu cd / # change to root directory cd .. # change to parent directry (up one level) cd Documents/Books # change to Documents/Books directory cd "My Images" # change to directory with spaces in name cd /media/pnr-x1/<dev> # Access USB; device name <dev> cd /media/bxhorn/disk # Access SD card ##-----------------------------------------------------------------------------------------## |
List Files
There are many options to display the files on a hard drive. First, change directories and use the commands below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
ls -a # list all files including hidden ls --color # colored list [=always/never/auto] ls -d */ # list directories only ls -d $PWD/* # list full path names of directories ls -F # list and append one of */=>@| to entries ls -i # list files inode index number ls -l # list files in long format with permissions ls -r # list files and sort in reverse order ls -R # list recursive directory tree ls -s # list file size ls -S # list and sort by file size; human readable ls -t # list and sort by time/date ls -X # list and sort by extension name ls > out.txt # list redirection to output file ls -ltr # order files based on last modified time ls -alFt | grep "2016" # list files from 2016 ls -alhS | more # list files one page at a time set | grep LS_COLORS # get LS_COLOR string for .bashrc file ##-----------------------------------------------------------------------------------------## |
Copy and Move Files
1 2 3 4 5 6 7 |
cp -p file1 file2 # copy files, preserve mode, ownership, timestamp cp -i file1 file2 # copy files with confirmation to overwrite mv -i file1 file2 # move with confirmation to overwrite mv -f file1 file2 # move with no confirmation to overwrite mv -v file1 file2 # move with status printing (metacharacters) ##-----------------------------------------------------------------------------------------## |
Make Directory
1 2 3 4 5 |
mkdir ~\temp # make temp dir under home mkdir -p dir1/dir2/dir3/ # make nested directories export CDPATH=/<dir> # add <dir> to cd base directory (~/.bashrc) export CDPATH=~:/O.RProjects:/Dropbox # add multiple <dir> to cd base directory ##-----------------------------------------------------------------------------------------## |
Remove File/Directory
1 2 3 |
rm -i file* # remove file with confirmation rm -r mydir # remove directory and all contents recursively ##-----------------------------------------------------------------------------------------## |
Find Files
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
locate <file> # get path for <file> (e.g. locate jni.h) find <path> <conditions> # general approach find /etc -name "*mail" # find all files in /etc with "mail" in name find -inname "MyRProgram.R" # find filename (case insensitive) find . -type f -name "*.jpg" # find all files in PWD w/ name string find . -type f -name ".*" # find all hidden files find ~ -size +100M # find all files bigger than a given size find ~ -size -100M # find all files smaller than a given size find . -mtime -2 # find all files modified less than 2 days ago find . -mtime +60 # find all files modified more than 60 days ago find / -name passwd # find passwd file all levels under root find -maxdepth 2 -name passwd # find passwd file 1 level under root find / -maxdepth 3 -name passwd # find passwd file 2 levels under root find -mindepth 3 -maxdepth 5 -name passwd # find passwd file 2 to 4 levels under PWD find . -maxdepth 1 -type f -perm /a=x # find executables in PWD find -newer file_name # find all files modified after file_name find . -type d # find all directories find -type d -name ".*" # find all hidden directories find ./ -maxdepth 1 -type d | sort -d | more # find all directories, specified depth and sorted ##-----------------------------------------------------------------------------------------## |
Change File Permissions and Owner
1 2 3 4 5 6 7 8 9 10 11 12 |
chmod # change mode https://en.wikipedia.org/wiki/Chmod chmod u+rwx <file or directory> # read/write.execute permission for user chmod -R u+rwx <directory> # apply file permissions to all files recursively chmod g+rwx <file or directory> # read/write.execute permission for group chmod g-rwx <file or directory> # revoke permissions for group chmod o+rwx <file or directory> # read/write.execute permission for others chmod a+x <file> # change permission for ALL roles chmod --reference=<file1><file2> # set file2 permissions the same as file1 chown oracle:dba <file> # change owner to oracle and group to dba chown -R oracle:dba <directory> # change owner recursively ##-----------------------------------------------------------------------------------------## |
Convert PDF to MS Word Document
1 2 |
soffice --infilter="writer_pdf_import" --convert-to doc file.pdf ##-----------------------------------------------------------------------------------------## |
Change File Modify Date
1 2 |
touch -t 201508212200 "<filename>" # change file modify date to date format YMDHS ##-----------------------------------------------------------------------------------------## |
Compress/Uncompress Files
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
tar cvf archive_name.tar dirname/ # create a tar archive (*.tar) tar cvfz archive_name.tar.gz dirname/ # create a tar.gz archive (*.tar.gz) tar cvfj archive_name.tar.bz2 dirname/ # create a tar.bz2 archive - higher compression (*.tar.bz2) tar xvf archive_name.tar # extract an existing tar archive tar xvfz archive-name.tar.gz -C ~/Download # extract tar achive to target directory tar tvf archive_name.tar # view an existing archive gzip test.txt # create a gzip compressed file (*.gz) gzip -d test.txt.gz # uncompress a gzip file gzip -l *.gz # display compression ratio of compressed file zip test.zip /var/log/* # create zip file compression level 6 (default) zip -9 test.zip /var/log/* # create zip file compression level 9 (max) zip -P <mypasswd> test.zip /var/log/* # create password protected zip unzip test.zip # extract/uncompress a zip file (*.zip) unzip -l test.zip # view contents of zip file bzip2 trace # create bzip2 file (*.bz2) ##-----------------------------------------------------------------------------------------## |
FTP File Commands
1 2 3 4 |
ftp IP/hostname # connect to remote server mls *.jpeg # view list of file names before download mget *.jpeg # download multiple files ##-----------------------------------------------------------------------------------------## |
wget File Commands
1 2 3 4 5 6 7 8 9 10 11 |
wget <url> # download a single file (url includes filename) wget -O <filename> <url> # download and store with a different filename wget --limit-rate=200k <url> # specify download speed wget -c <url> # continue incomplete download wget -b <url> # download in background wget --spider <url> # test downlaod url prior to scheduling wget --tries=75 <url> # increase number of retry attempts wget -i downloadlist.txt # download multiple files using txt file wget -i -Q5m downloadlist.txt # quit download after exceeding a certain size wget -o download.log <url> # send log messages to file, not stder ##-----------------------------------------------------------------------------------------## |