How Do I Undo a Previous Command in Linux?

How Do I Undo a Previous Command in Linux?
Contents

There is no undo in the command line. You can however, run commands as rm -i and mv -i .

How do I undo a previous command?

To reverse your last action, press CTRL+Z. You can reverse more than one action. To reverse your last Undo, press CTRL+Y.

How do I recall a previous command in Unix?

  1. Ctrl+R: Recall the last command matching the characters you provide. Press this shortcut and start typing to search your bash history for a command.
  2. Ctrl+O: Run the command you found with Ctrl+R.
  3. Ctrl+G: Leave the history searching mode without running a command.

10 апр. 2017 г.

Elena Rostova
Author

Elena Rostova

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.