Created
October 29, 2017 01:32
-
-
Save ajpen/8dee80bfb10a33521ec517f7d033b3d5 to your computer and use it in GitHub Desktop.
bash kit commands
This file contains hidden or 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
| # Kills a process by its name | |
| killname () { | |
| ps aux | grep -v grep | grep -m 1 "$1" | awk '{print $2}' | xargs kill 15 | |
| } | |
| # Kills the process listening to port number given | |
| killportno () { | |
| netstat -tupnl 2> /dev/null | grep "$1" | awk '{print $7}'| awk -F / '{print $1}' | xargs kill -9 | |
| } | |
| # Kill with printed stack trace | |
| killtrace () { | |
| ps aux | grep -v grep | grep -m 1 "$1" | awk '{print $2}' | xargs kill -3 | |
| } | |
| # sends process identified by name ($1) the signal passed ($2) | |
| signalname () { | |
| ps aux | grep -v grep | grep -m 1 "$1" | awk '{print $2}' | xargs kill "$2" | |
| } | |
| # Strace process identified by name ($1) and all forked PIDs of that process | |
| traceproc() { | |
| strace -f -t $(ps auxw -T | fgrep "$1" | awk '{print $3}' | awk '{print "-p " $0}') | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment