- 25 Useful Linux Commands for System Administrators
- ls — List Directory Contents
- cd — Change Directory
- pwd — Print Working Directory
- mkdir — Make Directory
- rm — Remove Files or Directories
- rmdir — Remove Directories
- cp — Copy Files or Directories
- mv — Move or Rename Files or Directories
- cat — Display File Contents
- tail — Display Last Part of a File
- head — Display First Part of a File
- less — Display File Contents Page by Page
- top — Display System Resource Usage
- ps — Display Running Processes
- kill — Terminate Processes
- df — Display Disk Space Usage
- du — Display Directory Space Usage
- ifconfig — Configure Network Interfaces
- ping — Test Network Connectivity
- netstat — Display Network Connections
- ssh — Securely Connect to a Remote System
- scp — Securely Copy Files Between Systems
- wget — Download Files From Web
- tar — Create and Extract Compressed Archives
- crontab — Schedule Tasks to Run at Specific Times
- useradd — Add a New User to System
- passwd — Change User Password
- sudo — Execute a Command with Superuser Privileges
- Conclusion
- 60 Commands of Linux : A Guide from Newbies to System Administrator
25 Useful Linux Commands for System Administrators
Linux is a popular open-source operating system used by many system administrators for managing their servers and infrastructure. As a system administrator, it is essential to have a good understanding of Linux commands to manage and troubleshoot system efficiently. In this article, we will discuss 25 useful Linux commands for system administrators, along with their examples.
ls — List Directory Contents
The ls command is used to list contents of a directory. By default, it lists files and directories in current directory.
Example − To list all files and directories in current directory, use following command −
cd — Change Directory
The cd command is used to change current working directory.
Example − To change current directory to /usr/local/bin, use following command −
pwd — Print Working Directory
The pwd command is used to print current working directory.
Example − To print current working directory, use following command −
mkdir — Make Directory
The mkdir command is used to create a new directory.
Example − To create a new directory called test, use following command −
rm — Remove Files or Directories
The rm command is used to remove files or directories.
Example − To remove a file called myfile.txt, use following command −
rmdir — Remove Directories
The rmdir command is used to remove directories.
Example − To remove a directory called test, use following command −
cp — Copy Files or Directories
The cp command is used to copy files or directories.
Example − To copy a file called myfile.txt to a new location /tmp, use following command −
mv — Move or Rename Files or Directories
The mv command is used to move or rename files or directories.
Example − To rename a file called myfile.txt to newfile.txt, use following command −
cat — Display File Contents
The cat command is used to display contents of a file.
Example − To display contents of a file called myfile.txt, use following command −
tail — Display Last Part of a File
The tail command is used to display last part of a file.
Example − To display last 10 lines of a file called myfile.txt, use following command −
head — Display First Part of a File
The head command is used to display first part of a file.
Example − To display first 10 lines of a file called myfile.txt, use following command −
less — Display File Contents Page by Page
The less command is used to display file contents page by page.
Example − To display contents of a file called myfile.txt page by page, use following command −
top — Display System Resource Usage
The top command is used to display system resource usage, such as CPU and memory usage.
Example − To display system resource usage, use following command −
ps — Display Running Processes
The ps command is used to display running processes.
Example − To display running processes, use following command −
kill — Terminate Processes
The kill command is used to terminate processes.
Example − To terminate a process with a process ID of 1234, use following command −
df — Display Disk Space Usage
The df command is used to display disk space usage.
Example − To display disk space usage for all mounted file systems, use following command −
du — Display Directory Space Usage
The du command is used to display directory space usage.
Example − To display directory space usage for current directory, use following command −
ifconfig — Configure Network Interfaces
The ifconfig command is used to configure network interfaces.
Example − To display network interface information, use following command −
ping — Test Network Connectivity
The ping command is used to test network connectivity.
Example − To test network connectivity to a host with IP address 192.168.1.1, use following command −
netstat — Display Network Connections
The netstat command is used to display network connections.
Example − To display active network connections, use following command −
ssh — Securely Connect to a Remote System
The ssh command is used to securely connect to a remote system.
Example − To connect to a remote system with IP address 192.168.1.1, use following command −
scp — Securely Copy Files Between Systems
The scp command is used to securely copy files between systems.
Example − To copy a file called myfile.txt from local system to a remote system with IP address 192.168.1.1, use following command −
scp myfile.txt user@192.168.1.1:/path/to/destination
wget — Download Files From Web
The wget command is used to download files from web.
Example − To download a file from a website, use following command −
wget https://example.com/file.zip
tar — Create and Extract Compressed Archives
The tar command is used to create and extract compressed archives.
Example − To create a compressed archive of a directory called mydir, use following command −
tar -czvf mydir.tar.gz mydir
crontab — Schedule Tasks to Run at Specific Times
The crontab command is used to schedule tasks to run at specific times.
Example − To schedule a task to run every day at 2am, use following command −
useradd — Add a New User to System
The useradd command is used to add a new user to system.
Example − To add a new user with username «john», use following command −
passwd — Change User Password
The passwd command is used to change password of a user.
Example − To change password for user «john», use following command −
sudo — Execute a Command with Superuser Privileges
The sudo command is used to execute a command with superuser privileges.
Example − To execute a command as a superuser, use following command −
Conclusion
In conclusion, Linux commands are essential for system administrators to manage and troubleshoot their systems efficiently. above 25 commands are just a few of many commands available in Linux. By mastering these commands, you can become more proficient in managing Linux systems. I hope this article has been useful in providing you with some useful Linux commands to help you in your role as a system administrator.
60 Commands of Linux : A Guide from Newbies to System Administrator
For a person new to Linux, finding Linux functional is still not very easy even after the emergence of user friendly Linux distribution like Ubuntu and Mint. The thing remains that there will always be some configuration on user’s part to be done manually.
Just to start with, the first thing a user should know is the basic commands in terminal. Linux GUI runs on Shell. When GUI is not running but Shell is running, Linux is running. If Shell is not running, nothing is running. Commands in Linux is a means of interaction with Shell. For a beginners some of the basic computational task is to:
- View the contents of a directory : A directory may contains visible and invisible files with different file permissions.
- Viewing blocks, HDD partition, External HDD
- Checking the integrity of Downloaded/Transferred Packages
- Converting and copying a file
- Know your machine name, OS and Kernel
- Viewing history
- Being root
- Make Directory
- Make Files
- Changing the file permission
- Own a file
- Install, Update and maintain Packages
- Uncompressing a file
- See current date, time and calendar
- Print contents of a file
- Copy and Move
- See the working directory for easy navigation
- Change the working directory, etc…
And we have described all of the above basic computational task in our First Article.
This was the first article of this series. We tried to provide you with detailed description of these commands with explicit examples which was highly appreciated by our reader in terms of likes, comments and traffic.
What after these initial commands? Obviously we moved to the next part of this article where we provided commands for computational tasks like:
- Finding a file in a given directory
- Searching a file with the given keywords
- Finding online documentation
- See the current running processes
- Kill a running process
- See the location of installed Binaries
- Starting, Ending, Restarting a service
- Making and removing of aliases
- View the disk and space usages
- Removing a file and/or directory
- Print/echo a custom output on standard output
- Changing password of on-self and other’s, if you are root.
- View Printing queue
- Compare two files
- Download a file, the Linux way (wget)
- Mount a block / partition / external HDD
- Compile and Run a code written in ‘C’, ‘C++’ and ‘Java’ Programming Language
This Second Article was again highly appreciated by the readers of Tecmint.com. The article was nicely elaborated with suitable examples and output.
After providing the users with the glimpse of Commands used by a Middle Level User we thought to give our effort in a nice write-up for a list of command used by an user of System Administrator Level.
In our Third and last article of this series, we tried to cover the commands that would be required for the computational task like:
- Configuring Network Interface
- Viewing custom Network Related information
- Getting information about Internet Server with customisable switches and Results
- Digging DNS
- Knowing Your System uptime
- Sending an occasional Information to all other logged-in users
- Send text messages directly to a user
- Combination of commands
- Renaming a file
- Seeing the processes of a CPU
- Creating newly formatted ext4 partition
- Text File editors like vi, emacs and nano
- Copying a large file/folder with progress bar
- Keeping track of free and available memory
- Backup a mysql database
- Make difficult to guess – random password
- Merge two text files
- List of all the opened files
Writing this article and the list of command that needs to go with the article was a little cumbersome. We chose 20 commands with each article and hence gave a lot of thought for which command should be included and which should be excluded from the particular post. I personally selected the commands on the basis of their usability (as I use and get used to) from an user point of view and an Administrator point of view.
This Articles aims to concatenate all the articles of its series and provide you with all the functionality in commands you can perform in our this very series of articles.
There are too long lists of commands available in Linux. But we provided the list of 60 commands which is generally and most commonly used and a user having knowledge of these 60 commands as a whole can work in terminal very much smoothly.
That’s all for now from me. I will soon be coming up with another tutorial, you people will love to go through. Till then Stay Tuned! Keep Visiting Tecmint.com.
Like and Share and Help us to Spread