List of content you will read in this article:
First, you need to know that ninety percent of server infrastructure operating systems use Linux; 96.3% is for servers using Linux and it is estimated to be more than 1 million.
Therefore, learning Linux commands is the first step and the most important task that as a server administrator, you should seriously pursue and master the mere matter of Linux all the way. If you want to manage a server from Linux and its commands completely, you have to master all Linux management commands to manage and control one or several servers simultaneously without the need for a graphical environment and only through commands.
Unlike the Windows operating system, Linux has very strong acceptability in using commands to manage the server, so with information from the commands and without using the graphical environment, a Linux server can be remotely managed in a completely professional manner, which is A Windows server would be impossible or very difficult.
How Linux is well-codified
Linux has more than 27.8 million code lines. According to Linux Statistics, developers composed more than 817,700 lines of code upon the above number and removed 285,485, and rewrote 11,859 code lines for kernel version 5.14. Many find this great deal too large to run on not mega devices.
Hardware Management Commands
In this section, we would like to describe a series of hardware management commands that can be used to control the on, off and reboot status of the server. It is the first init command that can be used to change the operating mode of the server; there are six modes defined for this command, 0 is used to shut down the system, mode 1 is the single-user mode, which is usually used for recovery, mode 2 is the multi-user mode.
Mode 3; multi-user mode with network. Mode 4 is unused and undefined, mode 5 is the graphical mode of the system that Linux usually works in this mode and comes up with a graphical user interface, and finally, mode 6 is to take Linux to reboot mode, like when you type the reboot command.
The next command is logout, which works like when you log out graphically from Windows exit
The reboot command works exactly like restarting in Windows
The shutdown command also shuts down the system, but if it is used with other switches, it can have a different function; for example, the following command reboots the system.
shutdown -r now
Search Commands in Linux
There are also powerful commands for searching in Linux, by which you can search for various items such as files, users, directories, etc. It is the most powerful command available, discussed below on how to use it. To find a file in Linux, we use the command and the name-switch as follows.
find / -name filename
- Enter the name of the desired file instead of the file name.
If you are looking for files with a specific extension, use the following command. By the following command, all the files whose extension is txt. It can be displayed for you.
find / -name *.txt
Plus with that, keep this in mind, if you want to search for a path other than the / branch, you can replace it with your path; or, if you are looking for a file that was last used 30 days ago and until it has not been accessed at the current time, you can use the following command.
find / -type f –atime 30
In the above command, with the type- switch, we are only looking for files, and we create a kind of filter, and by atime-, all the files of the path, which were last accessed in the last 30 days, are received in the output.
The next command we use for searching is the locate command, the advantage of this command is that it is faster than finding the search, but you must click the updated command before the database you use for searching, it will be updated.
You can also use the following command to display the path of a binary file in Linux.
By this command, we are looking for the ls binary file path, which, if you remember, is a Linux command. There is also a final command that has a function like Whereis.
Mount Commands in Linux
The mount command also mounts a directory or hard disk to another path in Linux. For instance, when you connect a usb to your Linux, this hardware is recognized as a partition by the system, and you can use the information inside this disk in a directory specified by yourself; you can create a directory first. Then mount the usb to it.
mount /dev/usb /root/myusb
We also use the following command to remove the partition from deployment mode.
As a server administrator, you must regularly check the amount of used space or the free space of the server hard drive and, if necessary, think of the most suitable programs. The df command lets you see all the mounted partitions and their free space.
You can use the following command.
Enter the name of your desired directory instead of dir-name.
At this point, we arrive at the user management commands done by the server administrator with root access; the administrator can use these commands to create, delete, or limit their access to users on Linux servers.
A time limit is applied to a user by the following command:
chage -E 2005-12-31 user
Enter your desired username instead of the user; you can always use the human command first to check the switches. In many cases, you have to create a group for specific categories of users, give special access to this group, and create a user with similar access in the future. Add the user to this group, and your work will be easy.
Data Center Monitoring Commands in Linux
vmstat - virtual memory consumption
Among other Linux commands, vmstat command is to be used to display the consumption of virtual memory (Virtual Memory Statistics), kernel threads, disks, system processes, interrupts, the amount of processor activity, (I/O) Blocks) I/O blocks. By default, the vmstat command does not exist on Linux systems, and to activate it, you must install a package called sysstat on the system.
tcpdump - Analysis and analysis of network packets
The tcpdump command is one of the most used Linux commands. This command is very useful for network packet analyzer or packet sniffer programs. It is also possible to save special packages in files for analysis in the future. The tcpdump command can be used on most different Linux demission.
netstat – network usage
netstat is a utility command to go over network packages' input and output values. This command helps the server administrator monitor the network performance and tackle related issues.
htop - Monitoring Linux processes
The htop command is a powerful, real-time command for real-time monitoring through Linux processes. This command is similar to the command above, with the nuance that it enables other functional features such as viewing processes vertically or horizontally, shortcuts, and providing a user-friendly interface for managing processes. The htop command is a third-party tool and is not the default on Linux systems. To install the htop command, you must use YUM management packages.
iotop - disk I/O monitoring
Another Linux command is the iotop command, which is very similar to the Top command and the htop program, except that the iotop command uses calculation functions to display disk I/O and running processes. This command is mainly used when we want to read & write processes (Read/Writes Processes) that use space or #iotop.
iostat - consumption of inputs/outputs
ioStat is a simple command to collect and display input and output storage device consumption. This command is often used to check the performance of storage devices, and it can be used to diagnose problems related to local disks, input and output devices, and remote disks such as NFS.
iptraf - real-time monitoring of LAN network IP
Among other Linux commands, the iptraf command is an Open Source and console-based command for Real-Time IP LAN Monitoring. This command gives and displays a wide variety of information similar to IP traffic entering the network, including TCP flags, ICMP, TCP/UDP weaknesses, TCP communication packets, and the number of bytes. It also gives useful and detailed information about TCP, UDP, IP, ICMP, non-IP, IP checksum errors, interface activity, etc.
psacct or acct - monitoring of user activities
The psacct or acct command is another useful Linux command to monitor all user activities. This command is a very suitable tool for monitoring all the activities of users that are running in the background, and it also provides the possibility of checking all the detailed activities in an overview and also specifies which users are currently used. What are the sources?
These commands are very useful for servers, and it is possible to check the activities of users, what they are currently doing on the server, which commands they are executing, how much consumption each of them, and how long It is done on the server. It enables the system to be active.
monit - Monitoring of Linux services and processes
monit is an open-source command and a process monitoring tool that automatically manages system management, programs, files, folders, access permissions, system files and checksum. The monit command monitors all services such as Apache, MySQL, Mail, FTP, ProFTP, Nginx, SSH, etc. The result of the situation can be seen both in the command line and the system graphically.
nethogs - network bandwidth monitoring per process
The nethogs command is also a small Open Source command like the top command, which is used to display the network activities of each processor on your system. It also allows displaying real-time traffic (real-time network traffic) used by any application or software.
iftop – network bandwidth monitoring
The iftop command is one of the other open-source and terminal-based Linux commands, which is used to display a list of the bandwidth consumed by the source or destination hosts to your system's network card. Note that the iftop command checks network bandwidth, while the above command checks CPU usage.
- The iftop command is from the top command family, which monitors a specific interface and shows the bandwidth between the hosts.
monitorix – system and network monitoring
The monitorix command is a lightweight tool on Linux and Unix servers designed to manage network and system resources. This command includes the Http web server feature that regularly collects network and system information and displays it as graphs or diagrams.
monitorix command, system load (average system load), memory allocation (memory allocation), the health of drivers, system services, network ports, email consumption (Sendmail, Postfix, Dovecot, etc.), consumption Monitors MySQL database etc.
- The command is designed to monitor the system's performance as a whole and allows troubleshooting, finding bottlenecks, and creating a general non-software activity.
suricata – network security monitoring
The suricata command is one of the most widely used open-source commands for securing the network, identifying intruders, and monitoring Linux, Windows and FreeBSD systems.
- This command was designed by the non-profit OISF—Open Information Security Foundation.
collectl – multipurpose monitoring tool
The collectl tool is a very powerful and comprehensive tool that can collect complete information from Linux service resources such as CPU consumption, memory, network, inodes, processes, nfs, tcp, sockets, etc.
🎀🎀Get ahead of the competition with our high-speed Linux VPS hosting, fortified with advanced security measures and top-of-the-line hardware, providing a reliable and swift online presence.🎀🎀
In conclusion, mastering PC command in Linux opens up possibilities and empowers users to navigate and control their systems efficiently. With a solid understanding of essential Linux commands, users can perform a wide range of tasks, from file management to network configuration, precisely and easily.
By harnessing the power of the command line interface, users can leverage the full potential of their Linux systems, streamline workflows, and optimize their computing experience. Embracing the command line enhances productivity and deepens one's understanding of the underlying principles of Linux. So, take the time to explore and practice these commands and embark on a rewarding journey of Linux mastery.
People also read: