Z
Z
zzmaster2018-11-09 21:16:59
linux
zzmaster, 2018-11-09 21:16:59

Linux top command in batch mode - how to show filenames?

The top command has a strange feature - in interactive mode, by pressing 'c' you can switch from processes to the contents of the command line. In general, it’s convenient, but the oddity is that in batch mode (I don’t know how in Russian, that is, in non-iterative mode), the -c flag simply inverts this display mode relative to the previous launch. And I would like to get a listing of command lines every time in batch mode, well, that is, this will be used by the script in the future. Is that possible? maybe some environment variables?
Added: the top command is of interest, not ps, since the latter shows the CPU consumption for the entire lifetime of the process, and not the current one.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Saboteur, 2018-11-10
@saboteur_kiev

Have you even tried reading man ps?
take the -o option and throw in the columns you need, for example
ps -o pid,%cpu,cputime,command

A
Alexander, 2018-11-09
@alexr64

ps auxf

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question