Wednesday 25 January 2012

SSH Piping between remote servers

SSH is without doubt my favourite command line tool. Today I needed to transfer a file between two hosts that I could SSH to, but could not SSH to each other. This is really simple with a bit of standard UNIX piping.

ssh hostA cat somescript.sh | ssh hostB "cat > somescript.sh"

Job done.

Thursday 19 January 2012

iproute2 cheat sheet

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

ip ro - show routing table
ip route add default via 192.168.0.254 - set the default gateway
ip addr add 192.168.0.5/24 brd + dev eth0 label eth0:0 - set an ip alias on eth0 and call it eth0:0

ip neigh - show the arp table



Monday 9 January 2012

Disable a yum repository while running yum update

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