自己日常用到的命令稍微备份一下:
版本确认
CentOS / RedHat Enterprise
cat /etc/redhat-release
Ubuntu
cat /etc/lsb-release
Debian
cat /etc/debian_version
进程查询
ps -ef
进程内存查询:可以检测出那些进程占用内存多且时间长
top -u 用户名
硬盘使用率查询:
df -P
显示调整:df -P | grep -Ev 'Filesystem' | sed 's/ */,/g' | awk '{print "'$HOSTNAME',""'`date +"%Y/%m/%d"`'","'`date + "%H:%M:%S"`',"$0}'
目录文件数统计:
find $HOME -type f -print | awk -F'/' '{i=1;temp ="";while(i < NF){temp =temp$i"/";i++} print temp}' | sort | uniq -c | awk -F' ' '{if($1>0){cmd ="date "+%Y/%m/%d %H:%M:%S"";cmd | getline var1;cmd = "hostn ame"; cmd | getline var2;print var1","var2","$2","$1}}'
系统超大文件统计:
find $HOME -size +102400000c