| |  | |
02-16-2008
|
#1 (permalink)
| | Just Joined!
Join Date: Feb 2008
Posts: 21
| A word to Linux newbies. A note to those of you new to Linux, and even the veterans. Save this info in your mind, and never forget it. It might save you a nervous breakdown.
When you are following online instructions or advice on how to do something in the terminal, be very, very, very careful about anything that removes a file or directory. This is the "rm" command, and can possibly be followed by the -r or -f or both, i.e., -fr
Yesterday, I was following some instructions, and I was therein asked to remove a directory. I used the rm -fr command (which is to say I forced the deletion without confirmation and did it recursively so all files inside that directory were deleted too). I erred in the path of the directory, and lost quite a lot of very important, and system critical data. Although it's not impossible to recover it, the chances of success are virtually zero without very advanced knowledge of your system.
So I spent most of my night recovering, needless to say. I was able to piece-meal everything back together from old CD's with data I had saved at one point, my flash drive, and the Ubuntu install CD. But it was a pain in the ass.
Be very careful with your commands. Linux demands a certain amount of self accountability. I'm sure there are those out there who make some critical mistake in Linux and are turned off because of it, not realizing that in Linux-land, the system actually does what you tell it to... |
| |
02-16-2008
|
#2 (permalink)
| | Trusted Penguin
Join Date: Apr 2006 Location: Cowtown, Texas
Posts: 2,469
| It absolutely sucks that you had to learn this the hard way. Glad you were able to get it fixed.
__________________
All new Users please read: FAQ |
| |
02-16-2008
|
#3 (permalink)
| | Linux Guru
Join Date: Oct 2007 Location: Bristol, UK
Posts: 1,633
| I must confess I usually man command_name or info command_name first before following instructions. That way I think I know what the results are going to be.  (still has not saved me from some stupid mistakes!)
There are plenty of commands which can result in major issues if not used carefully. Press the tab key twice in a terminal and you will be prompted something along the lines ... Code: Display all 1978 possibilities? (y or n)
Trying to remember all options for all commands is not practical, I find the more I use linux the more I use the man and info commands!
Being an ex-DOSer I did have a bad habit of trying command_name -h ... but after I got a shock with a command which ignored the -h and executed anyway I stopped doing that.  |
| |
02-16-2008
|
#4 (permalink)
| | Trusted Penguin
Join Date: Apr 2006 Location: Cowtown, Texas
Posts: 2,469
| Quote:
Originally Posted by Jonathan183 I must confess I usually man command_name or info command_name first before following instructions. That way I think I know what the results are going to be.  (still has not saved me from some stupid mistakes!)
There are plenty of commands which can result in major issues if not used carefully. Press the tab key twice in a terminal and you will be prompted something along the lines ... Code: Display all 1978 possibilities? (y or n)
Trying to remember all options for all commands is not practical, I find the more I use linux the more I use the man and info commands! Being an ex-DOSer I did have a bad habit of trying command_name -h ... but after I got a shock with a command which ignored the -h and executed anyway I stopped doing that.  | Try using another hyphen
fdisk --h
rm --h
__________________
All new Users please read: FAQ |
| |
02-19-2008
|
#5 (permalink)
| | Just Joined!
Join Date: Feb 2008
Posts: 0
| Great advice. And be careful at what you do as root - do user activities logged in as a normal user! Quote:
Originally Posted by Lich A note to those of you new to Linux, and even the veterans. Save this info in your mind, and never forget it. It might save you a nervous breakdown.
When you are following online instructions or advice on how to do something in the terminal, be very, very, very careful about anything that removes a file or directory. This is the "rm" command, and can possibly be followed by the -r or -f or both, i.e., -fr
Yesterday, I was following some instructions, and I was therein asked to remove a directory. I used the rm -fr command (which is to say I forced the deletion without confirmation and did it recursively so all files inside that directory were deleted too). I erred in the path of the directory, and lost quite a lot of very important, and system critical data. Although it's not impossible to recover it, the chances of success are virtually zero without very advanced knowledge of your system.
So I spent most of my night recovering, needless to say. I was able to piece-meal everything back together from old CD's with data I had saved at one point, my flash drive, and the Ubuntu install CD. But it was a pain in the ass.
Be very careful with your commands. Linux demands a certain amount of self accountability. I'm sure there are those out there who make some critical mistake in Linux and are turned off because of it, not realizing that in Linux-land, the system actually does what you tell it to... | |
| |
02-19-2008
|
#6 (permalink)
| | Trusted Penguin
Join Date: Apr 2006 Location: South Yorks, UK
Posts: 3,663
| Good advice.I also learnt the hardway when I was a Linux newbie. I intended to delete a file in /usr/local and entered something like " / usr/local/somepath". I realised my error within seconds but I had lost most of the commands in /bin so had to reinstall because I did not have a backup. |
| |
02-19-2008
|
#7 (permalink)
| | Linux Enthusiast
Join Date: Dec 2007 Location: France but my heart stays in Britain
Posts: 645
| Here's what could happen!
__________________
Distribution: Archlinux
Processor: Celeron 2.6 GHz; Ram: 750 MB
Graphics card: Nvidia GeForce4 MX 440-SE
Mother board: Columbia 4
|
| |
02-19-2008
|
#8 (permalink)
| | Super Moderator
Join Date: Oct 2004 Location: The Sovereign State of South Carolina
Posts: 3,759
| I think all of us have had mishaps at some point using the rm -rf command. I lost a whole directory myself once in the same way! Now, whenever using rm -rf, I stop and visually inspect the exact command for errors before pressing enter. Thanks for the informative and useful information. We all can stand reminding about these things from time to time.  |
| |
02-19-2008
|
#9 (permalink)
| | Just Joined!
Join Date: Mar 2005 Location: Switzerland
Posts: 21
| Quote: |
do user activities logged in as a normal user!
| From my experience, this is the best way to prevent critical damage. I am talking about computing in every sense, and with every platforms. Whether you are using Linux, Mac, MSWindows or any other OS, you should never ever do normal work as root.
I believe this is the best anti-virus on the market. If you don't have the administrator's rights, how can a virus get installed.
Cheers
__________________
Linux rules, but as much as a beautiful day on the ski slopes.
|
| |
02-20-2008
|
#10 (permalink)
| | Linux Engineer
Join Date: Feb 2008 Location: Louisville, KY
Posts: 835
| Quote:
Originally Posted by surferb do user activities logged in as a normal user! |
Indeed! I've made a fair amount of mistakes because I didn't follow this rule, and learned the right things the wrong way  And I can't tell you how many times I have to help clean up a machine for friends or family because they won't use a regular profile for normal work. they just don't wanna take the minute or two to switch profiles/accounts.
Oh well... What can ya do?  |
| | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | Job Search | | | All times are GMT. The time now is 01:02 PM. |
| |