Linux Command Tool
w(who),nomn,ncdu,iftop,findmnt,htop,ccze,glances
For the original picture, please see the original Mipu blog: Linux Command Tool
1,w (who)
Yes, you're right. It's the w command. It's used in a similar way to who.
Using this command, we can see who the user is currently logged in to the system and what commands have been executed.
[root@mimvp-hz ~]# w 06:28:20 up 239 days, 19:19, 2 users, load average: 0.41, 0.43, 1.18 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT root pts/1 106.39.150.123 Thu07 0.00s 0.02s 0.00s w root pts/0 106.39.150.123 06:12 1:48 0.02s 0.02s -bash [root@mimvp-hz ~]# who root pts/1 2018-08-09 07:57 (106.39.150.123) root pts/0 2018-08-12 06:12 (106.39.150.123)
2,nomn
nomn can view CPU, kernel status, memory, network, disk.
Before using this instruction, you need to install it with the yum install nmon-y instruction.
After installation, the instruction can be opened by executing nomn.
According to the help, input c to view CPU, input m to view memory, input n to view network, as follows
3,ncdu
Like nomn, this instruction needs to be installed first with the yum install ncdu-y instruction.
The ncdu command can be used to view and analyze the disk space occupied by directories in Linux.
After installation, the ncdu command is executed and analyzed by default from the current directory. Executing the command will take up a lot of disk I/O.
When the analysis is completed, output similar to the following screenshot is generated:
We can sort by name n in the result interface, or by size s.
4,iftop
Manual installation required: Yum install iftop-y
iftop is a real-time traffic monitoring tool, which monitors TCP/IP connections and so on. The disadvantage is that it has no report function and must run as root.
If we run the iftop command directly, we will monitor the real-time traffic of the first network card by default, which is usually combined as iftop-i eth1-n-P.
The scale range shown above the interface is similar to that of a scale, which is used as a ruler for long strips showing flow patterns. (Quit the interface directly by q)
The middle <==> arrows indicate the direction of traffic.
TX: Send traffic
RX: Received traffic
TOTAL: Total Flow
cum: Total traffic from running iftop to the current time
Peak: peak traffic
rates: Indicate the average traffic of the past 2s 10s 40s, respectively
5,findmnt
Findmnt is a Linux built-in command line tool that doesn't need to be installed. It's mainly used to find the status of mounted filesystems.
Findmnt can view the devices that have been mounted in the current system, and mount or unmount operations can be performed if necessary.
After executing the findmnt command, you will see the following input:
# findmnt TARGET SOURCE FSTYPE OPTIONS / /dev/xvda1 ext4 rw,relatime,barrier=1,data=ordered ├─/proc proc proc rw,relatime │ ├─/proc/bus/usb /proc/bus/usb usbfs rw,relatime │ ├─/proc/sys/fs/binfmt_misc binfmt_misc rw,relatime │ ├─/proc/fs/nfsd nfsd nfsd rw,relatime │ └─/proc/xen xenfs rw,relatime ├─/sys sysfs sysfs rw,relatime ├─/dev devtmpfs devtmpfs rw,relatime,size=951760k,nr_inodes=237940,mode=755 │ ├─/dev/pts devpts devpts rw,relatime,gid=5,mode=620,ptmxmode=000 │ └─/dev/shm tmpfs tmpfs rw,relatime ├─/home/data /dev/xvdb ext3 rw,relatime,errors=continue,barrier=1,data=ordered ├─/var/lib/nfs/rpc_pipefs sunrpc rpc_pipefs rw,relatime └─/home/data2-bj 123.57.78.100:/home/data2/ nfs4 rw,relatime,vers=4,rsize=262144,wsize=262144,namlen=255,hard,
As you can see above, the root directory /, and / home/data, / home-data2-bj are all hard drives with data.
View the local hard disk through df-h
# df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 40G 21G 18G 54% / tmpfs 938M 0 938M 0% /dev/shm /dev/xvdb 9.9G 7.6G 1.9G 81% /home/data 123.57.78.100:/home/data2 20G 4.6G 15G 25% /home/data2-bj
Of course, the following parameters are available:
Findmnt-l: Output in tabular form
Findmnt-s: Output device mounted in fstab
Findmnt-t ext4: Output by file system type
# findmnt -t ext4 TARGET SOURCE FSTYPE OPTIONS / /dev/xvda1 ext4 rw,relatime,barrier=1,data=ordered
6,htop
The function of this instruction is similar to that of top, except that the interface is more elaborate and has a beautiful load interface, which needs to be installed with Yum install htop-y before running.
After installation, enter the htop command
Here are some shortcut keyboard settings for htop interactive output:
M sorts processes according to memory usage
P sorts processes according to CPU usage
Access help information
k Closes the current/tagging process
F2 sets htop
You can choose the display option here. / Search process.
7,ccze
This command can be used to highlight logs in different colors to help users view and analyze. Before using this command, we need to install it with Yum install ccze-y.
Then you can use the tailf/var/log/cron | ccze command to view the log at the end of the static log
If you want to highlight the color to view the real-time log, execute tail-f/var/log/*_log | ccze
Obviously, after using the ccze command, the error prompt in the log is highlighted in red, which is very conspicuous.
Using the ccze-l parameter, you can see the log types it supports.
# ccze -l Available plugins: Name | Type | Description ------------------------------------------------------------ apm | Partial | Coloriser for APM sub-logs. distcc | Full | Coloriser for distcc(1) logs. exim | Full | Coloriser for exim logs. fetchmail | Partial | Coloriser for fetchmail(1) sub-logs. ftpstats | Full | Coloriser for ftpstats (pure-ftpd) logs. httpd | Full | Coloriser for generic HTTPD access and error logs. icecast | Full | Coloriser for Icecast(8) logs. oops | Full | Coloriser for oops proxy logs. php | Full | Coloriser for PHP logs. postfix | Partial | Coloriser for postfix(1) sub-logs. procmail | Full | Coloriser for procmail(1) logs. proftpd | Full | Coloriser for proftpd access and auth logs. squid | Full | Coloriser for squid access, store and cache logs. sulog | Full | Coloriser for su(1) logs. super | Full | Coloriser for super(1) logs. syslog | Full | Generic syslog(8) log coloriser. ulogd | Partial | Coloriser for ulogd sub-logs. vsftpd | Full | Coloriser for vsftpd(8) logs. xferlog | Full | Generic xferlog coloriser.
8,glances
Glasnces is a reporting tool similar to nmon, which can report and count CPU, memory, network, disk, process.
Except for reporting statistics, Glance does not support any other features or functions.
Execute the installation: Yum install glances-y. Run the glances command directly to view the statistics report.
Reference Recommendations:
Detailed description of Linux top command
Detailed Explanation of Linux sar System Performance Analysis Command
Perf-Linux System Performance Tuning Tool
Linux free Command: The Difference between buffer and cache
The Linux expect command does not require password entry
18 Command Line Tools for Linux Performance Monitoring
Linux 15 commands, greatly improving work efficiency
Linux rc.local command does not execute
Linux curl command simulates POST/GET requests
The Meaning of Numbers in Brackets Behind Unix/Linux Commands
Linux tree command shows the installation and use of tree directory structure