Skip to main content
2 of 4
added 23 characters in body
Tim
  • 106.8k
  • 234
  • 651
  • 1.1k

Does `ps` provide the working directory of each process?

Is it correct that the output of jobs contains the working directory when initiating the command of each job

$ jobs -l | grep JDBC
[15]  20422 Running   PDFXCview all.pdf &  (wd: ~/mydata/dirlinks/cs/SQL/API/JDBC/general/official/tutorials)
[20]  20542 Running   PDFXCview all.pdf &  (wd: ~/mydata/dirlinks/cs/SQL/API/JDBC/general/wikipedia)

Similarly, in ps, is it possible to get the working directory of each process ?

In pgrep, is it possible to search in the pathname (string) of the working directory of each process, like pgrep ... <pattern_in_working_dir_pathname>?

Thanks.

Tim
  • 106.8k
  • 234
  • 651
  • 1.1k