Find the answer to your Linux question:
Results 1 to 4 of 4
I am new to linux. My question is that suppose i wrote a command in the terminal and the action has taken place like copying or renaming a file using ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2009
    Posts
    1

    Post Undo the effect of a command in terminal


    I am new to linux.
    My question is that suppose i wrote a command in the terminal and the action has taken place like copying or renaming a file using cp, mv command.
    But, like the windows is there is any command so that the previous action can be undone.

  2. #2
    Linux Guru reed9's Avatar
    Join Date
    Feb 2009
    Location
    Boston, MA
    Posts
    4,651
    No, there is no general way to undo a command. So long as you're not working as root, you can't cause too much damage, though of course you can delete your own stuff quite easily and there is no easy way to recover a file once deleted from the command line.

    "UNIX was not designed to stop its users from doing stupid things, as that would also stop them from doing clever things." – Doug Gwyn

  3. #3
    Just Joined!
    Join Date
    Dec 2009
    Location
    Omaha, NE
    Posts
    1
    Quote Originally Posted by reed9 View Post
    there is no easy way to recover a file once deleted from the command line.
    No easy way is true, but sometimes there is a way... look at things like ddrescue. :P But reed9 is right, if you're careful you shouldn't have problems. If you're executing random commands as root... you have plenty of problems already

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,677
    Quote Originally Posted by kundan2009 View Post
    I am new to linux.
    My question is that suppose i wrote a command in the terminal and the action has taken place like copying or renaming a file using cp, mv command.
    But, like the windows is there is any command so that the previous action can be undone.
    This is why we keep backups... Really though, once you have initiated a command, you might be able to kill it (Ctrl-C) before it completes and makes your system a toaster, but systems are so fast that unless the operation you started is a long-running one, you are probably SOL. We all do this, and then whack our heads like Home Simpson - Doh! Personally, my favorite (which I have done more than once in the past) is to execute the command "rm *", forgetting that I was logged in as root and was in the root directory /. Oops... Now where did I put that last system image backup?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •