Bash Cheat Sheet

List files

ls

Lists all files in current directory

-a show hidden files
-l more details about the files
-h show file size in Kb, Mb or Gb

View files

cat

Prints contents of the provided file, if multiple files are provided then concatenates the contents.

$ cat file1.txt file2.txt

head

Peak first 10 lines of the given file.

-n number of lines to peak.

$ head -n 5 file.txt

tail

Peak last 10 lines of the given file.

-n number of lines to peak.

$ tail -n 5 file.txt

Delete files/folders

rm

Deletes files

-r (recursive) to delete folder

$ rm -r temp_folder

Media

[![Watch the video](https://i.imgur.com/vKb2F1B.png)](https://youtu.be/vt5fpE0bzSY)

Link to video

![Live Score Board](https://thetechstack.net/assets/images/projects/live-score-board/live-score-board.jpg)

Embed image

Escape characters

\

Use backspace before the special character to escape and they appear as literal characters.