The ps command shows incomplete problems

Today, when using the ps command, the process ID of the specified name cannot be found. Careful search only shows that the command and parameter information of the process startup in the result of the ps command search is truncated

Problem instance

User wanng starts a process wanng_qytrunkcross, the startup parameter is the config.lua file, execute ps -u wanng to query the user's process, the results are as follows:

[wanng@localhost shell]# ps -u wanng
   PID TTY          TIME CMD
127271 ?        00:00:01 sshd
127272 pts/4    00:00:00 bash
127332 pts/4    00:17:19 wanng_qytrunkcros

It is found from the results that the display of the process name and startup parameters is truncated

solution

The following is the solution found through man ps. The following three methods can solve this problem

w Wide output. Use this option twice for unlimited width

-w Wide output. Use this option twice for unlimited width.

-f Do full-format listing. This option can be combined with many other UNIX-style options to add additional columns. It also causes the command arguments to be printed. When used with -L, the NLWP (number of threads) and LWP (thread ID) columns will be added. See the c option, the format keyword args, and the format keyword comm.

-F Extra full format. See the -f option, which -F implies.

  1. Add -ww option after ps, the command execution result is as follows
[wanng@localhost shell]# ps -u wanng -w w
   PID TTY      STAT   TIME COMMAND
127271 ?        S      0:01 sshd: wanng@pts/4
127272 pts/4    Ss+    0:00 -bash
127332 pts/4    Sl    17:20 ./wanng_qytrunkcross config.lua
  1. Add ww option after ps, the command execution result is as follows
[wanng@localhost shell]# ps -u wanng ww
   PID TTY      STAT   TIME COMMAND
127271 ?        S      0:01 sshd: wanng@pts/4
127272 pts/4    Ss+    0:00 -bash
127332 pts/4    Sl    17:20 ./wanng_qytrunkcross config.lua
  1. Add -f or -F option after ps, which means display in full format, the command execution result is as follows
[wanng@localhost shell]# ps -f -u wanng
UID         PID   PPID  C STIME TTY          TIME CMD
wanng      127271 127269  0 13:55 ?        00:00:01 sshd: wanng@pts/4
wanng      127272 127271  0 13:55 pts/4    00:00:00 -bash
wanng      127332      1  3 13:55 pts/4    00:18:30 ./wanng_qytrunkcross config.lua

Guess you like

Origin www.cnblogs.com/wanng/p/ps-command-truncation.html