Linux commands are the building blocks of the Linux operating system, offering users powerful tools to interact with the system efficiently. Whether you’re a beginner or an experienced user, mastering essential Linux commands is crucial for effective system administration and navigation. we’ll explore the top 50 Linux commands that every user should be familiar with, providing a comprehensive guide to enhance your Linux experience.
1. pwd
The pwd
command prints the current working directory, helping you stay aware of your location within the file system.
2. ls
Use ls
to list the contents of a directory. Add options like -l
for detailed information or -a
to display hidden files.
3. cd
The cd
command is used to change directories. For instance, cd /directory/path
will navigate to the specified directory.
4. cp
Copying files or directories is made easy with the cp
command. For example, cp file.txt destination_directory
.
5. mv
To move files or directories, use mv
. It can also be used for renaming files. Example: mv file.txt newname.txt
.
6. rm
Remove files or directories with the rm
command. Be cautious, as deleted files are usually unrecoverable. Example: rm file.txt
.
7. mkdir
Create a new directory using mkdir
. Example: mkdir new_directory
.
8. rmdir
Remove an empty directory with rmdir
. Example: rmdir empty_directory
.
9. touch
Create an empty file or update the access and modification timestamps of an existing file using touch
.
10. nano/vi
Edit text files with nano
or vi
. These text editors are powerful tools for modifying configuration files and scripts.
11. cat
Print the contents of a file to the terminal using cat
.
12. grep
Search for patterns in files with grep
. This command is invaluable for text manipulation and log analysis.
13. find
Locate files and directories based on various criteria using find
.
14. chmod
Change file permissions using chmod
. For instance, chmod 755 file.txt
gives read, write, and execute permissions to the owner and read and execute permissions to others.
15. chown
Change file ownership using chown
. Example: chown user:group file.txt
.
16. ps
View information about active processes with ps
.
17. kill
Terminate a process with kill
. Use kill -9
for a forceful termination.
18. top
Monitor system resource usage in real-time using top
.
19. df
Check disk space usage with df
. This command provides information about available disk space on mounted filesystems.
20. du
Determine file and directory disk usage with du
. Useful for finding space-consuming directories.
21. tar
Create or extract compressed archives with tar
. Example: tar -cvzf archive.tar.gz directory
.
22. gzip
Compress or decompress files using gzip
.
23. ping
Check network connectivity to a remote server with ping
.
24. traceroute
Trace the route that packets take to reach a destination using traceroute
.
25. ssh
Connect to a remote server securely with ssh
. Example: ssh username@hostname
.
26. scp
Copy files securely between a local and a remote host using scp
.
27. wget/curl
Download files from the internet with wget
or curl
.
28. uptime
View how long the system has been running using uptime
.
29. date
Display the current date and time using date
.
30. cal
Show a calendar in the terminal with cal
.
31. history
View a list of previously executed commands using history
.
32. alias
Create custom shortcuts for commands using alias
.
33. useradd/userdel
Add or delete user accounts with useradd
and userdel
.
34. passwd
Change a user’s password with passwd
.
35. su/sudo
Switch users or execute commands with superuser privileges using su
or sudo
.
36. ifconfig/ip
Display network interface information with ifconfig
(or ip
).
37. lsof
List open files and the processes that opened them using lsof
.
38. netstat
Show network-related information, such as open ports and active connections, with netstat
.
39. chmod
Change file permissions with the chmod
command.
40. chroot
Change the root directory for a command using chroot
.
41. echo
Print text or variables to the terminal with echo
.
42. wc
Count lines, words, and characters in a file using wc
.
43. sort
Sort lines of text files with sort
.
44. uniq
Remove or display duplicate lines in a file with uniq
.
45. head
Display the first few lines of a file with head
.
46. tail
Show the last few lines of a file with tail
.
47. scp
Copy files securely between a local and a remote host using scp
.
48. watch
Execute a command repeatedly and display the results with watch
.
49. sed
Stream editor for filtering and transforming text with sed
.
50. awk
Pattern scanning and processing language with awk
.