Add Line Numbers to “cat” Output

cat can be used to print the contents of a file in a Terminal, and it’s often useful to number each line of the output (including empty lines). Adding line numbers is as simple as adding the -n switch to the command: cat -n filename.txt Example Output, with -n switch: $ cat -n filename.txt 1 Line …

“Ping Hostname” Returning an IPv6 Address Instead of IPv4? (Windows)

On Windows based PCs and Servers, and where IPv6 is enabled on one of the network adapters, you may find that when you do a: ping name-of-host … you get an IPv6 address returned in the results.  But what if you want to test IPv4 connectivity?  You can add a -4 switch to the ping …

Using grep and Ignoring Case (Case Insensitive grep)

grep is a great way to find phrases, words, and characters in text.  One of the biggest stumbling blocks is case – is the word “Hello”, “hello”, “HELLO”, or even “HeLLo”?  All of these are different, and a “grep “Hello”” would only find lines containing the first “Hello” example. You can, however, exclude case from …

CIDR, Subnet Masks, and Usable IP Addresses Quick Reference Guide (Cheat Sheet)

A quick reference Subnet and CIDR guide. What’s a /28?  How many IPs do I get to use with a /26?  Well, see the table below! Usable IPs is the Total IPs minus the Network and Broadcast IPs.   CIDR Subnet Mask Total IPs Usable IPs /32 255.255.255.255 1 1 /31 255.255.255.254 2 0 /30 …

Using dig to Query a Specific DNS Server (Name Server) Directly (Linux, BSD, OSX)

There may be occasions when you wish to query a DNS server directly.  I often do it before changing DNS servers for a domain; I’ll setup the new records on the new DNS servers, and then query them directly to ensure they are returning the correct records. I recommend that anyone running DNS services for …

iPhone Data Usage: My Average Monthly Data Usage

Here in the UK, mobile operators include different amounts of data with the iPhone data tarrifs – some even offer unlimited (with fair use making them not unlimited at all).  Check the terms very closely, to know exactly how much data is included with your tariff on a monthly basis. I bought an iPhone 3GS …

When Did You Last Reboot Your Microsoft Windows 7 Machine? (Check Uptime)

Finding out when you last rebooted your Windows 7 machine can be completed using the “systeminfo” command. Open a Command Prompt by going to Start and opening “cmd”. You will then be presented with a command prompt window, where you need to type the systeminfo command below: C:\> systeminfo | find “System Boot Time” System …