Top REQUEST methods
varnishtop -i ReqMethod
Top URLs that MISS the cache
varnishtop -i BereqURL
Top URLS that HIT the cache
varnishtop -i ReqURL
All URLs that HIT the cache in real time
varnishlog -g request -q ‘VCL_call eq HIT’ | grep reqURL
All URLs that MISS the cache in real time
varnishlog -g request -q ‘VCL_call eq MISS’ | grep reqURL
All URLs that MISS the cache in real time
varnishlog -i BereqURL
Look at an incoming client request of a specific URL
varnishlog -c -q “ReqUrl eq ‘/'”
Look at a a backend request of a specific URL
varnishlog -i -q “BereqURL eq ‘/'”
See requests for one specific Hostname
varnishlog -c -q “ReqHeader eq ‘Host: www.mydomain.com'”
See the age of the cache objects for a specific hostname
varnishlog -c -q “ReqHeader eq ‘Host: www.mydomain.com'” | grep Age
varnishlog -b -q “ObjStatus eq 404”
Cut out selected fields of each line of a file.
cut [-b] [-c] [-f] list [-n] [-d delim] [-s] [file]
||The list following -b specifies byte positions (for instance, -b1-72 would pass the first 72
bytes of each line). When -b and -n are used together, list is adjusted so that no multi-byte character is split. If -b is used, the input line should contain 1023 bytes or less.
||The list following -c specifies character positions (for instance, -c1-72 would pass the first 72 characters of each line).
||The list following -f is a list of fields assumed to be separated in the file by a delimiter character (see -d ); for instance, -f1,7 copies the first and seventh field only. Lines with no field delimiters will be passed through intact (useful for table subheadings), unless -s is specified. If -f is used, the input line should contain 1023 characters or less.
||A comma-separated or blank-character-separated list of integer field numbers (in increasing order), with optional – to indicate ranges (for instance, 1,4,7; 1-3,8; -5,10 (short for 1-5,10); or 3- (short for third through last field)).
||Do not split characters. When -b list and -n are used together, list is adjusted so that no multi-byte character is split.
||The character following -d is the field delimiter (-f option only). Default is tab. Space or other characters with special meaning to the shell must be quoted. The delimiter can be a multi-byte character.
||Suppresses lines with no delimiter characters in case of -f option. Unless specified, lines with no delimiters will be passed through untouched.
||A path name of an input file. If no file operands are specified, or if a file operand is -, the standard input will be used
Example: Use cut to get your ipv4 IP address:
ifconfig eth0 |grep 'inet addr' |cut -d ':' -f 1,2 | cut -c 21- | cut -c -14
This command is useful for search through log files. Where you want to match two keywords
Contents of the file test.txt
This egrep command only matches
egrep "\<linux\>.*\<windows\>" test.txt
Our gentoo web servers now support ipv6. I configured the ipv6 IP addresses and the ipv6 dns records last week. We are ready for the next gen internet or 10-15 years of dual stack ipv4 and ipv6.
This will remove your current user name display.
Edit the lightdm config file:
sudo gedit /etc/lightdm/lightdm.conf
And append this line to the end of the file:
Safe the file and either reboot your computer or restart lightdm
sudo /etc/init.d/lightdm restart
this will close any application you have running
To get the windows buttons back in Ubuntu 12.04 precise pangolin. You can use the following shell command:
gconftool -s /apps/metacity/general/button_layout -t string menu:minimize,maximize,close
You can also change the order of the buttons by moving their names around. Moving the : symbol will change the side of the buttons.
To get rid of the memtest86 option in the Ubuntu boot menu. Do the following:
sudo chmod -x /etc/grub.d/20_memtest86+
Thats it reboot to check it works.
I just came across this neat shell command to restart all courier services in one go:
find /etc/init.d/ | grep courier | while read line; do $line restart; done
You could replace the
grep courier with any other name you would like to use. This is one of those things I love about Linux 🙂
After installing a ubuntu 12.04 (precise) server on a host behind a firewall. I tried to update the apt repositories to install some software. And received the following error message:
W: GPG error: http://extras.ubuntu.com precise Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 16126D3A3E5C1192
So I tried to fetch the missing key with:
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 16126D3A3E5C1192
Which did not work because the firewall was blocking port 11371 which is needed to fetch the apt keys. What a pain there must be a way to fetch the keys via another port. Maybe port 80 which should be open in most cases. Then I came across this command which did the magic:
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 16126D3A3E5C1192
This command fetches the missing keys via port 80 which worked for me. If you need more than one key just add them to the –recv-keys line seperated by a space. Thats it.
To search a directory for files with the extension .conf and replace the IP address 184.108.40.206 with 220.127.116.11. Do the following:
find . -name '*.conf' | xargs perl -pi -e 's/18.104.22.168/22.214.171.124/g'
Thats it have fun.