zoukankan      html  css  js  c++  java
  • 按列 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

  • 相关阅读:
    02 _ 该如何选择消息队列
    封装、抽象、继承、多态分别可以解决哪些编程问题?
    04 _ 理论一:当谈论面向对象的时候,我们到底在谈论什么?
    03 _ 面向对象、设计原则、设计模式、编程规范、重构,这五者有何关系?
    接口使用
    结构体和方法
    通道的高级玩法
    通道的基本操作
    极客时间 mp3提取
    iOS多线程中的单例
  • 原文地址:https://www.cnblogs.com/nulisaonian/p/6078493.html
Copyright © 2011-2022 走看看