Best Answer: How Do I Undo Changes in Linux?
Contents

Type u to undo the last change. To undo the two last changes, you would type 2u . Press Ctrl-r to redo changes which were undone.

Is there an undo command in Linux?

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

What is the command to undo changes?

Try Git checkout –<file> to discard uncommitted changes to a file. Git reset –hard is for when you want to discard all uncommitted changes. Use Git reset –hard <commit id> to point the repo to a previous commit.

James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest