LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Urgent! Help me restore this folder (https://www.linuxquestions.org/questions/linux-newbie-8/urgent-help-me-restore-this-folder-782016/)

MartinKuyu 01-13-2010 01:07 PM

Urgent! Help me restore this folder
 
I was recently installing a a package and in due course, I typed by mistake the following code in a terminal:

sudo rm -r /usr/share/applications/

Now all my program shortcuts are gone and my gnome terminal as well as icons,and panels are not accessible as a root user....(Thank god I was using AWN on my current account!)

Can anyone help me restore the folder because from the terminal, the command says it possible.

lugoteehalt 01-13-2010 01:36 PM

You said 'recently', so does it follow it was just the gnome thing that it puts in automatically? You know you hadn't changed it much.

In which case just reinstall Gnome seems the simple course.

Is gnome a 'metapackage' or whatever they are called. In which case:
Code:

sudo apt-get install --reinstall gnome
Hope helps.

EDIT: Sorry that was a bit crass even by my usual standards. You've presumably removed all your *.desktop files. The above suggestion might still be worth a try. Or try recovering the directory with some sort of recovery program, but its likely to be a bit iffy.

MartinKuyu 01-14-2010 03:53 AM

Thanks a lot. Re-installing gnome has at least returned most functionality, but I am still missing my .desktop icons. I have tried to get recovery software but apparently none exit for Linux.

evo2 01-14-2010 04:08 AM

Quote:

Originally Posted by lugoteehalt (Post 3825433)
Is gnome a 'metapackage' or whatever they are called. In which case:
Code:

sudo apt-get install --reinstall gnome
Hope helps.

Interesting. I'd have thought that if it was a meta package, the above, would not do much at all. Since the "gnome" package that is being reinstalled would not actually have any files.

I'd probably try something like:

Code:

sudo apt-get install --reinstall $(dpkg -l '*gnome*' | grep ^ii | awk '{ print $2 }')
Or, if dlocate is installed:

Code:

sudo apt-get install --reisntall $(dlocate /usr/share/applications/  | cut -f1 -d':' | sort | uniq)

Cheers,

Evo2.

lugoteehalt 01-14-2010 02:40 PM

Quote:

Originally Posted by MartinKuyu (Post 3826089)
Thanks a lot. Re-installing gnome has at least returned most functionality, but I am still missing my .desktop icons. I have tried to get recovery software but apparently none exit for Linux.

If you've been using the computer for a bit since the incident the accidentally deleted directory is probably long gone. There is recovery software for example: http://www.data-recovery-software.ne...Recovery.shtml I have no idea whether it is any good or not.

You mean icons showing on the desktop, the root window as twer? Don't know but it should be simple - start a program and then drag its icon onto the desktop, that sort of thing.

GrapefruiTgirl 01-14-2010 02:56 PM

Quote:

Originally Posted by MartinKuyu (Post 3826089)
Thanks a lot. Re-installing gnome has at least returned most functionality, but I am still missing my .desktop icons. I have tried to get recovery software but apparently none exit for Linux.

Desktop icons are probably not even worth the effort of trying to recover them, but for the record, there ARE recovery tools for Linux, including PhotoRec, Test-disk (I think that's a recovery tool, if not an assistant), and Recover, to name a few. Of course, using any given tool for recovery, is influenced by (A) how much use the machine has had since the loss, and (B) what filesystem is in question.

Sasha

MartinKuyu 01-14-2010 03:33 PM

...Thanks for all the help. Al least functionality has been restored and i can use my root account.


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