Linux快捷命令

  1. 将输出内容做成表格

    mount | column –t
    
  2. 按内存资源的使用量对进程进行排序

    ps aux | sort -rnk 4
    
  3. 按CPU资源的使用量对进程进行排序

    ps aux | sort -nk 3
    
  4. 看操作系统的位数

    getconf LONG_BIT
    
  5. 查看物理CPU个数

    cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l
    
  6. 查看每个物理CPU中core的个数(即核数)

    cat /proc/cpuinfo| grep "cpu cores"| uniq
    总核数 = 物理CPU个数 X 每颗物理CPU的核数 
    
  7. 查看逻辑CPU的个数

    cat /proc/cpuinfo| grep "processor"| wc -l
    总逻辑CPU数 = 物理CPU个数 X 每颗物理CPU的核数 X 超线程数
    
  8. 创建指定大小的文件

    dd if=/dev/zero of=out.txt bs=1M count=10             //生成10M的out.txt
    
  9. 对命令会话进行记录

    script  回车  开始记录
    exit     回车  终止记录,会把记录保存到typescript这个文件中
    
  10. tr 的使用

替换内容:

    cat geeks.txt | tr ‘:[space]:’ ‘    ’ > out.txt

转换大小写:

    cat myfile | tr a-z A-Z> output.txt      //小写转大写 

猜你喜欢

转载自blog.csdn.net/ha_123_qq/article/details/81234181