I know it is possible with
ps -ef but I want to get it with the command:
How to do it on
ps aux is the berkley standard of ps.
ps [ a ] [ c ] [ e ] [ ew ] [ eww ] [ ewww ] [ g ] [ n ] [ w ] [ x ] [ l | s | u | v ] [ t tty ] [ X ] [ ProcessNumber ] a = Displays information about all processes with terminals (ordinarily only the own processes of the user are displayed). u = Displays user-oriented output. This includes the USER, PID, %CPU, %MEM, SZ, RSS, TTY, STAT, STIME, TIME, and COMMAND fields. x = Displays processes without a controlling terminal in addition to processes with a controlling terminal.
as you can see in the command flags, you can only use one of these: "[ l | s | u | v ]"
l = Displays a long listing having the F, S, UID, PID, PPID, C, PRI, NI, ADDR, SZ, PSS, WCHAN, TTY, TIME, and CMD fields. s = Displays the size (SSIZ) of the kernel stack of each process (for use by system maintainers) in the basic output format. This value is always 0 (zero) for a multi-threaded process. u = Displays user-oriented output. This includes the USER, PID, %CPU, %MEM, SZ, RSS, TTY, STAT, STIME, TIME, and COMMAND fields. v = Displays the PGIN, SIZE, RSS, LIM, TSIZ, TRS, %CPU, %MEM fields.
You can replace the 'u' with the 'l', although you won't have all the fields you will have in the 'u'.
you can also use the X/Open variant:
ps -ef -o "ruser pid ppid pcpu pmem vsz rssize tty stat start time command"
you can also change -e to -A if you want all processes. -e doesn't give you kernel processes, -A does.
-e Writes information to standard output about all processes, except kernel processes. -A Writes to standard output information about all processes.