0% found this document useful (0 votes)
10 views7 pages

Linux Commands Guide

This document lists the top 50 Linux commands along with their common options and examples. Each command is briefly described, highlighting its primary function and providing usage examples. The commands cover a wide range of functionalities, including file management, system monitoring, and network operations.

Uploaded by

mo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views7 pages

Linux Commands Guide

This document lists the top 50 Linux commands along with their common options and examples. Each command is briefly described, highlighting its primary function and providing usage examples. The commands cover a wide range of functionalities, including file management, system monitoring, and network operations.

Uploaded by

mo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Top 50 Linux Commands with Common Options & Examples

1. ls – List directory contents

• -l : Long listing format


• -a : Show hidden files
• -h : Human-readable sizes
• -R : Recursive listing

ls -lah

2. pwd – Print working directory

pwd

3. cd – Change directory

cd /path/to/dir
cd .. # Go up one level

4. mkdir – Make directory

• -p : Create parent directories if needed

mkdir -p new/folder/path

5. mv – Move or rename files

• -i : Prompt before overwrite


• -v : Verbose

mv -iv file.txt /target/dir/

6. cp – Copy files and directories

• -r : Recursive
• -i : Prompt before overwrite
• -v : Verbose

1
cp -riv folder/ /target/

7. rm – Remove files or directories

• -r : Recursive
• -f : Force
• -i : Interactive

rm -rf old_folder/

8. touch – Create empty file or update timestamp

touch newfile.txt

9. ln – Create links

• -s : Symbolic link

ln -s /path/to/original shortcut

10. clear – Clear terminal screen

clear

11. cat – Concatenate and display files

cat file.txt

12. echo – Print text to terminal

echo "Hello, Linux!"

13. less – View file content one screen at a time

less largefile.txt

2
14. man – Show manual for command

man ls

15. uname – Show system information

• -a : All system info

uname -a

16. whoami – Show current username

whoami

17. tar – Archive files

• -c : Create
• -x : Extract
• -z : Compress with gzip
• -v : Verbose

tar -czvf archive.tar.gz folder/

18. grep – Search text

• -i : Ignore case
• -r : Recursive

grep -i "error" file.log

19. head – Show first lines of a file

head -n 10 file.txt

20. tail – Show last lines of a file

tail -n 10 file.txt

3
21. diff – Compare files line by line

diff file1.txt file2.txt

22. cmp – Compare two files byte by byte

cmp file1.bin file2.bin

23. comm – Compare two sorted files

comm file1.txt file2.txt

24. sort – Sort lines in a file

sort names.txt

25. export – Set environment variables

export PATH=$PATH:/new/path

26. zip – Compress files

zip archive.zip file1 file2

27. unzip – Extract zip files

unzip archive.zip

28. ssh – Secure shell connection

ssh user@hostname

29. service – Control system services

service apache2 start

4
30. ps – Show running processes

• aux : Show all processes

ps aux

31. kill and killall – Terminate processes

kill 1234
killall firefox

32. df – Show disk usage

• -h : Human-readable

df -h

33. mount – Mount storage devices

mount /dev/sdb1 /mnt/usb

34. chmod – Change permissions

chmod 755 script.sh

35. chown – Change file owner

chown user:group file.txt

36. ifconfig – Show network interfaces (deprecated, use ip )

ifconfig

37. traceroute – Trace network path

traceroute google.com

5
38. wget – Download files from the web

wget https://example.com/file.zip

39. ufw – Uncomplicated Firewall

ufw enable
ufw allow 22

40. iptables – Configure firewall rules

iptables -L

41. apt , yum , pacman , rpm – Package managers

apt install nginx


yum install httpd

42. sudo – Run command as superuser

sudo apt update

43. cal – Display calendar

cal

44. alias – Create shortcut commands

alias ll='ls -lah'

45. dd – Low-level copying and conversion

dd if=/dev/sda of=/backup.img

6
46. whereis – Locate binary, source, and man pages

whereis python

47. whatis – Show short description of command

whatis tar

48. top – Show live system processes

top

49. useradd – Add new user

sudo useradd newuser

50. passwd – Change user password

passwd username

You might also like