Often you will grep for certain strings in a text file, but need to find which line it’s on within that file. On a standard grep output, you will see the output, but have no idea which line the string has been found on. grep has an option, -n, which resolves that. As an example, …
Tag Archives: tips
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 …
Continue reading ““Ping Hostname” Returning an IPv6 Address Instead of IPv4? (Windows)”
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 …
Continue reading “Using grep and Ignoring Case (Case Insensitive grep)”
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 …
Continue reading “Using dig to Query a Specific DNS Server (Name Server) Directly (Linux, BSD, OSX)”
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 …
Continue reading “When Did You Last Reboot Your Microsoft Windows 7 Machine? (Check Uptime)”
Installing the Telnet Client on Windows 2008 using a Command Prompt
Like Windows 7 and Windows Vista, the Telnet client isn’t installed by default. In Windows Server 2008, you can install it via the Server Manager GUI tool, but it is often quicker to install it via a command prompt/terminal. So, open a cmd.exe session and run the following: servermanagercmd -install telnet-client And that’s it – …
Continue reading “Installing the Telnet Client on Windows 2008 using a Command Prompt”
Using grep to Exclude Lines Containing Certain Characters/Text
I like to watch Apache log files using tail -f but they often get filled up with data I don’t want/need to see – like, when I access the web site. grep is a great tool to search for certain information in text files – but it can also exclude certain pieces of information which …
Continue reading “Using grep to Exclude Lines Containing Certain Characters/Text”
What is Aero Glass Remoting? Terminal Server Aero Glass? (Windows Server 2008 R2)
What is Aero Glass Remoting? Can I use Aero Glass on a remote Terminal Services/Remote Desktop session? Well, with Windows Server 2008 R2, Yes you can! It’s basically replicating the user experience you get locally of Aero Glass, on remote sessions. It may be useful for task switching etc. Check the guide out below: http://blogs.msdn.com/rds/archive/2009/06/23/aero-glass-remoting-in-windows-server-2008-r2.aspx
Checking the Uptime of your OS X Machine
Uptime, uptime, uptime. Everyone loves massive uptime, right? The “Who’s PC has been on the longest without a reboot?” sort of challenges. Well, finding out the uptime on an OS X machine is quite easy! If you open a Terminal (by using Spotlight, then searching for Terminal or open Applications/Utilities and double click Terminal) and …