LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-16-2010, 06:06 AM   #1
millus
LQ Newbie
 
Registered: May 2009
Location: Belgium
Distribution: Debian
Posts: 6

Rep: Reputation: 0
rm -rf $


Hey,

i've mistyped while issuing the command rm -rf and instead of doing rm -rf * i used $.

now i have a big problem cause i can't use any commands like ls,cat,...

operating system: debian lenny

could you please help me out
EDIT:

weird thing is i have 2 terminals open to my server. On the one i issued the rm command it <<mod edit: "does not work correctly">>
but on the other one i can do all commands.

i'm not going to close my putty
greetings

Last edited by pixellany; 04-16-2010 at 08:24 AM. Reason: language cleanup
 
Old 04-16-2010, 06:38 AM   #2
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
I'm not aware of a $ on it's own having any special meaning in the shell, so I'm not sure exactly what you might have done here except for trying to recursively remove the file '$'.

What happens if you open a new 3rd terminal to the server? Does that one work?
 
Old 04-16-2010, 07:00 AM   #3
millus
LQ Newbie
 
Registered: May 2009
Location: Belgium
Distribution: Debian
Posts: 6

Original Poster
Rep: Reputation: 0
well i just did an apt-get update and upgrade
and he downloaded a whole lot of tools again (in my second terminal).

I hope it's nothing real bad but i'll try to close them down now and reconnect.

<<mod edit: "I'll be really annoyed">> if i can't issue any commands

Last edited by pixellany; 04-16-2010 at 08:25 AM. Reason: language cleanup
 
Old 04-16-2010, 07:35 AM   #4
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
Quote:
Originally Posted by millus View Post
damn would be f***** if i can't issue any commands
That's what backups are for.


BTW, I'm no prude but the use of the f-word really isn't appropriate on a public forum like this.
 
Old 04-16-2010, 07:40 AM   #5
millus
LQ Newbie
 
Registered: May 2009
Location: Belgium
Distribution: Debian
Posts: 6

Original Poster
Rep: Reputation: 0
yeah srry about that i'm just panicking cause it's on a server, and it cost's time and money to reinstall it if i goes wrong.

i just installed it and set it up so i didn't backup anything yet

apperently rm -rf $ only damages the session your in cause after restarting all my putty terminals i found that there wasn't a problem anymore.

i wonder what it acctually does that command

greets
 
Old 04-16-2010, 07:47 AM   #6
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
Quote:
Originally Posted by millus View Post
apperently rm -rf $ only damages the session your in cause after restarting all my putty terminals i found that there wasn't a problem anymore.

i wonder what it acctually does that command
As I said above, '$' on it's own has no special meaning to the shell so the rm -rf $ would have searched to find a file called '$' to delete, and there's unlikely to be one of that name.

Perhaps something else untoward happened to your current shell environment. Anyway, glad you suffered no real damage.
 
Old 04-16-2010, 08:03 AM   #7
millus
LQ Newbie
 
Registered: May 2009
Location: Belgium
Distribution: Debian
Posts: 6

Original Poster
Rep: Reputation: 0
yeah i'm glad too,

thank you for replying

greetings
 
Old 04-16-2010, 08:26 AM   #8
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
millus;
Good to see that you've already agreed to watch the language.....

Good luck.
 
Old 04-17-2010, 04:23 AM   #9
millus
LQ Newbie
 
Registered: May 2009
Location: Belgium
Distribution: Debian
Posts: 6

Original Poster
Rep: Reputation: 0
yeah srry about that
i've been visiting LQ for a long time now, i think for about 3-4 years. This is the first time i actually posted.

thx again for the help
 
Old 04-18-2010, 02:55 PM   #10
devnull10
Member
 
Registered: Jan 2010
Location: Lancashire
Distribution: Slackware Stable
Posts: 572

Rep: Reputation: 120Reputation: 120
Just on the subject of this, one to be very wary of is using shell variables with rm -rf. I know a guy who had many variables set up, $HOME, $MUSIC, $TMPFILES etc, pointing to various places...

So, he intended to delete say everything in $TMPFILES but he accidentally issued the following command: rm -rf $TMP_FILES/* as root!! I'm sure you can imagine the end result. oops! ($TMP_FILES was uninitialized).
 
Old 04-18-2010, 06:03 PM   #11
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
well that will be the last time you use the " force " -f option with the recursive option -r
 
Old 04-19-2010, 06:02 AM   #12
devnull10
Member
 
Registered: Jan 2010
Location: Lancashire
Distribution: Slackware Stable
Posts: 572

Rep: Reputation: 120Reputation: 120
haha. Thankfully it wasn't me and the person who did it was on a test system which didn't really matter if it was trashed. Had it been a production system I think it might have been a different story!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration