Find the answer to your Linux question:
Results 1 to 5 of 5
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Undo last command function, undo all terminal session commands

    Hey you command line gurus

    I was wondering if there exists such a command as
    • Undo last command function
    • Undo all terminal session commands
    • Undo configure/make/make install commands

    How useful that would be!
    I could experiment without fear of ramifications, especially because many build attempts create disarray and files everywhere. Also sometimes terminal commands are cryptic and I do not understand what I'm doing so I have to be able to try and then undo.

    What is universal undo command? For last command and all session commands? For undo configure/make/make install commands?

    Edit: now of course, there will be commands that are reversible such as formatting disk etc. but for those that are possible my question is directed to them

  2. #2
    Hey you command line gurus
    Hi lindsey,

    Before anything else, I would like to make it clear that I am not a "command line guru". Nor even a guru at that. Am excited though since I will be hitting the linux engineer mark in a few weeks .

    Anyway, now that that's clear, IMHO, I am not aware of any command in the terminal that can undo the last command function. I have screwed up my system many times before since I was dumb enough not to read the output and made sure I understand what I was doing. But then again, I may be wrong.

    If you want to play around though, I would suggest you install an OS in your host system using VirtualBox. You will not feel so bad after frying up your system in the terminal. One click of the mouse and you can restore your guest OS to the "screenshot" of your choice.
    Linux User #489667

  3. #3
    Linux Engineer Kloschüssel's Avatar
    Join Date
    Oct 2005
    Don't know if this is still of interest. If so, this would probably be the solution to the question.

    I often use strictly mathematical approaches as those can be used as a proof. So will the following argumentation proof that your needs cannot be fulfilled unless you adapt the environment.

    * assuming a command is a function you apply to a set of bits/bytes
    * a function must be bidirectional in order to be reversed
    * so if the function you applied is bidirectional you can automatically revert it by applying the inverse of the function

    So .. to implement it on current computers, one would have to map the state (encoded as bits and bytes) to a number which is within a subset of a invertable algebra (would be for example R\{0}), calculate the difference, invert the difference and apply the inverted difference to restore the old state.

    Unfortunatly you have this problem:

    * the binary state information is not a invertable algebra as you have finite memory and you'll run into bitfalls which produce loss of information

    for example:

    if you had a two bit computer system that multiplies a value by "2" and you want to revert that operation. then you would calculate the inverse of 2 (binary "10"), which is "0.5" (binary "001"). unfortunatly you have only two bits and you loose the last bit (1). Thus you get a "0" instead of "0.5" - surprise surprise. Now undo the operation by multiplying the old value with "0" and you may can imagine that something multiplied by zero is always zero and no longer the number of before.

    One could build a computer architecture that includes two times as much memory as actually used to implement the invert functionality, but you can imagine that such a hardware is two times as expensive. Noone really wants to pay that much.

    In the end it is much funnier to not just use the brain as a counterweight to the feet.
    Last edited by Kloschüssel; 07-19-2010 at 08:55 AM.

  4. $spacer_open
  5. #4

    How to remove the last command

    Open terminal and type:

    defaults write AppleShowAllFiles Yes
    killall Finder

    Now open finder and follow this directory: /Usr/bin

    This is the folder in which all ther terminal commands are contained, so if you want to un-do the terminal command find it and delete it.

    Deleting last has no adverse affects.

    I would not recomend deleteing all the files in this folder first try moving it to a different location and see what happens. Removing some of these files may cause your computer to act differently so only delete the bare minimum.

    EDIT: The only terminal command that i know of is echo "TEXT GOES HERE" . it will in turn display the text you want. Place the file in the directory mentioned above

  6. #5
    Linux Guru reed9's Avatar
    Join Date
    Feb 2009
    Boston, MA
    Um, do NOT delete files in /usr/bin. This will certainly not undo any command.

Posting Permissions

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