Top 50 Most Commonly Used Linux Commands

Rajiv thejuRajiv theju
6 min read

Linux is a powerful operating system used by developers, system administrators, and tech enthusiasts worldwide. Whether you're a novice or an experienced user, mastering the most commonly used Linux commands can significantly enhance your productivity and efficiency. In this blog, we'll explore the top 50 Linux commands, complete with examples to help you understand and utilize them effectively.

1. ls: List Directory Contents

The ls command lists the contents of a directory.

ls
ls -l

2. cd: Change Directory

The cd command changes the current directory.

cd /path/to/directory
cd ..

3. pwd: Print Working Directory

The pwd command prints the current working directory.

pwd

4. mkdir: Create a New Directory

The mkdir command creates a new directory.

mkdir new_directory

5. rmdir: Remove an Empty Directory

The rmdir command removes an empty directory.

rmdir empty_directory

6. touch: Create an Empty File or Update Timestamp

The touch command creates an empty file or updates the timestamp of an existing file.

touch newfile.txt

7. rm: Remove Files or Directories

The rm command removes files or directories.

rm file.txt
rm -r directory

8. cp: Copy Files or Directories

The cp command copies files or directories.

cp source.txt destination.txt
cp -r sourcedir/ destinationdir/

9. mv: Move or Rename Files or Directories

The mv command moves or renames files or directories.

mv oldname.txt newname.txt
mv file.txt /new/location/

10. cat: Concatenate and Display File Content

The cat command concatenates and displays file content.

cat file.txt

11. less: View File Content One Screen at a Time

The less command views file content one screen at a time.

less file.txt

12. head: Output the First Part of Files

The head command outputs the first part of files.

head file.txt
head -n 10 file.txt

13. tail: Output the Last Part of Files

The tail command outputs the last part of files.

tail file.txt
tail -n 10 file.txt

14. echo: Display a Line of Text

The echo command displays a line of text.

echo "Hello, World!"

15. man: Display the Manual for a Command

The man command displays the manual for a command.

man ls

16. chmod: Change File Modes or Access Control Lists

The chmod command changes file modes or Access Control Lists.

chmod 755 file.sh

17. chown: Change File Owner and Group

The chown command changes the file owner and group.

chown user:group file.txt

18. df: Report File System Disk Space Usage

The df command reports file system disk space usage.

df -h

19. du: Estimate File Space Usage

The du command estimates file space usage.

du -sh directory/

20. free: Display Free and Used Memory

The free command displays the amount of free and used memory in the system.

free -h

21. ps: Report a Snapshot of Current Processes

The ps command reports a snapshot of current processes.

ps aux

22. top: Display Linux Tasks

The top command displays Linux tasks.

top

23. kill: Send a Signal to a Process

The kill command sends a signal to a process.

kill 1234

24. killall: Kill Processes by Name

The killall command kills processes by name.

killall firefox

25. ping: Send ICMP ECHO_REQUEST to Network Hosts

The ping command sends ICMP ECHO_REQUEST to network hosts.

ping google.com

26. wget: The Non-Interactive Network Downloader

The wget command downloads files from the web.

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

27. curl: Transfer a URL

The curl command transfers data from or to a server.

curl http://example.com

28. ssh: OpenSSH SSH Client

The ssh command logs into a remote machine.

ssh user@hostname

29. scp: Secure Copy

The scp command copies files between hosts on a network.

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

30. grep: Print Lines Matching a Pattern

The grep command searches for patterns in files.

grep "search_term" file.txt

31. find: Search for Files in a Directory Hierarchy

The find command searches for files in a directory hierarchy.

find /path -name "filename"

32. sed: Stream Editor

The sed command is a stream editor for filtering and transforming text.

sed 's/old/new/g' file.txt

33. awk: Pattern Scanning and Processing Language

The awk command scans patterns and processes language.

awk '{print $1}' file.txt

34. alias: Create an Alias for a Command

The alias command creates an alias for a command.

alias ll='ls -la'

35. unalias: Remove an Alias

The unalias command removes an alias.

unalias ll

36. history: Show the Command History

The history command shows the command history.

history

37. clear: Clear the Terminal Screen

The clear command clears the terminal screen.

clear

38. sudo: Execute a Command as Another User

The sudo command executes a command as another user.

sudo apt update

39. apt-get: APT Package Handling Utility

The apt-get command is a package handling utility for Debian-based systems.

sudo apt-get install package_name

40. yum: Package Manager for RPM-Based Distributions

The yum command is a package manager for RPM-based distributions.

sudo yum install package_name

41. nano: Simple Text Editor

The nano command is a simple text editor.

nano file.txt

42. vi: Text Editor

The vi command is a text editor.

vi file.txt

43. tar: Archive Files

The tar command archives files.

tar -czvf archive.tar.gz directory/

44. gzip: Compress Files

The gzip command compresses files.

gzip file.txt

45. gunzip: Decompress Files

The gunzip command decompresses files.

gunzip file.txt.gz

46. zip: Package and Compress Files

The zip command packages and compresses files.

zip archive.zip file1 file2

47. unzip: Extract Compressed Files

The unzip command extracts compressed files.

unzip archive.zip

48. mount: Mount a File System

The mount command mounts a file system.

sudo mount /dev/sdX /mnt

49. umount: Unmount a File System

The umount command unmounts a file system.

sudo umount /mnt

50. df: Display Free Disk Space

The df command displays free disk space.

df -h

These commands cover a wide range of tasks, from basic file operations to system administration. By mastering these commands, you can enhance your efficiency and productivity in managing a Linux system. Whether you're navigating directories, managing files, or configuring system settings, these commands are essential tools in your Linux toolkit. Happy coding!

0
Subscribe to my newsletter

Read articles from Rajiv theju directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Rajiv theju
Rajiv theju