I have below code snippet written by someone but I don't understand what sort -t' ' -rn +2 -3
does.
ps aux|tr -s ' '|cut -f1-3,11 -d' '|grep $USER|sort -t' ' -rn +2 -3|cut -f2 -d' '|head -5
Especially +2
and -3
options. I know -r
is for reverse and -n
is for numbers.
The command does a lot of unnecessary work. You can replace it by the following command using
pgrep
:Btw, in order to simply understand what
sort -t' ' -rn +2 -3
means, you should follow the comment from@1_CR
below your question.