Working with files
Copying
Use cp (copy) to copy. You have to provide a source and destination path.
Copy 'test.txt' to 'copy.txt' (both in the current directory)
cp test.txt copy.txtCopy 'test.txt' to another location
cp test.txt /Users/alice/documents/copy.txtYou can copy entire directories (and their contents) with the -R (recursive) option.
Copy the directory 'music' to 'music2'
cp -R music music2Moving
Use mv (move) to move files and directories. You have to provide a source and destination path.
Move 'test.txt' to 'copy.txt'
mv test.txt copy.txtMove 'test.txt' to the parent directory (note since we don't want to change the filename we can just specify the directory)
mv test.txt ../You can also move directories (and their contents).
Move the directory 'music' to 'music2'
mv music music2Move the directory 'music' to an existing subdirectory (note the trailing slash)
mv music old/Deleting
Use rm (remove) to move files and directories.
Remove 'test.txt'
rm test.txtTo remove directories and their contents, include the -rf option.
Remove the directory 'music'
rm -rf music