Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Is there a common command to undo a bash-command. I know this question is crazy but you never know in Linux.
I just run “chmod a+rx /dev/ptal-printd /var/run/ptal-*” and want that command undone because my printer doesn`t work anymore. I had a look in the man-page for chmod and think the right command could be
“chmod a-rx /dev/ptal-printd /var/run/ptal-*” but I´m not sure, or are there any other command like
“undo chmod a+rx /dev/ptal-printd /var/run/ptal-*”
In Bash there is an undo, but its not what you think
this thread is a little old... but just wanted to post a reply in case someone googles it
There will probably never be a command that will achieve what is desired above, as there is no way for bash to know what the equal and opposite of every single command is. For example, if you do a 'mkdir', bash will have to know that the opposite is 'rmdir'. Its not even the same command.
Having said that, there is a way to undo what you have done in bash itself.
For example...
pretend you want to 'chmod' a bunch of directories:
$> chmod 777 ./foo ./bar ./test ./yup
then you realize you want to 'chown' them instead. So you do a 'ctrl-a' to move to the front so you can replace 'chmod' with 'chown'
instead of doing an 'alt-d' to delete the word you accidentally do a 'ctrl-k' and delete the entire line!
so to "undo" what you just did on the command line, you do a 'ctrl-x, ctrl-u' to undo the last changes. 'Ctrl-_' does the same thing.
Voila, your line magically appears back in your terminal.
Last edited by iambrucelee; 02-19-2010 at 11:37 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.