Skip to main content

1. Commands for navigating directories

  1. ls is the command for listing files in a directory
  2. ls -a will display all files including hidden files within a directory
  3. ls -al will display all files + hidden files and their permissions
  4. pwd Abbrv. for Print Working Directory -  it will output the aboslute path of directory you're in
  5. cd /home/kvis is the command for changing directory to /home/kvis
  6. Typing cd alone, will go to the user's home folder
  7. cd .. will move a level up like a back button
  8. cd - will return to the previous directory you were in
  9. cp file_to_copy.txt new_file.txt will copy file_to_copy.txt and make a new file with the same contents in the same directory called new_file.txt. First argument is always the source and the second argument is always the destination
  10. cp -r dir_to_copy/ new_copy_dir/ is used to copy entire directories. You must use the -r flag (recursive flag) in order to copy a dir and everything within it
  11. rm file_to_copy.txt will delete the file
  12. rm -r dir_to_remove/ will delete an empty directory
  13. rm -rf dir_with_content_to_remove/ will delete a directory and the data within it as well! BE CAREFUL with this command
  14. mkdir images/ will create an empty directory called images
  15. mkdir -p movies/2004/ will create movies directory along with an unlimited amount subdirectories beneath it.
  16. touch new_file.txt will create a new empty file called new_file