This question is related to a question I posted on rogue firefox procesess. It relates to firefox processes following image uploads that I have been having for a while.
I am trying to get to the second field of the ps
command with the following set of pipes, so that I can kill the processes from the command line quickly:
ps aux| grep fire|cut -f 2
However this produces the wrong output as it shows the whole line of ps.
I know that the default delimiter for cut is tab
I have also tried:
ps aux| grep fire|cut -f 2 -d \t
From this question on stackoverflow I know that
ps axu | grep '[f]irefox' | awk '{print $2}'
gives me the output I want.
I want to understand why my two versions of cut are not working, and can it be made to work piping ps to grep and then to cut and getting to the second column (ie. the process IDs).
Best Answer
ps
does not use Tabs to separate column (runps aux > foo; vi foo
to verify). As an alternative you cancut
on character level by runningOr you can also just run
(or
pgrep fire
to see which processes would match)