Linux Command Cheat Sheet

This cheat sheet covers essential Linux commands — from basic navigation to file management and networking tools.

1. ls : List files and directories

ls -l     # displays files and directories with detailed information
ls -a     # shows all files and directories, including hidden ones
ls -lh    # displays file sizes in a human-readable format

2. cd : Change directory

cd /path/to/directory    # changes the current directory to the specified path

3. pwd : Print current working directory

pwd     # displays the current working directory

4. mkdir : Create a new directory

mkdir new_folder

5. rm : Remove directory or files

rm -r folder_name     # deletes the directory and its contents

6. mv : Move or rename files

mv oldname.txt newname.txt
mv file.txt /path/to/destination/

7. cp : Copy files and directories

cp file.txt copy.txt
cp -r folder/ /destination/

8. cat : View file content

cat file.txt

9. head : View the first few lines of a file

head file.txt

10. tail : View the last few lines of a file

tail file.txt

11. ln : Create file links

ln -s original.txt linkname.txt    # creates a symbolic link

12. find : Search for files or directories

find . -name "*.txt"    # search for all .txt files in current directory

13. chmod : Change file permissions

chmod 755 script.sh

14. tar : Create or extract archive files

tar -cvf archive.tar folder/    # create
tar -xvf archive.tar            # extract

15. gzip : Compress files

gzip file.txt

16. zip : Create compressed zip archives

zip archive.zip file1 file2

17. ssh : Securely connect to a remote server

ssh user@hostname

18. scp : Securely copy files between hosts

scp file.txt user@hostname:/path/to/destination

19. wget : Download files from the web

wget http://example.com/file.txt