Skip to content

Instantly share code, notes, and snippets.

@yiidtw
Last active February 9, 2019 16:07
Show Gist options
  • Save yiidtw/5dbebef95ec21915b5c5da2776e2426b to your computer and use it in GitHub Desktop.
Save yiidtw/5dbebef95ec21915b5c5da2776e2426b to your computer and use it in GitHub Desktop.
useful snippet for shell script
# sed
sed -i "s/old/new/g" /path/to/file
# find
find . -name "*.log" -type f | while read f; do echo $f; done
# fine and delete
find . -name "*.pyc" -exec rm -f {} \;
# compress a dir and scp
tar zcvf - src/ | ssh user@server "cd /path/dst; tar zxvf -"
# find the parent process by child's pid
ps -o ppid= -p ${CHILDS_PID}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment