Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Identify Linux command from TOP

  • 17-02-2017 5:13pm
    #1
    Registered Users, Registered Users 2 Posts: 8,749 ✭✭✭


    So, I'm running a TOP command and see a high hitting process (say 7z) and want to find the actual command that is running. Is it possible to find the 'full' command in use? So in the example of 7z could I get the actual running command including source and destination information?


Comments

  • Registered Users, Registered Users 2 Posts: 1,109 ✭✭✭Skrynesaver


    so say you have output like the following...
    Tasks: 206 total,   1 running, 204 sleeping,   1 stopped,   0 zombie
    Cpu(s): 13.4%us,  0.7%sy,  0.0%ni, 85.3%id,  0.1%wa,  0.0%hi,  0.5%si,  0.0%st
    Mem:  41183856k total, 40934684k used,   249172k free,   144760k buffers
    Swap: 33551744k total,      188k used, 33551556k free,  9165028k cached
    
      PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
    16203 busyb     20   0 31.7g  29g  11m S 100.0 74.3   8542:49 java
    16992 busyb     15   0 12896 1124  760 R  2.0  0.0   0:00.01 top
    ...
    

    and you want to know what the java app with the pid 16203 is doing, run the following:
    ps aux | grep 16203 
    

    and you'll get the full command line (this is also available in /proc/$PID/cmdline)


  • Registered Users, Registered Users 2 Posts: 1,109 ✭✭✭Skrynesaver


    OSI wrote: »
    Just look for the relevant PID in the output of ps? You can also press 'c' while in top to see the full command instead of the process name.

    True if you've a very wide screen (it doesn't wrap commands so you only get the heap settings on java servers )


  • Registered Users, Registered Users 2 Posts: 8,749 ✭✭✭degsie


    OSI wrote: »
    Just look for the relevant PID in the output of ps? You can also press 'c' while in top to see the full command instead of the process name.

    You were right of course :P, the answer was staring me in the face. The 'ps | grep xxxx' command with the pid gave me the information I was looking for. Thank you :D


  • Registered Users, Registered Users 2 Posts: 9,605 ✭✭✭gctest50




Advertisement