I want to use grep to only see a certain column from the output of a Linux command. When I use this command, I get the following output:
$ ps ax | grep sshd | grep 'priv' | sort -k 3
4886 ? Ss 0:00 sshd: vpnuser002 [priv]
10637 ? Ss 0:00 sshd: vpnuser003 [priv]
10651 ? Ss 0:00 sshd: vpnuser003 [priv]
11594 ? Ss 0:00 sshd: vpnuser003 [priv]
11669 ? Ss 0:00 sshd: vpnuser003 [priv]
11817 ? Ss 0:00 sshd: vpnuser003 [priv]
9680 ? Ss 0:00 sshd: vpnuser003 [priv]
4034 ? Ss 0:00 sshd: vpnuser006 [priv]
What must I change in my command to only see the last column? Like this:
sshd: vpnuser002 [priv]
sshd: vpnuser003 [priv]
sshd: vpnuser003 [priv]
sshd: vpnuser003 [priv]
sshd: vpnuser003 [priv]
sshd: vpnuser003 [priv]
sshd: vpnuser003 [priv]
sshd: vpnuser006 [priv]
I am using Ubuntu Linux.
grep
?cut
is better suited for the task I think.