Mastering Linux: Top 40 Commands Every User Should Know

DataXSchool Learning Center
3 min readMay 11, 2024

Linux commands are the backbone of any Linux system. Whether you’re a beginner or an experienced user, knowing the right commands can greatly enhance your productivity and efficiency. In this comprehensive guide, we’ll explore the top 50 Linux commands, complete with examples in code format to help you understand their usage and functionality.

Let’s dive into the world of Linux command-line mastery:

  1. ls: List directory contents
ls
ls -l
ls -a
ls -lh

2. cd: Change directory

cd directory_name
cd ..
cd ~

3. pwd: Print working directory

pwd

4. mkdir: Make directory

mkdir directory_name

5. rm: Remove files or directories

rm file_name
rm -r directory_name
rm -rf directory_name (force remove)

6. cp: Copy files or directories

cp source_file destination_file
cp -r source_directory destination_directory

7. mv: Move or rename files or directories

mv old_file_name new_file_name
mv file_name new_directory

8. cat: Concatenate and display file contents

cat file_name

9. head: Display the beginning of a file

head file_name
head -n 10 file_name (display first 10 lines)

10. tail: Display the end of a file

tail file_name
tail -n 10 file_name (display last 10 lines)

11. grep: Search for patterns in files

grep pattern file_name
grep -r pattern directory_name

12. chmod: Change file permissions

chmod permissions file_name
chmod -R permissions directory_name

13. chown: Change file ownership

chown user_name:group_name file_name

14. wget: Download files from the internet

wget URL

15. curl: Transfer data from or to a server

curl URL

16. tar: Archive files

tar -czvf archive_name.tar.gz directory_name
tar -xzvf archive_name.tar.gz

17. unzip: Extract compressed files

unzip file_name.zip

18. ps: Display information about running processes

ps
ps aux | grep process_name

19. kill: Terminate processes

kill process_id

20. df: Display disk space usage

df -h

21. du: Display directory space usage

du -sh directory_name

22. free: Display amount of free and used memory

free -h

23. top: Display and manage running processes

top

24. ifconfig/ip: Display network interface information

ifconfig
ip addr show

25. ping: Test network connectivity

ping domain_name

26. ssh: Securely connect to a remote server

ssh user@host

27. scp: Securely copy files between hosts

scp file user@host:directory

28. crontab: Schedule tasks to run at specific times

crontab -e

29. sudo: Execute commands with superuser privileges

sudo command

30. man: Display manual pages for commands

man command_name

31. find: Search for files in a directory hierarchy

find /path/to/directory -name "file_name"

32. sort: Sort lines of text files

sort file_name

33. uniq: Report or omit repeated lines

uniq file_name

34. awk: Pattern scanning and processing language

awk '{print $1}' file_name

35. sed: Stream editor for filtering and transforming text

sed 's/old_text/new_text/g' file_name

36. wc: Print newline, word, and byte counts for files

wc file_name

37. tar: Manipulate tape archives

tar -cvf archive_name.tar file1 file2

38. gzip/gunzip: Compress or expand files

gzip file_name
gunzip file_name.gz

39. head: Display the first lines of a file

head -n 10 file_name

40. tail: Display the last lines of a file

tail -n 10 file_name

These 50 commands are just the tip of the iceberg when it comes to Linux command-line utilities. Experiment with them in a safe environment to become proficient and unlock the true power of the Linux terminal. Happy command-line hacking!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

DataXSchool Learning Center
DataXSchool Learning Center

Written by DataXSchool Learning Center

Helping student to get job in nosql databases (Cassandra, MongoDB, Neo4J,Redis)

No responses yet

Write a response