Accidentally deleted everything from a directory on my Macbook using terminalWhat tools exist to recover a file I clobbered using cpp in terminal?How can I do a fresh install of OSX Mountain Lion onto my SSD for my Macbook?Restore Mac from Time Machine Backup via TerminalOSX: How to backup personal data via CLI script or commandHow can I move files or directories marked as a backup?Can Time Machine restore an erased drive?Does Time Machine back up potentially corrupted files?Cannot restore Time Machine backup to internal HDDUsing mv to rename files on terminal ended up with lost filesHow can change broken file permissions of Time Machine backups?
8086 stack segment and avoiding overflow in interrupts
Why did I lose on time with 3 pawns vs Knight. Shouldn't it be a draw?
How does a poisoned arrow combine with the spell Conjure Barrage?
If you inherit a Roth 401(k), is it taxed?
What would the United Kingdom's "optimal" Brexit deal look like?
Should I intervene when a colleague in a different department makes students run laps as part of their grade?
Why would an invisible personal shield be necessary?
Do 3/8 (37.5%) of Quadratics Have No x-Intercepts?
Just how much information should you share with a former client?
What is more environmentally friendly? An A320 or a car?
Microgravity indicators
How to store my pliers and wire cutters on my desk?
Why does the Eurostar not show youth pricing?
Why did House of Representatives need to condemn Trumps Tweets?
Boots or trail runners with reference to blisters?
Convert graph format for Mathematica graph functions
Polynomial satisfying a relation for all positive integers
Piece of chess engine, which accomplishes move generation
What is the reason for cards stating "Until end of turn, you don't lose this mana as steps and phases end"?
How to have poached eggs in "sphere form"?
What force enables us to walk? Friction or normal reaction?
90s/2000s TV show : man uses government time machine to fix national problems
Self-deportation of American Citizens from US
Is there an antonym (a complementary antonym) for "spicy" or "hot" regarding food (I DO NOT mean "seasoned", but "hot")?
Accidentally deleted everything from a directory on my Macbook using terminal
What tools exist to recover a file I clobbered using cpp in terminal?How can I do a fresh install of OSX Mountain Lion onto my SSD for my Macbook?Restore Mac from Time Machine Backup via TerminalOSX: How to backup personal data via CLI script or commandHow can I move files or directories marked as a backup?Can Time Machine restore an erased drive?Does Time Machine back up potentially corrupted files?Cannot restore Time Machine backup to internal HDDUsing mv to rename files on terminal ended up with lost filesHow can change broken file permissions of Time Machine backups?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I accidentally did a rm -rf *
on a wrong directory on my macbook terminal. It appears that the rm
command operates just like on a Linux system, where it's irreversible.
But I did back up my Mac to my external HDD so I can restore it using Time Machine, but I wanted to see if anyone knows of another, preferably quicker way to get all of my files back in the directory I used the above command in?
macbook terminal time-machine trash
add a comment |
I accidentally did a rm -rf *
on a wrong directory on my macbook terminal. It appears that the rm
command operates just like on a Linux system, where it's irreversible.
But I did back up my Mac to my external HDD so I can restore it using Time Machine, but I wanted to see if anyone knows of another, preferably quicker way to get all of my files back in the directory I used the above command in?
macbook terminal time-machine trash
add a comment |
I accidentally did a rm -rf *
on a wrong directory on my macbook terminal. It appears that the rm
command operates just like on a Linux system, where it's irreversible.
But I did back up my Mac to my external HDD so I can restore it using Time Machine, but I wanted to see if anyone knows of another, preferably quicker way to get all of my files back in the directory I used the above command in?
macbook terminal time-machine trash
I accidentally did a rm -rf *
on a wrong directory on my macbook terminal. It appears that the rm
command operates just like on a Linux system, where it's irreversible.
But I did back up my Mac to my external HDD so I can restore it using Time Machine, but I wanted to see if anyone knows of another, preferably quicker way to get all of my files back in the directory I used the above command in?
macbook terminal time-machine trash
macbook terminal time-machine trash
asked 9 hours ago
IamanonIamanon
373 bronze badges
373 bronze badges
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
Restoring from backup is the way to go here, there is no magic „undo rm -rf“ command.
add a comment |
You do not need to restore your whole machine. You need to restore only one folder. Time machine is much faster than I assume. Seems like a big deal to me since I've been trained never to relay on backup.
Just crank up Time Machine and copy the folder, in which you deleted all the content, back to where ever you had it. I had to go back a level in TimeMachine's display before the restore button became active.
Of course, you you could be missing the absolute latest changes.
Pick what folder you want to restore. I picked my numbers folder.
result:
PS:
I do not recommend deleting directories from the terminal. It's safer from finder. I've added the following alias to my bash profile.
alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -i'
Run these as see how they go. Once you have establish they are delete the correct files, use control + c to quit. Then repeat with a backslash in front of the command to nix the alias version of the command. Aliases do not hold with sudo.
add a comment |
Copying from a backup is much more efficient than anything. If you want to take the hard route, stop using your operating system immediately and look into using testdisk on it from an external OS installation.
For backing up from your time machine drive do the following:
Plug in your time machine backup, and then open up terminal.
Open up two finder windows. In one window, navigate to the deleted directory on your local hard drive. In the other finder window, navigate to the same directory (your backup copy) in the time machine hard drive.
Go back to terminal and type:cp -R
then go to your time machine directory folder that is your backup copy, and drag it to the terminal. For example if you did rm -rf* ~/Downloads/
or rm -rf* /Users/Myhomefolder/Downloads/
your terminal should now look like this:
$`cp -R /Volumes/TimeMachineHD/Users/Myhomefolder/Downloads`
then enter /*
and a space.
Next drag go to the original deleted directory in your local drive using finder, and drag that folder to the terminal.
your terminal should now look like this:
$cp -R /Volumes/TimeMachineHD/Users/Myhomefolder/Downloads/* /Users/Myhomefoldername/Downloads
then press backspace to line your curser next to the last letter in the terminal, and type /
.
The final command in your terminal should look like this:
$cp -R /Volumes/TimeMachineHD/Users/Myhomefolder/Downloads/* /Users/Myhomefoldername/Downloads/
If you originally deleted a protected folder in root, the be sure to enter $sudo
in the terminal before entering the command.
Be sure you have the correct command and directories, then press enter to run the command. The back up will now copy to your hard drive.
Are you sure about the paths on the TimeMachine volume, shouldn’t there be a version/date in it? Also, restoring via command line copies any extended attributes added by Time Machine back onto your main drive which you should remove afterwards to avoid strange access/permission issues later on.
– nohillside♦
2 hours ago
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Restoring from backup is the way to go here, there is no magic „undo rm -rf“ command.
add a comment |
Restoring from backup is the way to go here, there is no magic „undo rm -rf“ command.
add a comment |
Restoring from backup is the way to go here, there is no magic „undo rm -rf“ command.
Restoring from backup is the way to go here, there is no magic „undo rm -rf“ command.
answered 9 hours ago
nohillside♦nohillside
55.5k14 gold badges116 silver badges165 bronze badges
55.5k14 gold badges116 silver badges165 bronze badges
add a comment |
add a comment |
You do not need to restore your whole machine. You need to restore only one folder. Time machine is much faster than I assume. Seems like a big deal to me since I've been trained never to relay on backup.
Just crank up Time Machine and copy the folder, in which you deleted all the content, back to where ever you had it. I had to go back a level in TimeMachine's display before the restore button became active.
Of course, you you could be missing the absolute latest changes.
Pick what folder you want to restore. I picked my numbers folder.
result:
PS:
I do not recommend deleting directories from the terminal. It's safer from finder. I've added the following alias to my bash profile.
alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -i'
Run these as see how they go. Once you have establish they are delete the correct files, use control + c to quit. Then repeat with a backslash in front of the command to nix the alias version of the command. Aliases do not hold with sudo.
add a comment |
You do not need to restore your whole machine. You need to restore only one folder. Time machine is much faster than I assume. Seems like a big deal to me since I've been trained never to relay on backup.
Just crank up Time Machine and copy the folder, in which you deleted all the content, back to where ever you had it. I had to go back a level in TimeMachine's display before the restore button became active.
Of course, you you could be missing the absolute latest changes.
Pick what folder you want to restore. I picked my numbers folder.
result:
PS:
I do not recommend deleting directories from the terminal. It's safer from finder. I've added the following alias to my bash profile.
alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -i'
Run these as see how they go. Once you have establish they are delete the correct files, use control + c to quit. Then repeat with a backslash in front of the command to nix the alias version of the command. Aliases do not hold with sudo.
add a comment |
You do not need to restore your whole machine. You need to restore only one folder. Time machine is much faster than I assume. Seems like a big deal to me since I've been trained never to relay on backup.
Just crank up Time Machine and copy the folder, in which you deleted all the content, back to where ever you had it. I had to go back a level in TimeMachine's display before the restore button became active.
Of course, you you could be missing the absolute latest changes.
Pick what folder you want to restore. I picked my numbers folder.
result:
PS:
I do not recommend deleting directories from the terminal. It's safer from finder. I've added the following alias to my bash profile.
alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -i'
Run these as see how they go. Once you have establish they are delete the correct files, use control + c to quit. Then repeat with a backslash in front of the command to nix the alias version of the command. Aliases do not hold with sudo.
You do not need to restore your whole machine. You need to restore only one folder. Time machine is much faster than I assume. Seems like a big deal to me since I've been trained never to relay on backup.
Just crank up Time Machine and copy the folder, in which you deleted all the content, back to where ever you had it. I had to go back a level in TimeMachine's display before the restore button became active.
Of course, you you could be missing the absolute latest changes.
Pick what folder you want to restore. I picked my numbers folder.
result:
PS:
I do not recommend deleting directories from the terminal. It's safer from finder. I've added the following alias to my bash profile.
alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -i'
Run these as see how they go. Once you have establish they are delete the correct files, use control + c to quit. Then repeat with a backslash in front of the command to nix the alias version of the command. Aliases do not hold with sudo.
edited 8 hours ago
answered 8 hours ago
historystamphistorystamp
1,2597 silver badges11 bronze badges
1,2597 silver badges11 bronze badges
add a comment |
add a comment |
Copying from a backup is much more efficient than anything. If you want to take the hard route, stop using your operating system immediately and look into using testdisk on it from an external OS installation.
For backing up from your time machine drive do the following:
Plug in your time machine backup, and then open up terminal.
Open up two finder windows. In one window, navigate to the deleted directory on your local hard drive. In the other finder window, navigate to the same directory (your backup copy) in the time machine hard drive.
Go back to terminal and type:cp -R
then go to your time machine directory folder that is your backup copy, and drag it to the terminal. For example if you did rm -rf* ~/Downloads/
or rm -rf* /Users/Myhomefolder/Downloads/
your terminal should now look like this:
$`cp -R /Volumes/TimeMachineHD/Users/Myhomefolder/Downloads`
then enter /*
and a space.
Next drag go to the original deleted directory in your local drive using finder, and drag that folder to the terminal.
your terminal should now look like this:
$cp -R /Volumes/TimeMachineHD/Users/Myhomefolder/Downloads/* /Users/Myhomefoldername/Downloads
then press backspace to line your curser next to the last letter in the terminal, and type /
.
The final command in your terminal should look like this:
$cp -R /Volumes/TimeMachineHD/Users/Myhomefolder/Downloads/* /Users/Myhomefoldername/Downloads/
If you originally deleted a protected folder in root, the be sure to enter $sudo
in the terminal before entering the command.
Be sure you have the correct command and directories, then press enter to run the command. The back up will now copy to your hard drive.
Are you sure about the paths on the TimeMachine volume, shouldn’t there be a version/date in it? Also, restoring via command line copies any extended attributes added by Time Machine back onto your main drive which you should remove afterwards to avoid strange access/permission issues later on.
– nohillside♦
2 hours ago
add a comment |
Copying from a backup is much more efficient than anything. If you want to take the hard route, stop using your operating system immediately and look into using testdisk on it from an external OS installation.
For backing up from your time machine drive do the following:
Plug in your time machine backup, and then open up terminal.
Open up two finder windows. In one window, navigate to the deleted directory on your local hard drive. In the other finder window, navigate to the same directory (your backup copy) in the time machine hard drive.
Go back to terminal and type:cp -R
then go to your time machine directory folder that is your backup copy, and drag it to the terminal. For example if you did rm -rf* ~/Downloads/
or rm -rf* /Users/Myhomefolder/Downloads/
your terminal should now look like this:
$`cp -R /Volumes/TimeMachineHD/Users/Myhomefolder/Downloads`
then enter /*
and a space.
Next drag go to the original deleted directory in your local drive using finder, and drag that folder to the terminal.
your terminal should now look like this:
$cp -R /Volumes/TimeMachineHD/Users/Myhomefolder/Downloads/* /Users/Myhomefoldername/Downloads
then press backspace to line your curser next to the last letter in the terminal, and type /
.
The final command in your terminal should look like this:
$cp -R /Volumes/TimeMachineHD/Users/Myhomefolder/Downloads/* /Users/Myhomefoldername/Downloads/
If you originally deleted a protected folder in root, the be sure to enter $sudo
in the terminal before entering the command.
Be sure you have the correct command and directories, then press enter to run the command. The back up will now copy to your hard drive.
Are you sure about the paths on the TimeMachine volume, shouldn’t there be a version/date in it? Also, restoring via command line copies any extended attributes added by Time Machine back onto your main drive which you should remove afterwards to avoid strange access/permission issues later on.
– nohillside♦
2 hours ago
add a comment |
Copying from a backup is much more efficient than anything. If you want to take the hard route, stop using your operating system immediately and look into using testdisk on it from an external OS installation.
For backing up from your time machine drive do the following:
Plug in your time machine backup, and then open up terminal.
Open up two finder windows. In one window, navigate to the deleted directory on your local hard drive. In the other finder window, navigate to the same directory (your backup copy) in the time machine hard drive.
Go back to terminal and type:cp -R
then go to your time machine directory folder that is your backup copy, and drag it to the terminal. For example if you did rm -rf* ~/Downloads/
or rm -rf* /Users/Myhomefolder/Downloads/
your terminal should now look like this:
$`cp -R /Volumes/TimeMachineHD/Users/Myhomefolder/Downloads`
then enter /*
and a space.
Next drag go to the original deleted directory in your local drive using finder, and drag that folder to the terminal.
your terminal should now look like this:
$cp -R /Volumes/TimeMachineHD/Users/Myhomefolder/Downloads/* /Users/Myhomefoldername/Downloads
then press backspace to line your curser next to the last letter in the terminal, and type /
.
The final command in your terminal should look like this:
$cp -R /Volumes/TimeMachineHD/Users/Myhomefolder/Downloads/* /Users/Myhomefoldername/Downloads/
If you originally deleted a protected folder in root, the be sure to enter $sudo
in the terminal before entering the command.
Be sure you have the correct command and directories, then press enter to run the command. The back up will now copy to your hard drive.
Copying from a backup is much more efficient than anything. If you want to take the hard route, stop using your operating system immediately and look into using testdisk on it from an external OS installation.
For backing up from your time machine drive do the following:
Plug in your time machine backup, and then open up terminal.
Open up two finder windows. In one window, navigate to the deleted directory on your local hard drive. In the other finder window, navigate to the same directory (your backup copy) in the time machine hard drive.
Go back to terminal and type:cp -R
then go to your time machine directory folder that is your backup copy, and drag it to the terminal. For example if you did rm -rf* ~/Downloads/
or rm -rf* /Users/Myhomefolder/Downloads/
your terminal should now look like this:
$`cp -R /Volumes/TimeMachineHD/Users/Myhomefolder/Downloads`
then enter /*
and a space.
Next drag go to the original deleted directory in your local drive using finder, and drag that folder to the terminal.
your terminal should now look like this:
$cp -R /Volumes/TimeMachineHD/Users/Myhomefolder/Downloads/* /Users/Myhomefoldername/Downloads
then press backspace to line your curser next to the last letter in the terminal, and type /
.
The final command in your terminal should look like this:
$cp -R /Volumes/TimeMachineHD/Users/Myhomefolder/Downloads/* /Users/Myhomefoldername/Downloads/
If you originally deleted a protected folder in root, the be sure to enter $sudo
in the terminal before entering the command.
Be sure you have the correct command and directories, then press enter to run the command. The back up will now copy to your hard drive.
answered 7 hours ago
DanRanDanRan
1798 bronze badges
1798 bronze badges
Are you sure about the paths on the TimeMachine volume, shouldn’t there be a version/date in it? Also, restoring via command line copies any extended attributes added by Time Machine back onto your main drive which you should remove afterwards to avoid strange access/permission issues later on.
– nohillside♦
2 hours ago
add a comment |
Are you sure about the paths on the TimeMachine volume, shouldn’t there be a version/date in it? Also, restoring via command line copies any extended attributes added by Time Machine back onto your main drive which you should remove afterwards to avoid strange access/permission issues later on.
– nohillside♦
2 hours ago
Are you sure about the paths on the TimeMachine volume, shouldn’t there be a version/date in it? Also, restoring via command line copies any extended attributes added by Time Machine back onto your main drive which you should remove afterwards to avoid strange access/permission issues later on.
– nohillside♦
2 hours ago
Are you sure about the paths on the TimeMachine volume, shouldn’t there be a version/date in it? Also, restoring via command line copies any extended attributes added by Time Machine back onto your main drive which you should remove afterwards to avoid strange access/permission issues later on.
– nohillside♦
2 hours ago
add a comment |