Posts Tagged ‘commandline’

Great post on Stack Exchange, How to correctly add a path to PATH?.

Friday, July 15th, 2016 at 06:17 | 0 comments
Categories: Linux

In this post we look at how text data can be transposed in a shell script. Suppose you have a comma-delimited text file (csv) which looks like this: 2014-10-01,Reading1,20.3 2014-10-01,Reading2,21.5 2014-10-01,Reading3,24.0 2014-10-01,Reading4,22.2 2014-10-02,Reading1,20.5 2014-10-02,Reading2,21.5 2014-10-02,Reading3,24.1 2014-10-02,Reading4,22.4 2014-10-03,Reading1,20.5 2014-10-03,Reading2,21.7 2014-10-03,Reading3,24.2 2014-10-03,Reading4,22.5 …and so on. Perhaps this is a set of sensor readings over a period of […]

Saturday, October 18th, 2014 at 15:50 | 0 comments
Categories: Linux

Suppose you have a monthly process to archive some data such as log files etc. Each month a separate archive file is created, and so after a few months you will have several archive files – for example as shown below: archive.2014-08.tar.gz archive.2014-09.tar.gz archive.2014.10.tar.gz Now if you wish to extract your data from all three […]

Saturday, October 18th, 2014 at 07:48 | 0 comments
Categories: Linux

This is a great one-liner which removes old kernel images and frees up space in your boot partition:

This comes from the top answer to a question on ask ubuntu.

Wednesday, October 16th, 2013 at 08:39 | 0 comments
Categories: Linux

The Nokia N900 is getting a little old now, but it still an amazing piece of kit. This post has a few pointers for making the most out of command line usage it enables. Command Line Execution Widget: This widget lets you run commands from the desktop and outputs the results.. Cmd Shortcuts: Allows you […]

Thursday, August 16th, 2012 at 13:39 | 0 comments
Categories: Mobile

Most digital cameras store Exif data in the JPEG photo files. This includes things like date and time, camera model and camera settings and in some cases even GPS coordinates. jhead is a very useful command line utility which can read and edit the Exif data. For example, you may wish to remove the data […]

Saturday, August 11th, 2012 at 05:41 | 0 comments
Categories: Linux

GNU/Linux includes many utilities for working with text files through the shell. In this post we take a quick look at accessing and manipulating text files in a “column-wise” mode. Suppose you have the following two files, each with two columns separated by the TAB character. $cat file1 Alice   Paris Bob     Tokyo Mary    London John    New York $cat file2 […]

Monday, October 17th, 2011 at 17:02 | 0 comments
Categories: Linux

Sed can be used to strip out all HTML or XML tags from a file and get the plain text version. Suppose you have file gnulinux.html with the following contents: <p>The combination of <a href=“/gnu/linux-and-gnu.html“>GNU and Linux</a> is the <strong>GNU/Linux operating system</strong>, now used by millions and sometimes incorrectly called simply “Linux“.</p> Tempting but incorrect […]

Monday, October 17th, 2011 at 12:16 | 0 comments
Categories: Linux

Here’s a quick way to remove empty lines from a file using the Linux command line: cat file1 | sed /^$/d > file2 Where file1 is the input file containing empty lines and file2 is a newly created file with empty lines removed.

Wednesday, September 22nd, 2010 at 16:50 | 0 comments
Categories: Linux

Changing the port number of SSH daemon is a quick way of reducing the number of SSH brute force attacks your server might face (check the file /var/log/auth.log to see if there are many failed SSH login attempts). Just to be on the safe side, create a backup copy of the SSH daemon config file. […]

Friday, September 3rd, 2010 at 08:56 | 0 comments
Categories: Linux