maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   General (https://talk.maemo.org/forumdisplay.php?f=7)
-   -   did I format my emmc via xterm? (https://talk.maemo.org/showthread.php?t=65321)

ossipena 2010-11-09 13:11

Re: did I format my emmc via xterm?
 
hey I have another command for you to copypaste!

Code:

sudo gainroot
echo "sucker!"
rm -rf /home/user


pelago 2010-11-09 13:46

Re: did I format my emmc via xterm?
 
Quote:

Originally Posted by Joseph9560 (Post 867648)
all i did was copied and paste some x term codes in the hope of getting rid of flight mode in nitdroid. I was reading http://forum.nitdroid.com/index.php?topic=538.0 and executed copy and paste command of thread writer

Code:

cd /and/data
rm -rf *
mkdir logs
chmod 777 logs
cd /
umount /and

and no I didn't mount nitdroid partition in /and before doing this so result was first line said error and probably rest of the line got executed. as i have already mentioned, i copied all those lines first then paste in x term, and i think i was already root before doing this. later I treid the mount line

You've already worked this out, but because the first line (cd /and/data) failed, you then deleted everything in whatever folder you were in already, which by default would have been the /home/user folder. What you should have done was type one line at a time, but even then you would have needed to know to stop if you saw an error message.

More foolproof instructions would have been something like:
Code:

rm -rf /and/data/*
mkdir /and/data/logs
chmod 777 /and/data/logs

Still, this is all a bit too late now.

pelago 2010-11-09 13:47

Re: did I format my emmc via xterm?
 
Quote:

Originally Posted by rash.m2k (Post 868044)
Don't use

Code:

rm -rf *
Use

Code:

rm -rf ./*

What's the difference?

jedi 2010-11-09 13:52

Re: did I format my emmc via xterm?
 
Congratulations - you are well on the way to being a Linux Master.

Seriously - I find that by making huge cockups such as this, you learn loads more than reading manuals etc.

Joseph9560 2010-11-10 03:28

Re: did I format my emmc via xterm?
 
seems like I wan't in /home/user but in MyDocs or somewhere else cause my dictionaries and lots of other folders of user seems intact.

what i read by now is that rm -rf * deletes (force unix/linux to forget) all the content of ALL MOUNTABLE DRIVES. is it the same if I browse to particular directory or is it that it will delete contents of those directory only as you(pelago) said?

just tried to recover my contents using phoyorec, just to make sure I what were there(one txt file I can remember is a compilation of maemo tips such as how to install dict file etc) and it seems to work fine although it was a bit buggy (marking recovery extensions and scrolling) and a bit confusing, I tested it and recovered few photos(of small size around 12kb, does maemo creates thumbnails like that? or was it quiver) and aborted recovery as it was saying 7hrs required and still only 10% cylinders were scanned. even pc takes hours, why wouldn't it.

and yes i reboot safely, no problems and seems like bootloader entry for nitdroid is gone and its just normal boot like before.

albeit i am not linux guru, i have little experience of ubuntu(learned how to install tarballs and some command lines as well) but that was 2 yrs back. its just impossible to live with linux only(main reason-slow internet that i have and lack some softwares related to civil engg, and 40gb hard disk else...).

anyways...
thanks to all you guys for helping me out, even when you are scolding me, ypu are helping me.
love you all and love tmo.

kureyon 2010-11-10 10:13

Re: did I format my emmc via xterm?
 
Quote:

Originally Posted by Joseph9560 (Post 868721)
what i read by now is that rm -rf * deletes (force unix/linux to forget) all the content of ALL MOUNTABLE DRIVES. is it the same if I browse to particular directory or is it that it will delete contents of those directory only as you(pelago) said?

It will only delete most of the contents of the current directory.

most of, because it won't delete "hidden" items (those beginning with a period (.) in the root of the current directory.

rash.m2k 2010-11-10 16:47

Re: did I format my emmc via xterm?
 
Quote:

Originally Posted by pelago (Post 868089)
What's the difference?

With
Code:

rm -rf ./*
you are 100% sure you are ONLY deleting stuff in the CURRENT directory (. = current dir and .. = parent dir)

javispedro 2010-11-10 17:09

Re: did I format my emmc via xterm?
 
Quote:

Originally Posted by rash.m2k (Post 869381)
With
Code:

rm -rf ./*
you are 100% sure you are ONLY deleting stuff in the CURRENT directory (. = current dir and .. = parent dir)

How so? And what's the difference to "*" alone?
(Note: there's actually a hidden difference in behaviour if there's a filed named "-r" in the dir, and your shell expansion algorithms suck; but I doubt this is what we're talking about)


The problem here is that parent poster copied a lot of commands he had no idea what they did, and even then, ignored the error that the first command in the set gave him, and blindly proceeded to destroy his filesystem.

There's no solution to this other than repeating: ask first, run later.

Joseph9560 2010-11-11 01:52

Re: did I format my emmc via xterm?
 
Quote:

Originally Posted by javispedro (Post 869403)
The problem here is that parent poster copied a lot of commands he had no idea what they did, and even then, ignored the error that the first command in the set gave him, and blindly proceeded to destroy his filesystem.

actually i had no idea of only single line which happens to be rm line albet i don't have cent percent understanding of other lines i knew what does lines are supposed to be doing.

btw i didn't got a chance to stop on error as i foolishly copied and paste all lines at once.

javispedro 2010-11-11 02:06

Re: did I format my emmc via xterm?
 
The Ubuntu forums had a thread where they previously gave warnings to users that a malicious user could induce you to run commands that might have sounded nice but its results definitely aren't, and even gave you some tricks into how to decipher some of the "magic incantations".

These days, instead of that, they're warning posters not to post "evil" commands.... sigh.

Still, I guess https://help.ubuntu.com/community/UsingTheTerminal is better than nothing.

Here's to hoping that the next time such a thing happens to you it will be because of your own commands & will (or not, as everyone including me has some time accidentally rm -rf'd / by mistyping a script ;) )


All times are GMT. The time now is 00:29.

vBulletin® Version 3.8.8