History of commands in the shell

The best command to review most recent commands:

fc -lr

 The above command lists the latest commands in reverse order. It doesn’t list many. To see the entire list, type:

fc -l 1 | less

Simple fc without any arguments picks the latest command in the history, opens it up in your preset command-line editor, and then launches it when the editor closes. There is no stopping the launching, as far as I know, except by emptying the editor and closing it.

To launch an editor according to my liking and with arguments I don’t ordinarily use in that editor, I use:

fc -e "nano -k -U"

Additionally, there’s a way to re-launch commands by means of fc. For this, do first fc -lr to get some commands with their respective history numbers and memorise the number you want to re-launch. Then:

fc -ls #

where # is the number. This re-launches without editor (the argument -s does that). More info:

man fc

Inform thyself of the commands in your computer

man + cmd usually gives the most in-depth answer when seeking information about a command. Most Linux commands have man pages. Some don’t.

In case of missing man pages, the given command may provide information about itself by one of the following:

cmd --help

cmd -help

cmd -h

Substitute cmd for the command you want to know about.

Additionally, there are special commands on Linux whose function is to provide information about other commands. Some of them are:

type cmd

whatis cmd

whereis cmd

Find out the time in other time zones

TZ='America/Chicago' date --date='TZ="Europe/Berlin" 2100'

This command will output the answer to the question: When it’s 2100 (9:00 p.m.) in Berlin, then what’s the time in Chicago?

To find the timezones you need, use tzselect.