Top Nav

Archive | Linux

Make vi Work On Ubuntu

Posting this because I always forget and have to goggle for the answer. The default “vi” installed with Ubuntu has terminal emulation problems on both Ubuntu Desktop and through putty. The fix is simple … install “vim” …


Install jpegtran on CentOS 7

CentOS uses the libjpeg-turbo fork of the original libjpeg project. So to install jpegtran do this:



Get IP Address In A Script

Recently needed a good way to fetch the IP address of each interface within a script. Tried things like:


But this is fairly ugly. So I tried:

This gives a list of IP addresses but they are un-ordered so I can’t guarantee which address goes with which interface.  Here’s one using “ip addr”:

Still very messy.  Finally, found the “ifdata” command which is part of the “moreutils” package. First make sure “moreutils” is installed with:

Now you can query for a wide range of different information:

So here are some examples:

Overall this is much cleaner and more reliable then the earlier approaches.