Last active
October 7, 2015 10:08
-
-
Save lakemove/3148952 to your computer and use it in GitHub Desktop.
useful shell commands
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
# tcpdump ldap traffic to a file, then can be analyzed by wireshark | |
sudo tcpdump -vv -w /tmp/ldapdump -i lo port 389 | |
#sniff http traffic | |
sudo ngrep -q -d eth0 -W byline host example.com and port 8180 | |
#Search recursively to find a word or phrase in certain file types, such as C code | |
find . -name "*.[ch]" -exec grep -i -H "search pharse" {} \; | column -t -s ":" | |
#search empty folder | |
find . -empty -type d | |
du | grep "^0\\s" | |
find . -not -empty -type d | |
#bind privileged port (<1024) | |
sudo apt-get install libcap2-bin #ubuntu server version needs it | |
#node listen on lower port ( < 1024 ) , see ref : | |
sudo setcap 'cap_net_bind_service=+ep' `which node` | |
#http://stackoverflow.com/questions/413807/is-there-a-way-for-non-root-processes-to-bind-to-privileged-ports-1024-on-l | |
#monitor io | |
sudo iotop | |
#monitor CPU | |
sudo top | |
#indent selected lines with 2 spaces in VI | |
:set shiftwidth=2 | |
<v> , select , <>> | |
#kill process tree (NEGATIVE process number): | |
kill -TERM -1999 | |
#default ssh remote user other than current user, http://stackoverflow.com/a/10722567/448081 | |
echo "Host xx.com\nUser xjai" > ~/.ssh/config | |
# download all videos in course 'Machine Learing' | |
curl https://class.coursera.org/ml-003/lecture/index | grep mp4 | sort | uniq | awk -F\" '{print $4}' | xargs curl -J -L --remote-name | |
# -L means follow redirects , --socks5 uses socks5 proxy , --remote-name save file using remote file name from header 'Deposition' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment