Saturday, 12 September 2015

How to check your NIC (network interface card) mode

Occassionally you'll want to verify that your gigabit network is actually running in gigabit mode.  Or, to futureproof this little post, maybe we're talking about kajigabits.

Anyway, normally there are little mode LEDs on your network hardware that indicate what speed it's operating at.  However, if you aren't in a position to physically see these little lights on the back of your network card or router, or you are but you're too lazy to get off your cushy chair and go look, here are a couple of quick and totally unintuitive ways of examining things using nothing but your trusty shell.

Use mii-tool (as root):
$ mii-tool -v eth0
Look at the 'negotiated' value.  It'll indicate what speed the interface is using.  'FD' means 'Full Duplex'.  'HD' means 'Half Duplex'.  For example, '100baseTx-FD' means 100mbit Full Duplex.

Use tcpdump (as root):
$ tcpdump -v -i eth0 -c 1
Look at what it says for 'link-type', although I'm not convinced this is an accurate method for speed reporting.  But tcpdump is awesome for other stuff, and maybe I just don't know how to interpret what it's saying.

Use dmesg:
$ dmesg | grep eth0
Look for a line similar to one of the following:
eth0: link up, 100Mbps, full-duplex
e1000e: eth0 NIC Link is Up 100 Mbps Full Duplex
It may be that your dmesg buffer doesn't go back far enough to include that.  If so, try one of the other methods.  Or I guess you could cycle the interface down/up, and then peak at dmesg again.

Use ethtool:
$ ethtool eth0
Look for the 'Speed:' value.  Lots of other good info is listed as well.  This technique  is the one that produces the most self-explanatory output, but it probably also the least likely to already be available on your system.


Sunday, 6 September 2015

Sunday One Liner

Today's one liner is to display the watch. Thanks to AltoidNerd.

In this one liner, we have used the following programs:

watch: The watch will execute the program periodically and display the result on complete screen.

figlet: the figlet provides different style and size of font

 TOIlet - display large colourful characters (heard this command today itself) :))
 watch -tcpn.5 'figlet -f big -W "$(echo "coding\n-\nscripting")" |  toilet -f term --metal'

Tuesday, 1 September 2015

Secure your passwords by storing them in Keepass

KeePass is a wonderful for linux environment, as we have 1Password by Agile bits for Mac, Windows, Android, and as browser addon. Unfortunately, it is not available for the linux platform. Here comes KeePass as a solution for linux users. To use the accounts in firefox, you have to install keefox, and export the password file. KeePass will you give an amazing performance and experience on linux platform.

Most of it,

KeePass is really free, and more than that: it is open source (OSI certified). You can have a look at its full source and check whether the encryption algorithms are implemented correctly.

You can install KeePass directly on windows, by downloading it from their website.

The version available for ubuntu is older, so you need to add a new repo for the latest version.
Here is the process:

sudo apt-add-repository ppa:jtaylor/keepass
sudo apt-get update
sudo apt-get install keepass2 
By adding above repository you can install the latest version of keepass2.

That's all folks for tonight. :)