Last active
February 9, 2019 16:07
-
-
Save yiidtw/5dbebef95ec21915b5c5da2776e2426b to your computer and use it in GitHub Desktop.
useful snippet for shell script
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
# 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