1.列出文件清单并按时间排序,且显示的是k或者M,而非字节:
ll 相当于ls -l
-t 按时间排序
-h 文件的实际大小,带单位显示
hadoop@Master:/var/log$ ll -h -t
total 4.5M
-rw-r----- 1 syslog adm 89K 1月 11 14:22 auth.log
-rw-r----- 1 syslog adm 30K 1月 11 14:22 syslog
-rw-rw-r-- 1 root utmp 286K 1月 11 14:15 lastlog
-rw-rw-r-- 1 root utmp 32K 1月 11 14:15 wtmp
drwxrwxr-x 15 root syslog 4.0K 1月 11 07:53 ./
-rw-r----- 1 syslog adm 0 1月 11 07:53 kern.log
-rw-r----- 1 syslog adm 0 1月 11 07:53 mail.log
drwxr-x--- 2 root adm 4.0K 1月 11 07:53 apache2/
-rw-r----- 1 syslog adm 107K 1月 11 07:53 syslog.1
-rw-r----- 1 syslog adm 2.5M 1月 11 07:53 auth.log.1
drwxr-s--x 3 nagios adm 4.0K 1月 11 00:00 nagios3/
2.显示目录下所有文件夹和文件的大小:
ll或者ls显示文件的时候统一是4k
du -sh *
hadoop@Mcnode1:~/cloud/adam/down/1000genomes/GRCh38_reference_genome$ du -sh *
4.0K 20150713_location_of_centromeres_and_other_regions.txt
740K GRCh38_full_analysis_set_plus_decoy_hla.dict
8.0M GRCh38_full_analysis_set_plus_decoy_hla-extra.fa
3.1G GRCh38_full_analysis_set_plus_decoy_hla.fa
480K GRCh38_full_analysis_set_plus_decoy_hla.fa.alt
20K GRCh38_full_analysis_set_plus_decoy_hla.fa.amb
440K GRCh38_full_analysis_set_plus_decoy_hla.fa.ann
3.0G GRCh38_full_analysis_set_plus_decoy_hla.fa.bwt
152K GRCh38_full_analysis_set_plus_decoy_hla.fa.fai
3.显示指定多少层的子目录大小并排序
du -h --max-depth=1 | sort
hadoop@Mcnode1:~$ du --max-depth=2 -h | sort
116K ./.cache/compizconfig-1
116K ./.cache/fontconfig
1.1G ./cloud/spark-1.5.2
12K ./.config/compiz-1
12K ./.config/dconf
12K ./.config/ibus
4.显示所有盘的大小:
hadoop@Mcnode1:~$ sudo df -ah
[sudo] password for hadoop:
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 453G 371G 59G 87% /
proc 0 0 0 - /proc
sysfs 0 0 0 - /sys
none 4.0K 0 4.0K 0% /sys/fs/cgroup
none 0 0 0 - /sys/fs/fuse/connections
none 0 0 0 - /sys/kernel/debug
none 0 0 0 - /sys/kernel/security
udev 3.0G 4.0K 3.0G 1% /dev
devpts 0 0 0 - /dev/pts
tmpfs 597M 1.3M 595M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 3.0G 144K 3.0G 1% /run/shm
none 100M 40K 100M 1% /run/user
none 0 0 0 - /sys/fs/pstore
systemd 0 0 0 - /sys/fs/cgroup/systemd
gvfsd-fuse 0.0K 0.0K 0.0K - /run/user/112/gvfs
5.sar监视系统的运行状态,含CPU、memory、tcp等
安装atsar
sar -l 1 100
sar -u 1 100
sar -r 1 100