Which Command Is Used to Repeat the Last Command Unix?
Contents

You can use CTRL+O as many times as you want to keep re-executing the last commands. Method 6 – Using ‘fc’ cmmand: This is another way to repeat the last executed command. The ‘fc’ command is used to list, edit and re-run the previously entered command.

How do you repeat the last command in Unix?

Following are the 4 different ways to repeat the last executed command.

  1. Use the up arrow to view the previous command and press enter to execute it.
  2. Type !! and press enter from the command line.
  3. Type !- 1 and press enter from the command line.
  4. Press Control+P will display the previous command, press enter to execute it.

What is repeat command in Linux?

1. Use watch Command. Watch is a Linux command that allows you to execute a command or program periodically and also shows you output on the screen. This means that you will be able to see the program output in time. By default watch re-runs the command/program every 2 seconds.

Maya Lin-Takahashi

Maya Lin-Takahashi

Consumer Tech & Gadget Reviewer

Maya is a hardware enthusiast who tests and reviews smart home devices, smartphones, wearables, and audio gear. She focuses on practical consumer value and build quality.

Share this article
Twitter Facebook Pinterest