dereenigne.org

reverse engineered

/proc/*/cmdline

A handy way to see the processes running on your system is to use the ps command:

user@host:~$ ps au
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
1000      1804  0.0  0.1 128492  5904 pts/1    Ss+  00:10   0:00 /bin/bash
root      1942  5.5  2.3 176152 95680 tty7     Ss+  Aug03  13:40 /usr/bin/Xorg :
root      2991  0.0  0.0   6120   600 tty1     Ss+  Aug03   0:00 /sbin/getty 384
root      2992  0.0  0.0   6120   600 tty2     Ss+  Aug03   0:00 /sbin/getty 384
root      2993  0.0  0.0   6120   596 tty3     Ss+  Aug03   0:00 /sbin/getty 384
root      2994  0.0  0.0   6120   600 tty4     Ss+  Aug03   0:00 /sbin/getty 384
root      2995  0.0  0.0   6120   596 tty5     Ss+  Aug03   0:00 /sbin/getty 384
root      2996  0.0  0.0   6120   600 tty6     Ss+  Aug03   0:00 /sbin/getty 384
1000      4285  0.0  0.1 128428  5580 pts/0    Ss+  Aug03   0:00 /bin/bash
1000      6160  0.0  0.1 128484  6004 pts/2    Ss   00:33   0:00 /bin/bash
1000      6802  0.0  0.0 121756  1208 pts/2    R+   00:38   0:00 ps au

As you can see, most of the COMMAND column has been truncated. This particularly a problem when logged in from mobile devices.

A work around is to use /proc. procfs is a virtual file system which contains information about current processes.

The full command is available under

/proc/PID/cmdline

where PID is the process identifier of that process.

user@host:~$ cat /proc/1942/cmdline 
/usr/bin/Xorg:0-br-verbose-audit0-novtswitch-auth/var/run/gdm3/auth-for-Debian-gdm-dxxxx/database-nolisten

comments powered by Disqus