• 按列 sort 排序 Linux 如何查看当前占用CPU或内存最多的K个进程


    用法:sort [选项]... [文件]...
    Write sorted concatenation of all FILE(s) to standard output.

    长选项必须用的参数在使用短选项时也是必须的。
    顺序选项:

    -b, --ignore-leading-blanks ignore leading blanks
    -d, --dictionary-order consider only blanks and alphanumeric characters
    -f, --ignore-case fold lower case to upper case characters
    -g, --general-numeric-sort compare according to general numerical value
    -i, --ignore-nonprinting consider only printable characters
    -M, --month-sort compare (unknown) < `JAN' < ... < `DEC'
    -n, --numeric-sort compare according to string numerical value
    -r, --reverse reverse the result of comparisons

    Other options:

    -c, --check check whether input is sorted; do not sort
    -k, --key=POS1[,POS2] start a key at POS1, end it at POS2 (origin 1)
    -m, --merge merge already sorted files; do not sort
    -o, --output=FILE write result to FILE instead of standard output
    -s, --stable stabilize sort by disabling last-resort comparison
    -S, --buffer-size=SIZE use SIZE for main memory buffer
    -t, --field-separator=SEP use SEP instead of non-blank to blank transition
    -T, --temporary-directory=DIR use DIR for temporaries, not $TMPDIR or /tmp;
    multiple options specify multiple directories
    -u, --unique with -c, check for strict ordering;
    without -c, output only the first of an equal run
    -z, --zero-terminated end lines with 0 byte, not newline
    --help 显示此帮助信息并退出
    --version 输出版本信息并退出

    ps aux|sort -k3nr|grep "^resin" |head -2

    sort -t  选项可以手工指定分隔符号

    --------------------------------------------

    [test@linux]$ cat aa
    3 5
    1 1
    3 2
    [test@linux]$ cat aa|sort -k2      2指第2列
    1 1
    3 2
    3 5
    [test@linux]$ cat aa|sort -k2r     r 倒序 reverse
    3 5
    3 2
    1 1
    [test@linux]$ cat aa|sort -k1r     1指第一列
    3 5
    3 2
    1 1
    [test@linux]$ cat aa|sort -k1
    1 1
    3 2
    3 5

    https://zhidao.baidu.com/question/371525749314218684.html

  • 相关阅读:
    网页常用的小工具--返回顶部
    关于javascript在作用域中的变量定义你所不知道的一些东西
    javascript中的function
    javascript判断非空
    jq实现多banner效果图
    JavaScript对下一个元旦倒计时,经常用于网店限时销售
    oracle 查看锁表情况并处理锁表
    ORACLE中的FTP例子代码
    Oracle包被锁定的原因分析及解决方案
    DOS和批处理基本命令
  • 原文地址:https://www.cnblogs.com/nulisaonian/p/6078493.html
Copyright © 2020-2023  润新知