Useful yet underutilized commands

Sun 30 March 2008 by Thejaswi Puthraya

Useful yet underutilized commands

Recently, I have started looking towards system programming (thanks to my arm processor project). While I was glancing through the manual pages, I noticed these commands that are extremely useful but rarely used (or probably implicity used).

Here they are:

  • csplit: split a file into sections determined by context lines

Very useful command. Helps breaking a file according to regexps, number of lines etc.

  • expand: convert tabs to spaces

Another useful command especially in the python world where they specifically discourage the use of tabs and prefer 4 spaces.

  • fold: wrap each input line to fit in specified width

Useful while getting your code to fit the terminal window or to fit PEP 8.

  • fuser: identify processes using files or sockets

Had used this command earlier but didn't know that it could be used for TCP sockets also.

  • iconv: Convert encoding of given files from one encoding to another

Very useful. Recently this came handy coverting ISO88952 to UTF8.

  • join: join lines of two files on a common field

A life-saver sometimes.

  • nl: number lines of files

A super sexy utility that prints the line number to the left of the code.

Will write about more commands as I come across them.