Introduction to Linux shell commands
Chapter 2: Commands
Manipulating Files
Creating and Deleting
WARNING!! Linux does not have a command to undo a delete. Once you delete a file using rm, it is gone… forever…
touch fileNamecreates a new file by the name “fileName”. Remember to specify the type of file (touch fileName.py,touch fileName.txt, etc…)mkdir dirNamecreates a new directory nameddirNamerm fileNamedeletesfileName-irepresenting interactive mode where you are asked if you are sure you want to remove the file (pressyif you want the file to be removed and any other key otherwise)-rrepresenting recursion in which case, if it is a directory which you have specified to delete, it and all its contents are recursively deleted.
e.g. rm -rf someDirectory deletes the directory someDirectory, and recursively deletes all its contents - yeah scary.
Copying and moving
cpcopys a filecp file1 file2copiesfile1and names the copyfile2cp file1 file2 file3 /someParentDirect/someChildDirect/copiesfile1,file2andfile3to the directorysomeChildDirectory- to copy a directory and all its contents you need to pass the recursive
-rargument
- to copy a directory and all its contents you need to pass the recursive
mvmoves files. Apply the same logic forcpfor functionality