Today, Linux powers the vast majority of the virtual world. Admins and network owners like to have complete control over their online presence by leveraging Linux to its greatest potential. (Best Linux server commands)
Learn the 20 best Linux server commands listed below if you’re a beginner Linux user wishing to advance your system administration skills. This book was put together by a group of seasoned system administrators to help you get the most out of your learning experience. Most of these commands are simple, but if used correctly, they may greatly improve the management and monitoring of your Linux servers.
Simple but Practical Linux Server Commands
Because they’re so fundamental, most of the commands listed in this guide should be familiar to veteran users.
We’ve discussed why these server commands are vital for beginners and how you may profit from them.
This tutorial will also be useful to experienced sysadmins who are looking for quick references to common Linux server commands.
1. uptime (Best Linux server commands)
The uptime command is a very basic and one of the best Linux server commands that show us how long our system has been running. This Linux program can be used to log in to distant servers and determine how long they have been running. The uptime command also provides the remote system’s load average and the number of users currently logged in.
# uptime
# uptime -p
You can format your output differently by using some additional options. The -p option displays the system uptime in a readable format.
2. w
The w command is a useful server tool that displays all of the users logged in to a system as well as their activity. This command allows administrators to see users and their processes, as well as the load average. It also displays information such as the remote hosts, login time, idle time, tty name, and so on.
# w
Additional flags can also be used, as seen above. The –short or –s option produces a shortlist without the CPU time or login information. To print the IP addresses of remote hosts, use –ip-addr or –i.
3. who
The “who” command can also be used to display information about distant users. However, unlike w, who does not show what the users are doing. Who, on the other hand, provides a plethora of other options that allow us to quickly obtain more information?
# who
The who command returns the names of the users, as well as the tty name and time. Use the -b or –boot flag to publish the time the system was booted, the -d or –dead flag to show the dead processes, and the –ips flag to print the remote hosts’ IP address instead of their username.
4. users
One of the most basic server commands for printing only remote usernames is users. This is one of the most basic Linux commands for novices, requiring absolutely no further parameters.
# user
Only the –version and –help options are available to you.
5. whoami
The whoami command has a lot in common with the users command. This is one of the most commonly used Linux commands among newcomers, and it displays the username you used to log in. It basically prints out the effective user id.
# whoami
As with users, whoami’s argument is limited to the two alternatives listed above.
6.less
For Linux sysadmins, the less command is another basic but powerful command. Due to its extensive feature set, it is one of the most flexible Linux commands in the arsenal of seasoned administrators. The primary goal of using less is to swiftly browse files and navigate through them using the page up and down buttons.
# less /var/log/custom.log
Because less supports a wide range of options and formats, we recommend reading the man and help pages to learn more about this command. It is regarded as the best Linux server commands right now
7. more
You may also use the more command to fast scroll through large files. This command allows you to view a file’s contents one screenful at a time. More has some useful command-line parameters, but it lacks the potency of the less command.
# more /var/log/custom.log # more —help # man more
You can quickly uncover all of the available options by consulting the help page. If you want more information about this command, go to the documentation page.
8. tail
One of the most useful tools for quickly debugging log files is the tail command. This Linux programme merely shows the last few lines of a file, which in the case of log files are more likely to contain errors.
The tail can be incredibly handy if you’re an administrator looking for quick troubleshooting.
# tail /var/log/custom.log
Using the -f option, administrators can keep track of their logs while they’re being written. A thorough summary of the tail command may be found in the man page.
9.curl
One of the most powerful Linux server commands for transmitting files over the internet is curl. Because of its profusion of simple yet important functions, it is a widely used software for network administrators. Curl accepts a number of extra inputs that allow it to do extremely sophisticated operations.
# curl example.com/file.txt
Curl commands are so varied that it’s hard to cover them all in this book. If you want to learn how to use curl on Linux, check out our guide.
10. wget
The wget package is one of two de-facto programmes for downloading files on Linux and is frequently used for getting files over the web. If you’re a server administrator trying to improve your Linux skills, you’ll want to master this command.
# wget example.com/file.txt
# wget -c example.com/file.txt
Because wget has so many more command-line options, you need first read through their man page to learn how to use them.
11. scp
The scp command is used to send files securely between distant Linux systems. It stands for Secure Copy and allows administrators to quickly exchange files across several systems in a network. In addition, scp has certain appealing characteristics, such as the ability to manage ssh access, the use of secure cyphers, and so on.
# scp user@remote host:file.txt /local/documents/
The text file from the remote host is downloaded to the local machine with this command. You can also use scp to transfer files from your local system to remote hosts, as well as from one remote host to several remote hosts.
12. rsync
Another excellent tool for sharing data over the internet is rsync. It’s a modern alternative to the rcp programme, allowing administrators to simply synchronise files between source and destination.
The rsync programme is quick and adaptable, making it an excellent alternative for server administrators.
# rsync -t *.html new-server:public_html/
This command copies all HTML files from the local workstation to the new-server remote host.
Please refer to the rsync man page for a complete list of the tool’s possible settings.
sftp (secure file transfer protocol)
13. sftp
The ftp command should be familiar to you already. Admins can use the File Transmit Protocol to transfer files.
The sftp command is an improved version of the ftp command that allows you to transfer files through a secure shell connection.
# sftp [email protected]
This one of the best Linux server commands creates an interactive terminal for securely transmitting files. To see all available choices, simply type a question mark (?) in this console. We also recommend reading their handbook to gain a thorough understanding of the sftp command.
14. ssh
Using the secure shell protocol, the ssh command in Linux allows administrators to administer remote hosts. Without a question, it is one of the most commonly used Linux server commands.
As a server administrator, you’ll need to know how to use the ssh command.# ssh user@host
# man ssh
Because the ssh command exposes a lot of additional options to server administrators, it’s best to read the instructions before using it.
15. ping
For network administrators, the ping command is a simple yet incredibly valuable command. It enables network administrators to quickly test the connectivity between local and remote machines.Although ping is simple to use, it might help you save time when troubleshooting your network.# ping google.com
# ping yoursite.com
1# 2ping -c 3 example.com
Both IPv4 and IPv6 connections can be tested with ping.
To learn about all of the command-line options accessible to ping, go to the manual page.
16. whois
The whois command allows Linux administrators to search for items in WHOIS databases that are publicly accessible. It’s frequently used to find sensitive data about a distant host. Using the whois command, you may quickly obtain vital information on domain names and IP addresses.
# whois google.com # man whois
Because whois displays a large quantity of data, administrators frequently filter it out with tools like grep. Overall, because of its practical applications, whois is a helpful command for server administrators.
17. Dig
It is another name in the list of best Linux server commands.The dig command is similar to the whois command in terms of functionality. It can be used to retrieve domain-specific data from a Linux computer. The name dig actually stands for Domain Information Groper.
# dig example.com When you run this command, you’ll obtain a lot of helpful information like the IP address, query time, and error codes.
18. nslookup
This command can be used to query DNS servers and retrieve important information about remote servers. The nslookup command is frequently used by Linux system administrators to obtain host-specific information from Domain Name Servers (DNS).
Take a look at the command below to see how it works.
# nslookup google.com
Despite its apparent simplicity, nslookup is one of the most commonly used commands by many administrators.
Additionally, nslookup allows administrators to utilise the tool interactively.
19. netstat
The netstat command is a useful Linux programme that allows administrators to see all active TCP connections, socket statuses, routing tables, and other information. The netstat command can be particularly useful if you are a server administrator in charge of large-scale IT infrastructure.# netstat
# netstat -l
# netstat -a | more
Because netstat has so many useful options and arguments, it’s a good idea to read the instructions before using it.
20. traceroute
In Linux, the traceroute program shows us the paths our packets traverse before reaching a remote destination.
This is a simple yet helpful server command that makes determining routing issues and designing firewalls a breeze.# traceroute google.com
# traceroute example.com
This is a classic Linux command for efficiently checking network hops and distances.