Tag: shell

A Quick Way To Sort Text on macOS

One way to quickly sort text on macOS that I’m currently using is this:

I copy the text (Mark text & CMD-C) and them do this in iTerm:

pbpaste | sort | pbcopy

And that’s it, already. The text is sorted and copied back to the clip board.

Update: this small change fits my actual needs even better: Sort the input case-insensitive:

pbpaste | sort -f | pbcopy

And as an Alfred App user I can even do this (and don’t have to open a terminal):

Following log files and other output

In many situations, especially when testing, I like to see the log file content (or other system output) on one of my open command line windows.

Most of the time

tail -f <log-file-name>

is just fine. However, sometimes I like to have more control of what displayed. In these cases, I use less (https://en.wikipedia.org/wiki/Less_(Unix)):

less -F <log-file-name>

is more convenient (and powerful): I can navigate the whole file, search for specific content.

Note, that while tail uses a lower-case ‘f’ to follow the file as it’s being written to, less uses an uppercase ‘F’.

Navigation

%d bloggers like this: