What is the proper way to use the cut command on ps command output

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).


ps does not use Tabs to separate column (run ps aux > foo; vi foo to verify). As an alternative you can cut on character level by running

kill $(ps aux | grep fire | cut -c 17-23)

Or you can also just run

pkill fire

(or pgrep fire to see which processes would match)