How can I recover my files and my system after running rm -r /home/username? [duplicate]











up vote
1
down vote

favorite













This question already has an answer here:




  • How to recover deleted files?

    11 answers



  • Can files/directories deleted with rm be restored?

    7 answers




I am new to Linux & was running some random commands to experiment in terminal (Ubuntu-18.04 LTS) & by mistake I deleted my home directory.



The command I executed is shown in the screenshot of my history below. It was



rm -r /home/dawn


Now all my files are gone, as well as the default folders such as Pictures, Desktop, Screenshots, etc & my desktop screen has turned dark black.



When I tried to open the files icon, it's giving me an error.



Can anyone help me on this?



command history



unable to find the requested file










share|improve this question









New contributor




Krishnendu Dawn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











marked as duplicate by user535733, karel, Melebius, muru command-line
Users with the  command-line badge can single-handedly close command-line questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
2 days ago


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.











  • 1




    Have you check your trash folder so you should be able to access it fromthe terminal using the commands in the following link: askubuntu.com/questions/327943/…
    – Graham
    Nov 20 at 15:05










  • try this one !!
    – abu-ahmed al-khatiri
    Nov 20 at 15:22






  • 1




    follow the steps outlined here askubuntu.com/a/150673/18025 essentially reboot your machine using the same install medium you used to install ubuntu ( memory stick or DVD) then issue outlined commands
    – Scott Stensland
    Nov 20 at 15:26






  • 1




    @Graham if OP deleted $HOME how will they be able to access ~/.local/share/Trash from the linked post? Also OP, I am curious why you would rm -r $HOME? I would suggest using a vm if you are going to experiment with dangerous commands like what you did. That being said there is this cgsecurity.org/wiki/TestDisk
    – j-money
    Nov 20 at 17:08










  • Understood........
    – Krishnendu Dawn
    2 days ago















up vote
1
down vote

favorite













This question already has an answer here:




  • How to recover deleted files?

    11 answers



  • Can files/directories deleted with rm be restored?

    7 answers




I am new to Linux & was running some random commands to experiment in terminal (Ubuntu-18.04 LTS) & by mistake I deleted my home directory.



The command I executed is shown in the screenshot of my history below. It was



rm -r /home/dawn


Now all my files are gone, as well as the default folders such as Pictures, Desktop, Screenshots, etc & my desktop screen has turned dark black.



When I tried to open the files icon, it's giving me an error.



Can anyone help me on this?



command history



unable to find the requested file










share|improve this question









New contributor




Krishnendu Dawn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











marked as duplicate by user535733, karel, Melebius, muru command-line
Users with the  command-line badge can single-handedly close command-line questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
2 days ago


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.











  • 1




    Have you check your trash folder so you should be able to access it fromthe terminal using the commands in the following link: askubuntu.com/questions/327943/…
    – Graham
    Nov 20 at 15:05










  • try this one !!
    – abu-ahmed al-khatiri
    Nov 20 at 15:22






  • 1




    follow the steps outlined here askubuntu.com/a/150673/18025 essentially reboot your machine using the same install medium you used to install ubuntu ( memory stick or DVD) then issue outlined commands
    – Scott Stensland
    Nov 20 at 15:26






  • 1




    @Graham if OP deleted $HOME how will they be able to access ~/.local/share/Trash from the linked post? Also OP, I am curious why you would rm -r $HOME? I would suggest using a vm if you are going to experiment with dangerous commands like what you did. That being said there is this cgsecurity.org/wiki/TestDisk
    – j-money
    Nov 20 at 17:08










  • Understood........
    – Krishnendu Dawn
    2 days ago













up vote
1
down vote

favorite









up vote
1
down vote

favorite












This question already has an answer here:




  • How to recover deleted files?

    11 answers



  • Can files/directories deleted with rm be restored?

    7 answers




I am new to Linux & was running some random commands to experiment in terminal (Ubuntu-18.04 LTS) & by mistake I deleted my home directory.



The command I executed is shown in the screenshot of my history below. It was



rm -r /home/dawn


Now all my files are gone, as well as the default folders such as Pictures, Desktop, Screenshots, etc & my desktop screen has turned dark black.



When I tried to open the files icon, it's giving me an error.



Can anyone help me on this?



command history



unable to find the requested file










share|improve this question









New contributor




Krishnendu Dawn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












This question already has an answer here:




  • How to recover deleted files?

    11 answers



  • Can files/directories deleted with rm be restored?

    7 answers




I am new to Linux & was running some random commands to experiment in terminal (Ubuntu-18.04 LTS) & by mistake I deleted my home directory.



The command I executed is shown in the screenshot of my history below. It was



rm -r /home/dawn


Now all my files are gone, as well as the default folders such as Pictures, Desktop, Screenshots, etc & my desktop screen has turned dark black.



When I tried to open the files icon, it's giving me an error.



Can anyone help me on this?



command history



unable to find the requested file





This question already has an answer here:




  • How to recover deleted files?

    11 answers



  • Can files/directories deleted with rm be restored?

    7 answers








command-line data-recovery home-directory






share|improve this question









New contributor




Krishnendu Dawn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Krishnendu Dawn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 2 days ago









Zanna

49k13123234




49k13123234






New contributor




Krishnendu Dawn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 20 at 14:29









Krishnendu Dawn

61




61




New contributor




Krishnendu Dawn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Krishnendu Dawn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Krishnendu Dawn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




marked as duplicate by user535733, karel, Melebius, muru command-line
Users with the  command-line badge can single-handedly close command-line questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
2 days ago


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by user535733, karel, Melebius, muru command-line
Users with the  command-line badge can single-handedly close command-line questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
2 days ago


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 1




    Have you check your trash folder so you should be able to access it fromthe terminal using the commands in the following link: askubuntu.com/questions/327943/…
    – Graham
    Nov 20 at 15:05










  • try this one !!
    – abu-ahmed al-khatiri
    Nov 20 at 15:22






  • 1




    follow the steps outlined here askubuntu.com/a/150673/18025 essentially reboot your machine using the same install medium you used to install ubuntu ( memory stick or DVD) then issue outlined commands
    – Scott Stensland
    Nov 20 at 15:26






  • 1




    @Graham if OP deleted $HOME how will they be able to access ~/.local/share/Trash from the linked post? Also OP, I am curious why you would rm -r $HOME? I would suggest using a vm if you are going to experiment with dangerous commands like what you did. That being said there is this cgsecurity.org/wiki/TestDisk
    – j-money
    Nov 20 at 17:08










  • Understood........
    – Krishnendu Dawn
    2 days ago














  • 1




    Have you check your trash folder so you should be able to access it fromthe terminal using the commands in the following link: askubuntu.com/questions/327943/…
    – Graham
    Nov 20 at 15:05










  • try this one !!
    – abu-ahmed al-khatiri
    Nov 20 at 15:22






  • 1




    follow the steps outlined here askubuntu.com/a/150673/18025 essentially reboot your machine using the same install medium you used to install ubuntu ( memory stick or DVD) then issue outlined commands
    – Scott Stensland
    Nov 20 at 15:26






  • 1




    @Graham if OP deleted $HOME how will they be able to access ~/.local/share/Trash from the linked post? Also OP, I am curious why you would rm -r $HOME? I would suggest using a vm if you are going to experiment with dangerous commands like what you did. That being said there is this cgsecurity.org/wiki/TestDisk
    – j-money
    Nov 20 at 17:08










  • Understood........
    – Krishnendu Dawn
    2 days ago








1




1




Have you check your trash folder so you should be able to access it fromthe terminal using the commands in the following link: askubuntu.com/questions/327943/…
– Graham
Nov 20 at 15:05




Have you check your trash folder so you should be able to access it fromthe terminal using the commands in the following link: askubuntu.com/questions/327943/…
– Graham
Nov 20 at 15:05












try this one !!
– abu-ahmed al-khatiri
Nov 20 at 15:22




try this one !!
– abu-ahmed al-khatiri
Nov 20 at 15:22




1




1




follow the steps outlined here askubuntu.com/a/150673/18025 essentially reboot your machine using the same install medium you used to install ubuntu ( memory stick or DVD) then issue outlined commands
– Scott Stensland
Nov 20 at 15:26




follow the steps outlined here askubuntu.com/a/150673/18025 essentially reboot your machine using the same install medium you used to install ubuntu ( memory stick or DVD) then issue outlined commands
– Scott Stensland
Nov 20 at 15:26




1




1




@Graham if OP deleted $HOME how will they be able to access ~/.local/share/Trash from the linked post? Also OP, I am curious why you would rm -r $HOME? I would suggest using a vm if you are going to experiment with dangerous commands like what you did. That being said there is this cgsecurity.org/wiki/TestDisk
– j-money
Nov 20 at 17:08




@Graham if OP deleted $HOME how will they be able to access ~/.local/share/Trash from the linked post? Also OP, I am curious why you would rm -r $HOME? I would suggest using a vm if you are going to experiment with dangerous commands like what you did. That being said there is this cgsecurity.org/wiki/TestDisk
– j-money
Nov 20 at 17:08












Understood........
– Krishnendu Dawn
2 days ago




Understood........
– Krishnendu Dawn
2 days ago










2 Answers
2






active

oldest

votes

















up vote
0
down vote














  • If you lost some important data try to recover with 'testdisc'.


  • If no important data is lost and you can boot. Go to settings>Details>Users unlock and add another user with Administrative powers, set password and login again or reboot. Login as new user from there you can delete the previous user.



I wonder why you did it.






share|improve this answer



















  • 1




    how will that recover the files?
    – Graham
    Nov 20 at 15:13










  • It was an experiment
    – Krishnendu Dawn
    2 days ago


















up vote
0
down vote













If your account was new (without any important/personal files) just re-create your home:




  1. Log out current user from GUI.

  2. Switch to text console by pressing eg. Ctrl+Alt+F1.


  3. Copy fresh user base files and change its ownership:



    sudo cp -r /etc/skel $HOME
    sudo chown `id -u`.`id -g` $HOME


    Or:



    sudo mkhomedir_helper $USER


  4. Log user again to GUI, your additional dirs will be recreated (Desktop, Pictures etc. - according to /etc/xdg/user-dirs*).







share|improve this answer























  • @Zanna there is no $HOME/, it was deleted...
    – madneon
    2 days ago










  • You are right haha so just that command should do it I think
    – Zanna
    2 days ago










  • Thanks, this is already done.
    – Krishnendu Dawn
    2 days ago


















2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote














  • If you lost some important data try to recover with 'testdisc'.


  • If no important data is lost and you can boot. Go to settings>Details>Users unlock and add another user with Administrative powers, set password and login again or reboot. Login as new user from there you can delete the previous user.



I wonder why you did it.






share|improve this answer



















  • 1




    how will that recover the files?
    – Graham
    Nov 20 at 15:13










  • It was an experiment
    – Krishnendu Dawn
    2 days ago















up vote
0
down vote














  • If you lost some important data try to recover with 'testdisc'.


  • If no important data is lost and you can boot. Go to settings>Details>Users unlock and add another user with Administrative powers, set password and login again or reboot. Login as new user from there you can delete the previous user.



I wonder why you did it.






share|improve this answer



















  • 1




    how will that recover the files?
    – Graham
    Nov 20 at 15:13










  • It was an experiment
    – Krishnendu Dawn
    2 days ago













up vote
0
down vote










up vote
0
down vote










  • If you lost some important data try to recover with 'testdisc'.


  • If no important data is lost and you can boot. Go to settings>Details>Users unlock and add another user with Administrative powers, set password and login again or reboot. Login as new user from there you can delete the previous user.



I wonder why you did it.






share|improve this answer















  • If you lost some important data try to recover with 'testdisc'.


  • If no important data is lost and you can boot. Go to settings>Details>Users unlock and add another user with Administrative powers, set password and login again or reboot. Login as new user from there you can delete the previous user.



I wonder why you did it.







share|improve this answer














share|improve this answer



share|improve this answer








edited 2 days ago

























answered Nov 20 at 15:10









Hobbyist

989617




989617








  • 1




    how will that recover the files?
    – Graham
    Nov 20 at 15:13










  • It was an experiment
    – Krishnendu Dawn
    2 days ago














  • 1




    how will that recover the files?
    – Graham
    Nov 20 at 15:13










  • It was an experiment
    – Krishnendu Dawn
    2 days ago








1




1




how will that recover the files?
– Graham
Nov 20 at 15:13




how will that recover the files?
– Graham
Nov 20 at 15:13












It was an experiment
– Krishnendu Dawn
2 days ago




It was an experiment
– Krishnendu Dawn
2 days ago












up vote
0
down vote













If your account was new (without any important/personal files) just re-create your home:




  1. Log out current user from GUI.

  2. Switch to text console by pressing eg. Ctrl+Alt+F1.


  3. Copy fresh user base files and change its ownership:



    sudo cp -r /etc/skel $HOME
    sudo chown `id -u`.`id -g` $HOME


    Or:



    sudo mkhomedir_helper $USER


  4. Log user again to GUI, your additional dirs will be recreated (Desktop, Pictures etc. - according to /etc/xdg/user-dirs*).







share|improve this answer























  • @Zanna there is no $HOME/, it was deleted...
    – madneon
    2 days ago










  • You are right haha so just that command should do it I think
    – Zanna
    2 days ago










  • Thanks, this is already done.
    – Krishnendu Dawn
    2 days ago















up vote
0
down vote













If your account was new (without any important/personal files) just re-create your home:




  1. Log out current user from GUI.

  2. Switch to text console by pressing eg. Ctrl+Alt+F1.


  3. Copy fresh user base files and change its ownership:



    sudo cp -r /etc/skel $HOME
    sudo chown `id -u`.`id -g` $HOME


    Or:



    sudo mkhomedir_helper $USER


  4. Log user again to GUI, your additional dirs will be recreated (Desktop, Pictures etc. - according to /etc/xdg/user-dirs*).







share|improve this answer























  • @Zanna there is no $HOME/, it was deleted...
    – madneon
    2 days ago










  • You are right haha so just that command should do it I think
    – Zanna
    2 days ago










  • Thanks, this is already done.
    – Krishnendu Dawn
    2 days ago













up vote
0
down vote










up vote
0
down vote









If your account was new (without any important/personal files) just re-create your home:




  1. Log out current user from GUI.

  2. Switch to text console by pressing eg. Ctrl+Alt+F1.


  3. Copy fresh user base files and change its ownership:



    sudo cp -r /etc/skel $HOME
    sudo chown `id -u`.`id -g` $HOME


    Or:



    sudo mkhomedir_helper $USER


  4. Log user again to GUI, your additional dirs will be recreated (Desktop, Pictures etc. - according to /etc/xdg/user-dirs*).







share|improve this answer














If your account was new (without any important/personal files) just re-create your home:




  1. Log out current user from GUI.

  2. Switch to text console by pressing eg. Ctrl+Alt+F1.


  3. Copy fresh user base files and change its ownership:



    sudo cp -r /etc/skel $HOME
    sudo chown `id -u`.`id -g` $HOME


    Or:



    sudo mkhomedir_helper $USER


  4. Log user again to GUI, your additional dirs will be recreated (Desktop, Pictures etc. - according to /etc/xdg/user-dirs*).








share|improve this answer














share|improve this answer



share|improve this answer








edited yesterday

























answered 2 days ago









madneon

1,4181620




1,4181620












  • @Zanna there is no $HOME/, it was deleted...
    – madneon
    2 days ago










  • You are right haha so just that command should do it I think
    – Zanna
    2 days ago










  • Thanks, this is already done.
    – Krishnendu Dawn
    2 days ago


















  • @Zanna there is no $HOME/, it was deleted...
    – madneon
    2 days ago










  • You are right haha so just that command should do it I think
    – Zanna
    2 days ago










  • Thanks, this is already done.
    – Krishnendu Dawn
    2 days ago
















@Zanna there is no $HOME/, it was deleted...
– madneon
2 days ago




@Zanna there is no $HOME/, it was deleted...
– madneon
2 days ago












You are right haha so just that command should do it I think
– Zanna
2 days ago




You are right haha so just that command should do it I think
– Zanna
2 days ago












Thanks, this is already done.
– Krishnendu Dawn
2 days ago




Thanks, this is already done.
– Krishnendu Dawn
2 days ago



Popular posts from this blog

數位音樂下載

格利澤436b

When can things happen in Etherscan, such as the picture below?