Linux · January 19, 2023 0

How to re-execute the last command in the Linux terminal

Table of Content

It would re-execute the last command.If the command was quite big to type in again, this would be quite a great trick.So let us see what the commands are to run again in the Linux terminal .

1) Ctrl + P

Just press the Ctrl and P keys together to fill the prompt with the last executed command.This is the most dependable shortcut in Linux.

2) Up Arrow key

The usage It’s quite straightforward to use the up arrow key.

3) Using a double bang(!) operator

Double bang or ! is also a way to run the last command.


4) Single bang (!) search

For running the last command, we use !-1, indicating the last command.


5) Using fc command

FC is a program built-in certain popular shells.We can just entering a flag or argument into it.By adding in -s, we can easily execute the command.

fc -s

%d bloggers like this: