---
# System prepended metadata

title: Bash Cheat Sheet

---

# Bash Cheat Sheet

1. `ls` - List information about files (the current directory by default). Sort entries alphabetically.
2. `ls --help` get help for list
3. `ls -a` list all files, including hidden files (i.e. files starting with `.`)
4. `ls -l` use a long listing format
5. `pwd` print working directory, i.e. the current directory
6. `cp` copy files
7. `mv` move file (also used for renaming - move file from one name to another)
8. `mkdir` make directory
9. `cd` change to another directory
    1. `cd ~` change to home directory
    2. `cd ..` change to parent directory (i.e. one directory up from where you currently are)
    3. `cd -` change to the previous directory that you were in
    
10.`rm` remove file, i.e. delete file
11. `rm -rf` force remove directory recursively
12. `head` type the first 10 lines of a file to screen
13. `head -n#` type `#` number of lines from the head of the file to the screen
14. `tail` type the last 10 lines of a file to screen
15. `tail -n#` type `#` number of lines from the bottom of the file to the screen
16. `man [command]` display the manual page for `[command]`. Will only display if man pages are installed. If not installed use Google to find man page.
17. `which [program_name]` gives you the full path of a command