The Linux command prompt/shell records previously entered commands in the form of history. This is convenient because any of the previously used commands can be recalled and run again when needed.
Now, to see a list of all previously used commands, type “history” at the command prompt.
This will show a numbered list of all the commands with each number corresponding to the command next to it.
Once the history displays the numbered list, here is how that can be used to recall and execute previous commands :
For example, the command “pwd” shown below has a number 247 associated with it, so typing it will execute that :
2nd way :
A simpler way to do this without looking up numbers is to just type the partial command name :
The example below shows how a partial “who” command will recall and execute that specific command.
One thing to note when doing this is that if there are more then one such similar commands (in the above example a “uname -i”, then later followed by a “uname -a”, the most recent one will be executed which would be “uname -a” in this case).
Isn’t Linux command line awesome!? 🙂
[To know different kinds of commands in Linux Mint/Ubuntu and how to use them efficiently, please refer to our multi-part Linux command line basics series starting from here. ]