How many times have times have you used a command on the shell and it ends up spewing a whole load of information which you would never be looking at? I know a lot of commands do this. I will use the ps command for the sake of this example.
Whenever you use the ps command with additional options like au or, aux- sometimes it results in excessive information. Excessive information at that point in time.
# ps aux
USERÂ Â Â Â Â Â PID %CPU %MEMÂ Â Â VSZÂ Â RSS TTYÂ Â Â Â Â STAT STARTÂ Â TIME COMMAND
root        1 0.0 0.1  2844 1688 ?       Ss  22:46  0:01 /sbin/init
root        2 0.0 0.0     0    0 ?       S<  22:46  0:00 [kthreadd]
root        3 0.0 0.0     0    0 ?       S<  22:46  0:00 [migration/0]
root        4 0.0 0.0     0    0 ?       S<  22:46  0:00 [ksoftirqd/0]
root        5 0.0 0.0     0    0 ?       S<  22:46  0:00 [watchdog/0]
root        6 0.0 0.0     0    0 ?       S<  22:46  0:00 [migration/1]
root        7 0.0 0.0     0    0 ?       S<  22:46  0:00 [ksoftirqd/1]
root        8 0.0 0.0     0    0 ?       S<  22:46  0:00 [watchdog/1]
root        9 0.0 0.0     0    0 ?       S<  22:46  0:00 [events/0]
root       10 0.0 0.0     0    0 ?       S<  22:46  0:00 [events/1]
root       11 0.0 0.0     0    0 ?       S<  22:46  0:00 [khelper]
root       46 0.0 0.0     0    0 ?       S<  22:46  0:00 [kblockd/0]
root       47 0.0 0.0     0    0 ?       S<  22:46  0:00 [kblockd/1]
root       50 0.0 0.0     0    0 ?       S<  22:46  0:00 [kacpid]
root       51 0.0 0.0     0    0 ?       S<  22:46  0:00 [kacpi_notify]
Let us assume that we are interested in the USER, PID and the COMMAND fields of the output. Certainly, one way of dealing with it probably to provide a complex set of options to the ps command, which I’m not sure will work. Or, another way to do this is to display only columns of information from an output stream is using the cut command. The following line of code should help you list desired columns from the output list.
# ps aux | tr -s ' ' | cut -d' ' -f1,2,11
USER PID COMMAND
root 4725 /sbin/getty
root 4726 /sbin/getty
root 4730 /sbin/getty
root 4731 /sbin/getty
root 4732 /sbin/getty
root 5601 /usr/bin/X
..