sed -i 's/^SELINUX\s+=+\senforcing/SELINUX=disabled/g' /etc/selinux/config
To retrieve the total GETs and B/w per minute from haproxy log
cat /var/log/haproxy.log | awk '{print $3":"$12}' | awk -F: '{a[$1":"$2]+=$4} {b[$1":"$2]++} END {for (i in a) print i, a[i]/1024/1024, b[i] |"sort -u"}'
Replacing new line character
cat <file> | perl -pe 's/\n/;/g'
Get Total Used Bandwidth as per Status from Squid Log
awk '{a[$4] += $5} END{for (i in a) print i, a[i]}' /var/log/squid/access.log
To recover deleted files in Linux
grep -i -a -B100 -A100 'SOME TEXT IN THE DELETED FILE' /dev/sda1
To replace newline character using sed in Linux
cat test.txt | sed ':a;N;$!ba;s/\n/,/g'
To print squid log records between two dates
awk -F. '$1>"1384535734" && $1<"1384535795"' /var/log/squid/access.log
Search for multiple keywords using egrep
cat /etc/passwd | egrep 'apache|root|squid'
Show HTTP Header using tcpdump
tcpdump -s 1024 -l -n -A host 192.168.1.1
Create an empty GIT repository
git init –bare MyNewRepo.git