A collection of various moderate to very complex one-liners I use occasionally. I have a collection of various Bash commands here:
find . -type f -print0 | wc -l --files0-from=- | sort -n
sed -i '5s/.*/ replacement_string /' file{1..4}.txt
sed -i -- 's/foo/bar/g' *
for i in `cat access.log | cut -d" " -f1 | sort -u`; do
whois -h http://whois.cymru.com $i | egrep -v "AS|whois" >> results.txt;
done
alias yolo='git commit -am "DEAL WITH IT" && git push -f origin master'
grep -nr yourString* .
seq -s $'\n' 1 100 > numbers.txt
lsmod | grep -io vboxguest | xargs modinfo | grep -iw version
curl -s -D - <url> -o /dev/null/
nmap -vv -O -Pn -sTUV -p - --host-timeout 5m -oA "filname_prefix" <ip_add>
# https://svn.nmap.org/nmap/docs/nmap.usage.txt
-v: Increase verbosity level (use -vv or more for greater effect)
-O: Enable OS detection
-Pn: Treat all hosts as online -- skip host discovery
-sT: TCP Connect()
-sU: UDP Scan
-sV: Probe open ports to determine service/version info
-p <port ranges>: Only scan specified ports
Ex: -p22; -p1-65535; -p U:53,111,137,T:21-25,80,139,8080,S:9
--host-timeout <time>: Give up on target after this long
-oA <basename>: Output in the three major formats at once
http://stackoverflow.com/a/14749369
du -a -h --max-depth=1 | sort -hr
scp <username>@<remote_ip>:/file/to/send /where/to/put