Htop - How to detect exact command running at background

Hello,
I am running a python file from terminal and I wish to see which code is running at background. When I use htop , I see just a few commands, unable to see entire command.

htop > report
nano report

Output:

^[[?1049h^[[1;34r^[(B^[[m^[[4l^[[?7h^[[?1h^[=^[[?25l^[[39;49m^[[?1000h^[[39;49m^[(B^[[m^[[H^[[2J^[[2d  ^[[36m1  ^[[39m^[(B^[[0;1m[^[$
^[[10d^[(B^[[0m^[[30m^[[42m  PID USER      PRI  NI  VIRT   RES   SHR S ^[[30m^[[46mCPU% ^[[30m^[[42mMEM%   TIME+  Command^[[K
^[[11d^[[30m^[[46m10735 root       20   0 1746M  358M  8044 S 633.  1.1  0:38.28 ffmpeg -y -v error -i /var/www/gr/ru$
^[[34dF1^[[30m^[[46mHelp  ^[[39;49m^[(B^[[mF2^[[30m^[[46mSetup ^[[39;49m^[(B^[[mF3^[[30m^[[46mSearch^[[39;49m^[(B^[[mF4^[[30m^[[46mFi$
^[[?1l^[>

Following parts of ffmpeg line is not shown by htop . Just showing "ffmpeg -y -v error -i /var/www/gr/ru"
Could you please let me know is there a way to see entire command?

Thanks
Boris

htop 

is interactive, so it creates characters to format output. Try the

ps

command. There is also the

pstree

command which may be what you want.

You should also be aware that when you issue any command it creates another process owned by the user issuing the command.

Hello Jim,
Thanks for the answer but ps and pstree are also not giving expected result.

Thanks
Boris

check out top command with -b

Did you try ps -ef ? This shows full details for all processes.

If your version of ps supports it, consider the -C cmdlist option. cmdlist is a comma-separated list of commands you wish to list with ps .

Andrew

You can customize your ps output with the -o option, for example

ps -e -o user,pid,vsz,rss,time,args

Either this or, alternatively:

ps -Ao <field-list>

where <field-list> is a comma-separated list of fields from the process table to be displayed. See the man page of ps for an exhaustive list of these fields and tailor the command to your needs.

I hope this helps.

bakunin