将输出内容做成表格
mount | column –t
按内存资源的使用量对进程进行排序
ps aux | sort -rnk 4
按CPU资源的使用量对进程进行排序
ps aux | sort -nk 3
看操作系统的位数
getconf LONG_BIT
查看物理CPU个数
cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l
查看每个物理CPU中core的个数(即核数)
cat /proc/cpuinfo| grep "cpu cores"| uniq 总核数 = 物理CPU个数 X 每颗物理CPU的核数
查看逻辑CPU的个数
cat /proc/cpuinfo| grep "processor"| wc -l 总逻辑CPU数 = 物理CPU个数 X 每颗物理CPU的核数 X 超线程数
创建指定大小的文件
dd if=/dev/zero of=out.txt bs=1M count=10 //生成10M的out.txt
对命令会话进行记录
script 回车 开始记录 exit 回车 终止记录,会把记录保存到typescript这个文件中
- tr 的使用
替换内容:
cat geeks.txt | tr ‘:[space]:’ ‘ ’ > out.txt
转换大小写:
cat myfile | tr a-z A-Z> output.txt //小写转大写