Search code examples
bashshellawkps

How to get commands and arguments from ps command


I want to parse the output of a ps -ef command in order to display the command names and their arguments. I have two options that will display the command names:

ps -ef | awk '{print $8}'

or

ps -efo comm

However, neither of these will also display the arguments. Is there a way to do this without doing

ps -ef | awk '{print $8 $9 $10 ....}'

?


Solution

  • You can use ps like this:

    ps -eo command