Phew! That was a lot of commands we learned! In case you wanted to look back at your command history, the shell allows you to do so! In fact, for each session, the shell stores everything you typed!
To see the contents of the history list, simply use the
For a better format, pipe the results to less.
$ history | less
Furthermore, we can pipeline certain commands with
grep. Recall that
grep searches for lines containing a certain pattern.
$ history | grep ls
Each command is listed in chronological order (1 being your very first command). To go back to a specific command, simply place the command number after an exclamation mark (!).
If you recall a few keywords from a command you executed, but don't recall it all, you can easily to a search through the history of your commands with ^r (ctrl+r).
After the command you want pops up, press ^j to copy to your current line.
If you want to toggle up and down your history list, you can do so with the up and down arrow keys. Additionally, there is ^p and ^n, which stand for previous and next.
Here are some additional history shortcuts.
sudoin before running a command!
Relieve spasms, tight muscles, trigger points and pressure points with the Body Back Buddy! This trigger point massage is designed to help you self-message any area of your body - especially those that are hard to reach. Keeping your muscles relaxes and out of contraction is importan in helping to reduce pain and prevent muscle injury.$ Check price
Command Line Kung Fu is packed with dozens of tips and practical real-world examples. You won't find theoretical examples in this book. The examples demonstrate how to solve actual problems. The tactics are easy to find, too. Each chapter covers a specific topic and groups related tips and examples together.$ Check price