maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N900 (https://talk.maemo.org/forumdisplay.php?f=44)
-   -   stupid mistake while ex rm -rf (https://talk.maemo.org/showthread.php?t=81412)

Day_Dreamer 2012-01-07 05:43

stupid mistake while ex rm -rf
 
I made a stupid mistake, I wanted to clear everything from my sdcard but I forgot to actually go to the card. so I opened terminal, logged in as root, mounted the drive and gave the commando rm -rf ./*

Everything seems to work but when looking in the filemanager app I only see nokia N900 and sdcard.

Do I need to flash my device to correct my mistake or is there an alternative?

Mike Fila 2012-01-07 06:03

Re: stupid mistake while ex rm -rf
 
so the prompt was nokia-n900:~#? sounds like you deleted everything, if you go back into terminal as root and do ls -R is anything listed?

btw the easy way to delete an sd card is from file manager long press and choose format

eight 2012-01-07 06:05

Re: stupid mistake while ex rm -rf
 
Assuming you were in /home/usr the command "rm -rf ./*" should have erased all files and folders inside /home/user including MyDocs, an equivalent command is "rm -rf *", it does the same.
The "." (dot) stands for the actual folder, you can list it with "pwd" (Print Working Directory) and "*" means all, "-r" is recursive.

edit:
If so you deleted basically the MyDocs Folder and some log files. The root partition and /home/opt (space for programs) should be ok.
However better than without the dot.

Maybe you can restore some files with photorec, I never used it, only tesdisk in the past which is recommendable when dealing with partiton errors.

Day_Dreamer 2012-01-07 13:31

Re: stupid mistake while ex rm -rf
 
thanx for the reply's.

@mike fila: I assumed that I was indeed in Nokia-N900:~# when I do an ls there is nothing but when I do an ls -R as you suggest I get loads of screen output (I assume dirs).

@eight I still have stuff under the /home/user dir (including MyDocs). and also under /home/opt.

when I do a pwd when logged in as root I see /root and a ls gives me nothing.

karam 2012-01-07 13:42

Re: stupid mistake while ex rm -rf
 
looks like you did :
Code:

root
rm -rf ./*

if so then no big deal because by default there is nothing in /root expect the conf files/folders starts with ( . )

but if you did sudo gainroot instead then it would be a bigger problem but you said you have your MyDocs so it's fine

in short : you were luck you wasn't in place else than empty /root/
you don't need a reflash
how ever it's recommended to check your backup grabbed from backupmenu (if you have one) and restore (if any missing files from N900 are in it)

Day_Dreamer 2012-01-07 17:23

Re: stupid mistake while ex rm -rf
 
@karam,

Yes that is what I did. So no big issues then.

I only made a backup with nokia pc suite (windows) can I use that as a reference?

michaaa62 2012-01-07 18:56

Re: stupid mistake while ex rm -rf
 
Nope, there is no file from /root saved to the backup, may that be via suite or via the in-built Backup Application, only user stuff like settings, bookmarks, contacts, conversations and application list are stored in a backup container. It is not necessary to restore anything under root, until you remember having tweaked a certain file manually. Those files, the application need for storing config data, will get build on the fly.

eight 2012-01-07 23:10

Re: stupid mistake while ex rm -rf
 
Nokia PC-Suite will only backup contacts, calendar and other PIM data. It will not help if you delete or change system files. For a systembackup of all files you will need backupmenu which saves and restores whole partitions to image files.

If you don't know backupmenu you should better not use such risky commands in the terminal unless you know exactly what it does.
As said, if you forgot to type the dot, or if your working directory had been /, not one file would be left. Where did you get that tip?

Megaltariak 2012-01-07 23:34

Re: stupid mistake while ex rm -rf
 
If you were in /root/ and did rm -rf ./* then you deleted absolutely nothing since * doesn't expand to files/dir that start with . ( I assume that /root/ doesn't contains anything except config files/dir starting with a dot which should normally be the case )

eight 2012-01-08 00:28

Re: stupid mistake while ex rm -rf
 
In this case it expands to dirs/files that start with dot.
* means all including files/folders beginning with a dot (marked hidden).

@ Day_Dreamer
Could you run
Code:

cd /root; ls -al
and post the output?
I think you deleted some hidden config folders under /root.

Code:

Nokia-N900:~# cd /root; ls -al
drwxr-xr-x  10 root    root          1096 Jan  8 01:00 .
drwxr-xr-x  26 root    root          1832 Jan  6 20:24 ..
-rw-------    1 root    root          1849 Jan  8 01:00 .ash_history
-rw-r--r--    1 root    root          412 Feb 19  2010 .bashrc
drwxr-xr-x    3 root    root          224 Jan  2 04:32 .cache
drwxr-xr-x    3 root    root          224 Jan  2 04:32 .config
drwxr-xr-x    2 root    root          520 Jan  6 20:36 .fapman
drwx------    2 root    root          160 Jul 14 08:54 .gnome2
drwxr-xr-x    2 root    root          240 Jan  6 20:26 .gstreamer-0.10
-rw-r--r--    1 root    root          274 May  5  2010 .gtkrc-2.0
-rw-r--r--    1 root    root          561 Dec 27 00:32 .htoprc
drwx------    2 root    root          376 Dec 22 17:16 .kismet
drwxr-xr-x    3 root    root          224 Jan  2 04:32 .local
-rw-r--r--    1 root    root          202 Feb 19  2010 .profile
drwx------    2 root    root          264 Jan  7 23:39 .pulse
-rw-------    1 root    root          256 Dec 18  2010 .pulse-cookie



All times are GMT. The time now is 14:16.

vBulletin® Version 3.8.8