18

Eclipsed launched a process for me, and I'd like to see the full command line used.

I tried "ps auxwww", but it seems to truncate the path to 4096 characters, is there any way to get PS to stop truncating the path, or to use another tool to find the full path?

4
  • Hmm, maybe the answer is to recompile the kernel? wtf. stackoverflow.com/questions/199130/… Mar 1, 2012 at 19:11
  • For my case, which is a java app, you can use jconsole to get the full classpath it looks like Mar 1, 2012 at 19:13
  • Is it possible to redirect it to a file and get the entire command line?
    – James
    Mar 1, 2012 at 23:21
  • 1
    I don't think so, it looks like /proc/{PID}/cmdline is truncated at 4096 characters, a hard limit set in the kernel Mar 2, 2012 at 2:16

3 Answers 3

28
cat /proc/{PID}/cmdline

Where {PID} is the process ID of the process in question.

2
  • 1
    /proc/*/cmdline doesn't contain a trailing newline, so echo $(< /proc/7851/cmdline ) gives more legible output. Mar 1, 2012 at 20:51
  • 4
    Arg. just read the stack overflow link that Alex Black posted... looks like proc/.../cmdline has the same 4096 character limit. Mar 1, 2012 at 21:22
4

The example is about a java process, here's a tool that can show some additional process details: jps. Just try, you probably have it - it's part of JDK

It's similar to a basic ps command - but underestands some java-speciffics. The main use is to identify running java processes, which then are inspected with other java analysis tools, like jstack.

$ jps -ml  
31302 com.intellij.rt.execution.application.AppMain com.example.Foo some.properties
26590 com.intellij.idea.Main nosplash
31597 sun.tools.jps.Jps -ml

An extract from the man page regarding the options:

jps - Java Virtual Machine Process Status Tool

jps [ options ] [ hostid ]

[...]

-q  Suppress  the  output of the class name, JAR file name, and argu‐
    ments passed to the main method, producing only a list  of  local
    VM identifiers.

-m  Output the arguments passed to the main method. The output may be
    null for embedded JVMs.

-l  Output the full package name for the application's main class  or
    the full path name to the application's JAR file.

-v  Output the arguments passed to the JVM.

-V  Output  the  arguments  passed  to the JVM through the flags file
    (the   .hotspotrc   file   or   the   file   specified   by   the
    -XX:Flags=<filename> argument).

-Joption
    Pass  option  to  the  java  launcher called by jps. For example,
    -J-Xms48m sets the startup memory to 48 megabytes. It is a common
    convention  for -J to pass options to the underlying VM executing
    applications written in Java.

[...]
2

pipe it into 'less' you should have no problems scrolling left and right :)

3
  • 2
    piping it into less doesn't solve the truncation issue. Mar 2, 2012 at 2:16
  • huh, that worked for me. anyway, it looks like using proc (suggested above) looks like a great solution :)
    – ejes
    Mar 2, 2012 at 14:37
  • The problem I hit was that proc is truncated to 4096 characters, did you find a way to get past that limit? Mar 2, 2012 at 17:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .