Skip to content

Instantly share code, notes, and snippets.

@selbyk
Created March 17, 2016 16:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save selbyk/7f33f0306f8c8ff09436 to your computer and use it in GitHub Desktop.
Save selbyk/7f33f0306f8c8ff09436 to your computer and use it in GitHub Desktop.
iterate through all running Linux processes and just print the process ID
#!/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