– Directory commands: Commands that work with directories (pwd, ls, cd, mkdir, rmdir)
– File commands: Commands that allow you to manage files (cp, mv, sort, cut, paste, diff, rm, uniq)
pwd it lets you know where you are in the tree
Basic listing (ls): Displays files and directories in your current directory.
-F To distinguish between files and directories
-a show hidden files starting with a dot (.)
-l parameter to produce a long listing.
Allows you to make copy of a file.
– cp [option] source destination
-i option for interactive mode to give you a warning before overwriting an already existing file.
-p option to preserve file access or modification times of the original file for the copied file.
Copy from current directory to sibling directory:
– cp source ../sibling Copy file from parent to current directory:
– cp ../source . Copy file from parent to current directory:
– cp –R source_dir destination_dir Recursively copy contents of a directory to another
mv source destination Allows you to move or rename a file or directory
-i option for interactive
mkdir dir_1 dir_2 dir_3 creates those 3 directories
mkdir –p food/fruit/citrus/oranges creates the intermediate directories
– rm –file deleting of files
–i to get the warning as there is no Recycle Bin
-f option for forcible deletion (no warnings)
rmdir allows deleting of empty directories.
rm –rf directory recursively deletes all contents of a file
– touch –t 201411251200 testfile the modification date and time of a file