LinuxQuestions.org
Visit Jeremy's Blog.
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 06-14-2019, 08:26 PM   #1
Sergeyav
LQ Newbie
 
Registered: Jan 2019
Posts: 5

Rep: Reputation: Disabled
Lubuntu: The unwanted delete of all main and sub-folders from Home directory, how to fix


In short, Having problem with emptying trash folder, I have followed the post "Cannot empty trash" by Lawrence. Here it is:

delete the contents of the .trash folder as superuser

#locate .trash

#cd /whatever/.trash
#sudo rm -rf *
#sudo rm -rf *.*
__________________
Prof(Miss) A. Mani
CU, ASL, IRSS, CLC, AMS, CMS
http://www.logicamani.in

My problem is that with deleting all files in the Trash folder the system also deleted all main Folders such as Documents, Downloads, Music, Pictures and so forth. Now I see only Desktop Folder in the window of the Files Manager. Trying to fix, I updated all packages with Muon Package Manager but the problem was not solved. Then, I tried to fix it with DPKG solution from boot menu but Lubuntu doesn't launch it on start. Can anyone help me bringing back Documents and others folders?

Last edited by Sergeyav; 06-14-2019 at 08:37 PM.
 
Old 06-14-2019, 08:31 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,311
Blog Entries: 28

Rep: Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137Reputation: 6137
I've never had to use it, but Photorec may be able to help.

Read the documentation carefully.
 
Old 06-14-2019, 08:42 PM   #3
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,725

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
The last time I did that, I created a new user, then cp -r the directories to the corrupted user's /home/
Made sure the ownership and permissions were correct for the old user, then removed the new user.

That didn't restore any documents, etc, tho. I had to recover those from off-site backups, but it was important to rebuild the directory structure quickly in my case.

I've since pretty much stopped using the -f option to rm. Yes, I have to acknowledge the deletion of each file, but that's less tedious than recovering lost data...I also backup more frequently (daily!) now
 
Old 06-15-2019, 03:10 AM   #4
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by Sergeyav View Post
In short, Having problem with emptying trash folder, I have followed the post "Cannot empty trash" by Lawrence. Here it is:

delete the contents of the .trash folder as superuser

#locate .trash

#cd /whatever/.trash
#sudo rm -rf *
#sudo rm -rf *.*
__________________

My problem is that with deleting all files in the Trash folder the system also deleted all main Folders such as Documents, Downloads, Music, Pictures and so forth.
may this be a leesson why
a) people giving instructions on forums should be very clear about it, esp. when 'sudo rm' and such is involved
b) one should not copy-paste instructions into one's own terminal without knowing what they do, esp. when sudo is onvolved
 
1 members found this post helpful.
Old 06-15-2019, 11:47 AM   #5
Sergeyav
LQ Newbie
 
Registered: Jan 2019
Posts: 5

Original Poster
Rep: Reputation: Disabled
Lubuntu: The unwanted delete of all main and sub-folders from Home directory, how to fix

Thanks for replies. I am not sure that Photorec helps. I will try to restore my files from backup I have. But would you please to detail how I should to create a new user, ".... then cp -r the directories to the corrupted user's /home/. Made sure the ownership and permissions were correct for the old user, then removed the new user." Sorry for this inquiry for I am not advanced. Sergeyav
 
Old 06-15-2019, 02:33 PM   #6
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
If you lost data, the very first thing you do is STOP USING THE DISK.
Then you boot some Live Rescue Linux (e.g. this one) and let extundelete and/or testdisk/photorec do their thing.
But please read the wiki first.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to search through contents of .csv and .txt files in folders and sub-folders grumpyskeptic Linux - Software 6 03-04-2018 05:57 AM
submit the job script from the main directory for all sub directories homayoonv66 Linux - Newbie 2 03-23-2016 07:15 PM
The event->name (inotify) prints all the sub-directories - not the main directory MichaelStein Programming 5 06-22-2014 06:04 AM
Shell Script to compare folders,Sub-Folders and Sub-Sub-Folders unix_72427 Programming 8 08-08-2012 02:51 PM
change permissions of all folders and sub folders cad Linux - General 3 01-28-2007 10:21 AM

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

All times are GMT -5. The time now is 05:54 AM.

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