Loss Home Directory because of Terminal

Joined
Jan 10, 2010
Messages
7
Reaction score
0
Points
1
He,

I am having a really hard time with this issue and haven't found any answers yet on the internet and forums online

this happened approx 2 weeks ago

As you may all know you cannot delete locked files like you delete normal files, so I wanted to delete my locked files with Terminal, after typing the whole code I needed to type I [apparantly] made an mistake there. I typed my home directory name as Hatice coskun in stead of Hatice. And then it took longer than normal to delete those files. As i kept waiting it still was busy and I suddenly saw some files getting removed on my desktop. I got scared and force- shut down my mac, when opened and logged in my whole home directory was set to standard. My whole document folder was gone and my Movies folder. Al my settings were gone aswell. (mouse, internet, itunes, dock, evertyhing!)

I knew if i didn't shut down the mac by force it would've deleted my pictures and music folder aswell. [wich were the only ones unharmed]

I don't know what to do. All my schoolfiles were in that folder.

After doing much research on the internet I found out that my files are not really gone, but hidden. I went to MAc OS X harddrive and looked if my gb went up, but it didn't, it was still the same, so the files are still somewhere in my computer, but i cannot find them.

I downloaded a program that showes hidden files on my mac but it didn't worked.

I wanted to call the apple store for help but i had to pay 49 euro's + tax if i wanted their help *scratch that*

And i changed my home directory name to the wrong name I typed in terminal to hope i got my filed back but it didn't work.

also, i don't have any external hard disks to be backing up my stuff etc, (after this i am trying to buy one)


So, can anybody please help me?

thank you
 

cwa107


Retired Staff
Joined
Dec 20, 2006
Messages
27,042
Reaction score
812
Points
113
Location
Lake Mary, Florida
Your Mac's Specs
14" MacBook Pro M1 Pro, 16GB RAM, 1TB SSD
Can you tell us what the actual command was that you typed?
 
OP
L
Joined
Jan 10, 2010
Messages
7
Reaction score
0
Points
1
from: You can't empty the Trash or move a file to the Trash

1. Open Terminal. It's located in /Applications/Utilities.

Type: chflags -R nouchg

Note: Type one space (not pictured) after nouchg in the line above, so that it ends in "nouchg ". Do not press Return yet.

2. Double-click the Trash icon in the Dock to reveal the contents of the Trash. If necessary, arrange the Finder window so that a portion of the Terminal window is still visible.
3. Press the Command-A key combination to select all files in the Trash.
4. Drag the files from the Trash to the Terminal window.
Note: This automatically enters the pathname for each file. This eliminates the need to individually empty multiple Trash directories, particularly when multiple disks or volumes are present.
5. Press Return. No special text message will be shown indicating that the command was successful.
6. Empty the Trash.
 

cwa107


Retired Staff
Joined
Dec 20, 2006
Messages
27,042
Reaction score
812
Points
113
Location
Lake Mary, Florida
Your Mac's Specs
14" MacBook Pro M1 Pro, 16GB RAM, 1TB SSD
So, the only command you used was chflags? You weren't using rm or mv?
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
That command should not have deleted any files. As per the man page, "The chflags utility modifies the file flags of the listed files as specified by the flags operand." I'm not familiar with this utility but it doesn't sound like it actually deletes any files - it just modifies them. Did you do anything after executing that command? Did you see all of the Trash contents appear after that command (which you should have seen after step 4) before you hit enter?
 
OP
L
Joined
Jan 10, 2010
Messages
7
Reaction score
0
Points
1
yes i saw all the contents

it could be that I haven't given you the right code for the Terminal
but whatever it was it was an code for deleting locked files in the trashcan
This was the second time I used that code
the first time I used it, nothing went wrong, but now it did..

is there any solution on how to get my files back? Or to see them so I can put it in my document folder i have now?
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
is there any solution on how to get my files back? Or to see them so I can put it in my document folder i have now?
This all depends on how you've deleted them and could depend on how you've used your computer since then. We can't really help you out unless we know exactly how you deleted those files.

I'm not familiar with file recovery for OS X but I found this through Apple's website. I don't know how well it will work though.
 

cwa107


Retired Staff
Joined
Dec 20, 2006
Messages
27,042
Reaction score
812
Points
113
Location
Lake Mary, Florida
Your Mac's Specs
14" MacBook Pro M1 Pro, 16GB RAM, 1TB SSD
This all depends on how you've deleted them and could depend on how you've used your computer since then. We can't really help you out unless we know exactly how you deleted those files.

I'm not familiar with file recovery for OS X but I found this through Apple's website. I don't know how well it will work though.

Yeah, I'd agree. I'm really flying blind here and I think any advice I offer might actually make it worse.
 
OP
L
Joined
Jan 10, 2010
Messages
7
Reaction score
0
Points
1
i've tried that yes, but no file has been found.

Since then I have downloaded couple of things [ mostly applications and such for getting my files back] and nothing more.
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
rm can be quite dangerous if you don't use it properly. How did you use the rm command? If you forget, open up Terminal and keep pushing up to scroll through previous commands until you find the one you entered. Whatever you do, do not push enter again when you see it.
 
OP
L
Joined
Jan 10, 2010
Messages
7
Reaction score
0
Points
1
Last login: Sun Jan 10 11:31:21 on console
h136254:~ hatice$ sudo rm -rf /Users/Hatice Coskun/ .Trash
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
You can't have spaces in commands unless you escape them. By this, I mean you put a slash after them. So, for instance, that command should have looked like: sudo rm -rf /Users/Hatice\ Coskun/.Trash. You could also put it in quotes: sudo rm -rf "/Users/Hatice Coskun/.Trash".

Commands you enter in the Terminal use spaces as separating parameters you can pass to the initial command. For instance, if I wanted to copy ~/file1 to ~/file2, I would enter: cp ~/file1 ~/file2 (~ is short hand for your user home directory). My guess is that your short user name is hatice and as such, you effectively told it the following (since the space wasn't compensated for) - remove all files, recursively and forcefully (this is what the -rf is) in /Users/hatice.

If you want to check to see what your short username is, type: id -un. That will return your short username. This is the username you should be using for directories when executing commands. In fact, it would be easier to substitute ~ for your home directory. For instance, instead of /Users/hatice, simply use ~.

What does id -un return? If it returns hatice, you did in fact tell the rm command to start deleting your home directory.
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
As I mentioned earlier, there is not much I know of file recovery on the Mac. All I can do is diagnose the problem - someone else will have to help you with fixing it. The best thing you can do to ease the recovery process is to minimize, if not cease, writes to the disk (stop saving stuff). The more you write to the disk, the harder it is to recover files.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top