uname -r
Which is strange considering how often I use it.
I Always Forget…
I can’t seem to remember this:
sudo apt-get install build-essential linux-headers-
Enable Non-Root Network Traffic Capture in Wireshark in Linux
Install wireshark as normal then run:
sudo setcap ‘CAP_NET_RAW+eip CAP_NET_ADMIN+eip’ /usr/bin/dumpcap Then run wireshark and check that you can see your local interfaces. This has been tested in Ubuntu 11.04
Converting Audio for Use as Mitel Hold Music
The music file has to be A-law or U-law or G.711 at 8 khz, 8 Bits, Mono. To do this you can either use sox or ffmpeg. To use sox:
sox -V input_file.wav -A -c 1 -r 8k -1 output.wav``` Update: Seems some of these options are depreciated, if you run sox with the previous options you get: sox WARN sox: Option -A' is deprecated, use -e a-law' instead. sox WARN sox: Option -1' is deprecated, use -b 8' instead.
Exif from a Terminal
It is sometimes useful to see exif information in image files. If you want to examine exif information for an image then exiftool by Phil Harvey is excellent at doing this from the commandline. If you want to quickly examine exif from the internet then I have put together a small shell script which you can pass a url i.e.
get_exif_info http://path/to/image.jpg That will pass the file direct to exiftool without saving it.
Change the Timezone in Ubuntu Server
The simplest way to do this is:
dpkg-reconfigure tzdata Then follow the onscreen prompts
Finding Your External IP from Linux/BSD
If you have curl installed:
echo External IP:
curl -s http://checkip.dyndns.org/ | awk '{print $6}' | cut -f 1 -d <
This comes in real handy if you move sites and have more than one route out. It also works rather well from OSX Geektool.
Ubuntu Wireless with BCM4322
I have been having issues with the BCM4322 wireless card on my macbook pro under ubuntu. As it turns out after some digging the BCM4322 driver only supports the ‘Rest of World’ locale which does not include wireless channels 12 & 13. You can test this by trying:
sudo iwlist eth2 channel Which on the macbook pro returns: eth2 20 channels in total; available frequencies : Channel 01 : 2.412 GHz Channel 02 : 2.
Issues with Ubuntu Apache Vhost File
In Ubuntu server after an upgrade to apache, the process can copy your 000-default file and leave it with the name 000-default.save. This can cause issues with your vhost config and lead to unpredictable results. If you do have strange vhost issues, check in /etc/apache/sites-enabled and make sure that there is no duplication and all the files there are required. In my case it was causing the error:
[warn] NameVirtualHost *:80 has no VirtualHosts
Convert a MAC Address with Hyphen to Colons
If you have a MAC delimited with hyphens:
xx-xx-xx-xx-xx-xx You can convert it to use colons using sed:
echo xx-xx-xx-xx-xx-xx | sed ’s/-/:/g' Which will output as:
xx:xx:xx:xx:xx:xx Anything can be replaced:
echo xx-xx-xx-xx-xx-xx | sed ’s/-/%/g' Would output:
xx%xx%xx%xx%xx%xx
Changing the postfix banner
Make sure that when you send mail from web hosts you have a reverse lookup name that matches your postfix banner. Otherwise you can sometimes get marked as spam by some providers. Use the following to set the postfix name:
postconf -e myhostname=servername Where ‘servername’ is the name of your PTR record. Remember to restart postfix once you have made this change. You can check this with netcat or telnet: