深度阅读

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

作者
作者
2023年08月22日
更新时间
17.91 分钟
阅读时间
0
阅读量

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.

!-1 

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

博客作者

热爱技术,乐于分享,持续学习。专注于Web开发、系统架构设计和人工智能领域。