March 24, 2024

Quick Command Recall

The use of Terminal is quite dominant in Linux, especially for someone who is not concerned with graphical interface (e.g: Linux used as Server). Terminal‘s function is like Command Prompt‘s function when in Windows, executing text based command. (Distro I used: Ubuntu 9.10 Karmic Koala)

Usually, when executing a command in Terminal, if we -as linux user- don’t know the use of history command, we will call again and again the command although it’s the same command. So, if we would like to fast recalling our previous command, we could use the history command and query previous command.

history Command Execution
Figure 1: history Command Execution

Figure 1 is a way of executing the history command (without any arguments). As we seen, it generates list of commands we have executed. The left side (number) indicating the queued command number and the right one indicating the executed command. We could recall the command in the generated list using:

!command_number

Figure 2 is a sample of recalling the command.

Recalling Command
Figure 2: Recalling Command

!25 will recall the command number 25 as seen in Figure 1.

But, the question is, “Should we call history when we want to recall a command?” Actually NO! We could recall using more simple query with just using a key combination (Ctrl+R) and write the pattern of command we would to search.

Recall Command Using KeyStroke
Figure 3: Recall Command Using KeyStroke

As we push (Ctrl+R), the line would become (reverse-i-search) ”: and then we could write down the pattern. Figure 3 shows us how to recall the command with pattern (grou) and finally the complete command will appear on the right side of colon.

That’s all… And pardon me about my English 😛

10 thoughts on “Quick Command Recall

  1. Bismillah…

    ju2r sbner’y kurang ngerti mslah IT apalagi pk english..hehe

    hebat!!!

Leave a Reply to Neil patel Cancel reply