Laser Blog

Articles tagged "command line"

119 30 online sources for Linux/Unix documentation

Monday 9th January, 2012

NixCraft is an excellent source of Linux/Unix documentation in itself, but this article lists 30 offsite sources of technical documentation. Some old, some new, most are good!


112 Linux tips every geek should know

Monday 2nd March, 2009

This is a great collection of random Linux tips (57 in all). They were originally published in Linux Format magazine. The various tips are categorised into three levels of difficulty, easy, intermediate, and expert. Well worth a read.


111 sed and iostat

Saturday 22nd November, 2008

This tip is specifically for the version of sed which came with Solaris. GNU sed has options which make solving this problem much easier.
Rob. April 2015.

I'm sure many Solaris admins will have come across this problem before. You have a SAN-attached host with dozens, maybe even hundreds of visible LUNs. Each LUN has a highly improbable and unwieldy name, as some of these SAN-attached devices do, and you need the iostat data for that LUN.

grep is no help, because you also want the four lines of data beneath the 'disk' name.

Well, you could just run iostat and painstakingly trawl through hundreds of lines of data, searching for the information you need. Or you could use the goodness of sed to find your LUN, and the four lines of data beneath it ...

$ iostat -En | sed -n '/c4t60060480000290101035533030433430d0/{p;n;p;n;p;n;p;n;p;}'

c4t60060480000290101035533030433430d0 Soft Errors: 0 Hard Errors: 1223 Transport Errors: 1170
Vendor: EMC      Product: SYMMETRIX        Revision: 5771 Serial No:
Size: 54.41GB <54408314880 bytes>
Media Error: 0 Device Not Ready: 0 No Device: 75 Recoverable: 0
Illegal Request: 0 Predictive Failure Analysis: 0

And that is a genuine LUN id!


110 Colour-coded battery charge level and status in your bash prompt

Thursday 11th September, 2008

I still use a version of this script. The Linux kernel has changed somewhat so the script as it is below probably won't work. (Instead of /proc/acpi/battery/, direct the script towards /sys/class/power_supply/. And do make some other small changes.) I should update this.
Rob. April 2015.

I recently purchased a laptop, and having installed a proper OS, I found myself a little disappointed with the default battery meter provided by GNOME. Unless you mouse over the icon on the panel, it doesn't display exactly what charge level it is at. I am aware of the other options such as conky, gkrellm, screenlets, etc, but being the lazy sort, I consider it a long way to move your eyes! Since I'm the type who always has several terminals open, I thought it would be handy to display the charge level and status of the laptop battery in my shell prompt.

109 find is an amazing tool

Friday 11th July, 2008

I found a new article about the remarkable command-line interface utility 'find' today. It's a good article, but the best I've found so far is Daniel Miessler's excellent tutorial on the subject, which also incorporates some xargs goodness, something which the former sadly neglects.