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
# Support multiple connections | |
ncat -e /bin/cat -k -l 8888 | |
nc -l -p 8888 -c 'xargs -n1 echo' | |
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
PID=$1 | |
INTERVAL=$2 | |
# Usage: ./top-pid.sh 12345 5 | tee report.log | |
while true; do | |
top -n 1 -b -pid $PID | tail -2 # Use `-l 1` for `-b` (batchmode) on macos | |
echo -n "\n" | |
sleep $INTERVAL | |
done |
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: ./top.sh 5 | tee report.log | |
INTERVAL=$1 | |
while true; do | |
top -b -n 1 | head -n 6 # Use `-l 1` for `-b` (batchmode) on macos | |
sleep $INTERVAL | |
done |