Skip to content

My Command Line

Commands made simple

Author Archives: admin

Disable SELINUX from shell script

sed -i 's/^SELINUX\s+=+\senforcing/SELINUX=disabled/g' /etc/selinux/config

Posted byadminDecember 19, 2019Posted inUncategorizedLeave a comment on Disable SELINUX from shell script

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"}'

Posted byadminMay 12, 2019Posted inUncategorizedLeave a comment on To retrieve the total GETs and B/w per minute from haproxy log

Replacing new line character

cat <file> | perl -pe 's/\n/;/g'

Posted byadminJune 30, 2017Posted inUncategorizedLeave a comment on Replacing new line character

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

Posted byadminJanuary 5, 2017January 5, 2017Posted inUncategorizedLeave a comment on Get Total Used Bandwidth as per Status from Squid Log

To recover deleted files in Linux

grep -i -a -B100 -A100 'SOME TEXT IN THE DELETED FILE' /dev/sda1

Posted byadminDecember 30, 2016January 5, 2017Posted inUncategorizedLeave a comment on To recover deleted files in Linux

To replace newline character using sed in Linux

cat test.txt | sed ':a;N;$!ba;s/\n/,/g'

Posted byadminMarch 16, 2016Posted inUncategorizedLeave a comment on To replace newline character using sed in Linux

To print squid log records between two dates

awk -F. '$1>"1384535734" && $1<"1384535795"' /var/log/squid/access.log

Posted byadminNovember 15, 2013Posted inUncategorizedLeave a comment on To print squid log records between two dates

Search for multiple keywords using egrep

cat /etc/passwd | egrep 'apache|root|squid'

Posted byadminNovember 15, 2013Posted inUncategorizedLeave a comment on Search for multiple keywords using egrep

Show HTTP Header using tcpdump

tcpdump -s 1024 -l -n -A host 192.168.1.1

Posted byadminSeptember 30, 2013Posted inUncategorizedLeave a comment on Show HTTP Header using tcpdump

Create an empty GIT repository

git init –bare MyNewRepo.git

Posted byadminAugust 1, 2013Posted inUncategorizedLeave a comment on Create an empty GIT repository

Posts navigation

1 2 3 Older posts

Recent Posts

  • Disable SELINUX from shell script
  • To retrieve the total GETs and B/w per minute from haproxy log
  • Replacing new line character
  • Get Total Used Bandwidth as per Status from Squid Log
  • To recover deleted files in Linux

Recent Comments

  • Makito39Yt41 on Determine block size of a disk

Archives

  • December 2019
  • May 2019
  • June 2017
  • January 2017
  • December 2016
  • March 2016
  • November 2013
  • September 2013
  • August 2013
  • November 2012
  • September 2012
  • August 2012
  • August 2011
  • July 2011

Categories

  • Linux
  • Uncategorized

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org
My Command Line, Proudly powered by WordPress.