iproute2 cheat sheet

Posted on Thu 19 January 2012 in misc • Tagged with iproute

Ok so apparently ifconfig is either deprecated or old fashioned and your supposed to use the 'ip' command instead. Turns out it's really nice and I prefer it to ifconfig,route,already.

Here's some examples:

ip addr - equivalent to ifconfig

ip addr show eth0 - same as above just show eth0 …


Continue reading

Disable a yum repository while running yum update

Posted on Mon 09 January 2012 in misc • Tagged with yum

I wanted to run all updates from the RHEL repositories, but not the rpmforge and WAN Disco ones. Easy.

sudo yum check-update --disablerepo=rpmforge --disablerepo=WANdisco-dev


Continue reading

Resize images on the command line

Posted on Sat 17 December 2011 in misc • Tagged with graphics

I've recently been buying allot of digital downloads and it seems a waste that the album art encoded into the track is often 1500x1500 and taking up valuable disk space.

A quick blast with Graphics Magick solves all

gm mogrify -scale 25% Artwork.jpg


Continue reading

Rsync happiness

Posted on Sat 10 December 2011 in misc • Tagged with rsync

I recently got around to setting up a backup of my data. I decided rather than using something like Drop Box (which I'm sure is great) I'd keep things simple and set up a new EBS volume on my EC2 box and rsync my data there.

Here was the initial …


Continue reading

SSD In Linux

Posted on Mon 19 September 2011 in misc • Tagged with SSD

In an effort to make my Dual Core 1.6 Centrino laptop perform abit better I thought I would splash out on a SSD. I picked this up for £75 http://www.ocztechnology.com/ocz-vertex-2-sata-ii-2-5-ssd.html By the way my laptop is only SATA 1.

A quick google of SSD …


Continue reading

Disable IPv6 in opensuse

Posted on Mon 19 September 2011 in misc • Tagged with ipv6

sysctl

net.ipv6.conf.all.disable_ipv6 = 1


Continue reading

Writing files as root in vim

Posted on Wed 10 August 2011 in misc • Tagged with vim

I do this at least once a day; open a file in vim, make changes, then get reminded that I didn't do it using sudo.

simple one-liner fixes this.

:w !sudo tee %

Thanks to http://www.cyberciti.biz/faq/vim-vi-text-editor-save-file-without-root-permission/ for that one.


Continue reading

using a remote machine as a proxy with SSH

Posted on Mon 13 December 2010 in misc • Tagged with ssh

This is such a useful feature of SSH that I wish I had know about before now.

When working remotely from an insecure location, or when only the remote location is trusted by another host, e.g for a firewall login or viewing intranet pages you only have access to …


Continue reading

diff files across servers

Posted on Tue 02 November 2010 in misc • Tagged with diff

Here's another really handy one liner for diff-ing files across servers using process substitution. This seems to work in zsh and bash.

diff /a/file/ <(ssh anotherserver 'cat /a/file/')


Continue reading

Finding the most recently modified files with find

Posted on Tue 19 October 2010 in misc • Tagged with find

I recently needed to check that no files had been modified since I last made an archive of a certain directory. Here's a good one for getting a list of files by last modified date, newest at the top.

find . -type f -printf "%TY-%Tm-%Td %TT %pn\\n" | sort …


Continue reading