Subject: bug#17816: bug in cut, doesn't work normally with -f

From: Pádraig Brady <[email-masked]>
Date: Fri, 20 Jun 2014 13:40:32 +0100

tag 17816 notabug
close 17816
stop

On 06/20/2014 09:23 AM, Jim Michaels wrote:
> 1.run firefox (am using linux mint 17 in virtual machine vbox) version 28.0
> 
> 2.start xterm
> 3.ps -e | grep firefox | cut -f 2
> this should be the equivalent of ps -C firefox -o pid=
> actual:
>  2366 ?        00:02:53 firefox
> expected:
>  2366

cut defaults to tab field delimiters, which you would change with -d ' '
Note the _possible_ leading space are going to be problematic there so
you'd be better with something like:

  ps - e | awk '/firefox/{print $1}'

Though your already presented command is probably most efficient/accurate:

  ps -C firefox -o pid=

thanks,
Pádraig.