As a system administrator, having a good understanding of Linux commands is essential for effectively managing and troubleshooting systems. Here are some common Linux commands that every system admin should know:
1. ls: Lists files and directories in the current directory.
Example: ls -l
(lists files and directories with detailed information)
2. cd: Changes the current directory.
Example: cd /path/to/directory
(changes to the specified directory)
3. pwd: pwd
Prints the current working directory.
4. mkdir: Creates a new directory.
Example: mkdir new_directory
(creates a directory named “new_directory”)
5. rm: Removes files and directories.
Example: rm file.txt
(removes a file named “file.txt”)
`rm -r directory` (removes a directory and its contents recursively)
6. cp: Copies files and directories.
Example: cp file.txt destination/
(copies a file to the specified destination) cp -r directory/ destination/
(copies a directory and its contents recursively)
7. mv: Moves or renames files and directories.
Example: mv file.txt new_location/
(moves a file to the specified location)
mv file.txt new_name.txt
(renames a file)
8. cat: Displays the contents of a file.
Example: cat file.txt
(displays the contents of “file.txt”)
9. grep: Searches for a pattern in files.
Example: grep “pattern” file.txt
(searches for the specified pattern in file.txt
)
10. chmod: Changes the permissions of files and directories.
Example: chmod 755 file.txt
(sets read, write, and execute permissions for the owner, and read and execute permissions for others)
11. chown: Changes the ownership of files and directories.
Example: chown user:group file.txt
(changes the ownership of “file.txt” to the specified user and group)
12. top: top
Displays real-time information about system processes and resource usage.
13. ps: Shows information about currently running processes.
Example: ps aux
(displays detailed information about all running processes)
14. kill: Terminates a process.
Example: kill process_id
(terminates the process with the specified ID)
15. ifconfig: ifconfig
Displays network interface configuration information.
16. ping: Sends a network request to a specific IP address to check connectivity.
Example: ping google.com
(sends network requests to google.com)
17. ssh: Establishes a secure shell connection to a remote server.
Example: ssh user@hostname
(connects to the specified hostname as the specified user)
18. sudo: Executes a command with administrative privileges.
Example: sudo command
(executes the specified command with root/administrator privileges)
19. man: Displays the manual pages for a command, providing detailed information and usage examples.
Example: man ls
(displays the manual page for the “ls” command)
These are just a few examples of common Linux commands that system administrators frequently use. There are many more commands and options available, so it’s beneficial to continue exploring and learning new commands as you gain experience.
Pic Source: Unknown.