Tip #300 Find and replace on specific files
Selective content replace on files. For example to replace '<?' with '<?php' in all PHP files:Read more »
Tip #295 Portscan in one line
$HOST=127.0.0.1;for((port=1;port<=65535;++port));do echo -en "$port ";if echo -en "open $HOST $port\nlogout\quit" | telnet 2>/dev/null | grep 'Connected to' > /dev/null;then echo -en "\n\nport $port/tcp is open\n\n";fi;done Read more »- TAGS:
Tip #290 Crawl a web page for links
lynx -dump http://www.spantz.org | grep -A999 "^References$" | tail -n +3 | awk '{print $2 }' Read more »Tip #286 Addition with dc.
Add one number per line from stdin until a 0 is found, then print the result. Read more »- TAGS:
Tip #282 Highlight Grepped Text
Grep file(s) and highlight the grep matches using less...Read more »
- TAGS:
- grep
Tip #275 Get an ordered list of subdirectory sizes
This piece of code lists the size of every file and subdirectory of the current directory, much like du -sch ./* except the output is sorted by size, with larger files and directories at the end of the list. Useful to find where all that space goes.Read more »
Tip #267 Remote network restart
I guess anyone who's administered several remote boxes has had the unfortunate problem of (when not thinking straight) taking down the network card on a machine you have no physical access to. The result being that the ssh session you used to connect dies. The typical mistake is to do something like (as root):Read more »
- TAGS:
alias aptitude at awk bash bc cal cat cd colrm comm cp csh curl cut date dd df dialog diff dirname dpkg du fc find fuser grep gs gzip history iconv kill ksh last less ln ls lsof lynx m4 md5sum mkdir mkfifo mkisofs mv mysql nc netstat openssl OSX perl ping popd ps pushd python read redirection rm scp screen sed sort ssh stat sudo svn tail tar tee test top tr uniq vim wc wget xargs