Skip to content

Instantly share code, notes, and snippets.

@jamesrr39
Created June 1, 2015 18:31
Show Gist options
  • Save jamesrr39/ab80b0fd175daa6c6d51 to your computer and use it in GitHub Desktop.
Save jamesrr39/ab80b0fd175daa6c6d51 to your computer and use it in GitHub Desktop.
Get working directory of a searched for process
#!/bin/bash
# get the working directory of processes
search_term="$1"
pgrep "$search_term" | xargs -I {} readlink -f /proc/{}/cwd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment