A proper know how of the functioning of your Linux server is a boost to your computing experience. With a few built-in commands and some add-on tools, you will be able to monitor your Linux server performance. Some of the most common problems associated with server debugging and system analysis include disk, CPU and network bottlenecks. Below are some of the commands that you will find useful:
1. top – Process Activity Command
If you want to have a real-time and dynamic view of the processes running in the computer, then the top program becomes handy. The program displays the programs with the highest CPU usage. Every five seconds, it updates the list of the programs running on the server.
This program offers several useful hot keys:
|t||Used for displaying summary information on and off|
|m||Used for displaying information about the memory on and off|
|A||This hotkey is used for sorting the display according to top users of various system resources. You can use it to identify the tasks that consume more system resources|
fIt is used to enter the top interactive screen. You can use it to set up top for a specific task.
oFor an interactive selection of task ordering in top
rCommand for issue renicekCommand for issue killzFor turning color on or off
2. vmstat – System Activity, Hardware and System Information
This command reports information concerning memory, processes, paging, traps, block IO and CPU activities.
|m||This command is used for displaying Display Memory Utilization Slabinfo|
|a||Use this command if you want information about the active and the inactive memory pages|
3. uptime – Tell How Long The System Has Been Running
Use this command to see for how long the server has been running. It also shows the current time, the number of logged in users and the average system load for the last 1,5 and 15 minutes.
4. ps – Displays The Processes
This command displays a snapshot of all the current processes. It works just like top only that it provides a little bit more information.
|# ps -A||Select all processes|
|# ps -AlF||This command is used for showing command line arguments that have been passed for processing|
|# ps -AlFH||See NLWP and LWP thread|
|# ps -AlLm||To display threads following processing|
|# ps ax|
# ps axuFor printing all server processes# ps -ejH
# ps axjf
# pstreePrint Process Tree# ps -C lighttpd -o pid=Displaying lightpd process id only# ps -p 55977 -o comm=Displaying PID 55977 name# ps -auxf | sort -nr -k 3 | head -10Find the top ten CPU consuming processes# ps -U vivek -u vivek uDisplay all processes that are running as user vivek
5. tcpdump – Detailed Network Traffic Analysis
This command is useful for damping traffic on the network. For one to use it, they require proper understanding of the TCP / IP protocol.
|# tcpdump -i eth1 ‘udp port 53’||Display DNS traffic information|
|# tcpdump ‘tcp port 80 and (((ip[2:2] – ((ip&0xf)<<2)) – ((tcp&0xf0)>>2)) != 0)’||Displays all IPV4 HTTP packets associated with port 80. Does not include packets without data.|
|# tcpdump -i eth1 ‘dst 184.108.40.206 and (port 21 or 20’||Displaying all FTP sessions to a particular IP e.g 220.127.116.11,|
6. Nmap – Scans the Network for Open Ports
This command is normally used for:
- Scanning networks to find open ports.
- Testing firewall rules
- Uses raw IP to establish available hosts, services and operating system.
- Network security audits
Among the system and network administrators, it’s popular for carrying out routine tasks like managing schedules for service upgrades, network inventory and monitoring server uptime or host.
Here are some of the commands associated with Nmap.
|# nmap -v -sT localhost|
# nmap -v -sT 192.168.0.0/24TCP Connect scanning for localhost and 192.168.0.0/24 network# nmap -v -sF localhost
# nmap -v -sF 192.168.0.0/24Use this command for nmap TCP FIN scanning# nmap -v -sR localhost
# nmap -v -sR 192.168.0.0/24For finding RPC services# nmap -v -O localhost
# nmap -v -O 192.168.0.0/24For finding UDP ports# nmap -v -sW localhost
# nmap -v -sW 192.168.0.0/24For TCP scanning Windows
7. w – See Who is Logged in and User Activities
You will find this useful especially in monitoring different system users in your computer. This command is useful for displaying information about users and their current processes. To execute this command, use the following:
# w username: Display users and their activities
# w vivek: Displays vivek user activities
Linux server offers many benefits to its users from open source code modification to great access and control of some great system functionalities. This list of commands will be useful as you go about your daily activities using Linux systems.