本文主要记录一些常用的命令,方便后面查阅
dmidecodedmidecode命令是同事告诉我的,确认当前机器是实体机还是虚拟机,之前看过很多办法,总是忘记,这一条真的是一个万金油,其他的用处还可以再发掘
# dmidecode -s system-product-name
VMware Virtual Platform
# dmidecode -t 1
# dmidecode 3.2
Getting SMBIOS data from sysfs.
SMBIOS 2.7 present.
Handle 0x0001, DMI type 1, 27 bytes
System Information
Manufacturer: VMware, Inc.
Product Name: VMware Virtual Platform
Version: None
Serial Number: VMware-56 4d 07 c6 7d b5 42 7b-6c cd 54 88 3a 49 a1 66
UUID: c6074d56-b57d-7b42-6ccd-54883a49a166
Wake-up Type: Power Switch
SKU Number: Not Specified
Family: Not Specified
top
对于多线程的程序,top命令可以查看每个线程的运行情况,查看9883的每一个线程,运行情况
# ps -ef | grep redis redis 9883 1 0 17:39 ? 00:00:23 redis-server 0.0.0.0:6379 redis 12305 1 0 21:26 ? 00:00:00 redis-server 0.0.0.0:6380 redis 12344 1 0 21:26 ? 00:00:00 redis-server 0.0.0.0:6381 root 12921 12817 0 21:32 pts/0 00:00:00 grep --color=auto redis # top -p 9883 -H top - 21:32:41 up 7:46, 4 users, load average: 0.00, 0.01, 0.05 Threads: 5 total, 0 running, 5 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.0 us, 0.3 sy, 0.0 ni, 99.7 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 1863012 total, 981796 free, 232296 used, 648920 buff/cache KiB Swap: 2097148 total, 2073596 free, 23552 used. 1452172 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 9883 redis 20 0 164984 7776 1640 S 0.0 0.4 0:22.34 redis-server 9884 redis 20 0 164984 7776 1640 S 0.0 0.4 0:00.00 bio_close_file 9885 redis 20 0 164984 7776 1640 S 0.0 0.4 0:00.00 bio_aof_fsync 9886 redis 20 0 164984 7776 1640 S 0.0 0.4 0:00.00 bio_lazy_free 9887 redis 20 0 164984 7776 1640 S 0.0 0.4 0:01.32 jemalloc_bg_thddu
du用的时候习惯使用du -sh,后面又发现了新的方式,可以统计总大小,最后的面的total就是所有目录的大小
# du -ch * 4.0K anaconda-ks.cfg 0 Desktop 0 documents 0 Downloads 4.0K initial-setup-ks.cfg 0 Music 0 Pictures 0 Public 0 Templates 0 Videos 8.0K total



