Skip to content
Advertisement

Why am I not able to use -o or –format with ps command to control the output format?

I want to print certain columns only from ps output that is PID, PPID, command, memory utilization and CPU utilization columns.

when I run ps command I get the following output. enter image description here

Now I only want some columns from this output so I use -o flag as mentioned in this tutorial.

But I am getting this error.

enter image description here

I don’t understand where is the problem. I have also tried usin --help and it is not showing -o flag. So I am confused here.

enter image description here

I am using the windows operating system. And using Git Bash terminal to run all these Linux commands.

Advertisement

Answer

Git Bash is a terminal for Windows that emulates the Linux bash (shell) functionality. It is not 100% compatible to a “real” bash shell. As you’ve empirically seen, its ps executable doesn’t support all the flags you’re used to from Linux. The --help option will show you what flags are supported.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement