Created with Sketch.

command line

In my unenlightened days, I used to think graphical user interfaces had rendered the command line as a relic of the days of yore. It was until I actually started to try to get my computer to do the things that I wanted it do did I realise how powerful and useful the command line is. 

Nowadays, I tend to have at least one Terminal window open and make use of the command line all the time. 

The notes in this section are geared towards using the command line on macOS. Much of it applies equally to UNIX-based systems. For anyone interested using the command line in Windows, you're better off looking elsewhere. 


Textutil

Textutil is a really useful tool at the command line for manipulating text-based files. As a general rule, I use it to quickly convert files from one format to another (e.g. RTF files to text or RTF to HTML). It's very quick and very easy.

Convert files from one format to another

Let's say you have folder full of .rtf files that you want to convert to .txt files. Textutil is ideal for this job. 

1. Navigate to the folder that contains the files you wish to convert:

$ cd path/to/the/folder

2. Once in the required folder, run the following command:

$ textutil -convert txt *.rtf

All that we're doing here is running textutil, invoking the -convert flag, telling it we want to convert our files to txt format and then passing in the files we want to convert (in this example, we're passing in all files ending with the .rtf extension.

For more on textutil, see the macOSX manual.