20 lines
519 B
Bash
Executable file
20 lines
519 B
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# Script Name: running
|
|
# Description: Better process search with PID highlighting
|
|
# Source: https://evanhahn.com/scripts-i-wrote-that-i-use-all-the-time/
|
|
# Usage: running
|
|
# running firefox
|
|
# running python
|
|
|
|
process_list="$(ps -eo 'pid command')"
|
|
|
|
if [[ $# != 0 ]]; then
|
|
process_list="$(echo "$process_list" | grep -Fiw "$@")"
|
|
fi
|
|
|
|
echo "$process_list" |
|
|
grep -Fv "${BASH_SOURCE[0]}" |
|
|
grep -Fv grep |
|
|
GREP_COLORS='mt=00;35' grep -E --colour=auto '^\s*[[:digit:]]+'
|