2

To printing all running jar on the server, the command is below:

ps -aux|grep java

But I want to get the output like below so that I can know the absolute path of running jars in the system:

Running_jar Absolute_path    
test.jar  /var/www/html/test/
test2.jar /var/www/html/test2/

Can anyone help how I can achieve this output with any bash command?

  • Please provide input and expected output – Romeo Ninov Feb 25 '19 at 10:39
  • @RomeoNinov I have shared my expected output and that is: `Running Jar | Absolute path of jar test.jar /var/www/html/test/ test2.jar /var/www/html/test2/` I just need to know the bash script from which i got the expected output: i know a similar script ps -auxwwwe|grep java , by using this command I can know the absolute path of running jar, but couldn't get the output i want. – Amit Biswas Feb 25 '19 at 10:51

1 Answers1

2

pwdx is the command you'd need for that :

pwdx - report current working directory of a process

Syntax is : pwdx <pid_of_process>

nullPointer
  • 4,419
  • 1
  • 15
  • 27