Created
March 17, 2016 16:34
-
-
Save selbyk/7f33f0306f8c8ff09436 to your computer and use it in GitHub Desktop.
iterate through all running Linux processes and just print the process ID
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: ./process_pids.sh | |
for proc in /proc/* | |
do | |
FILENAME=${proc##*/} | |
if [[ $FILENAME =~ ^-?[0-9]+ ]] | |
then | |
echo $FILENAME | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment