-1

I want to change root directory back to home directory, how can I achieve this?

What I have now:

root@raselkhan:~# pwd
/root

What I had before:

khan@raselkhan:~# pwd
/khan/home
6
  • You want to change root's home directory or cd to your home directory?
    – muru
    Feb 5, 2015 at 14:16
  • Default i've khan/home after command sudo -i then changes /root
    – Rasel Khan
    Feb 5, 2015 at 14:17
  • That's the point of sudo -i. If you don't want that, don't sudo.
    – muru
    Feb 5, 2015 at 14:17
  • I want back to before, when type pwd then showing me /home/khan
    – Rasel Khan
    Feb 5, 2015 at 14:19
  • Then use sudo -s instead (a shell but not a login shell) Feb 5, 2015 at 14:21

2 Answers 2

3

If I understand you correctly, you can always:

exit

And then pwd again.

0
1

In your first portion root@raselkhan:~# pwd, the username is root and the directory you are currently in is ~ i.e. home directory. As the user is root and the home directory of root is /root, pwd command rightly showing the print working directory as /root.

Now in your second portion khan@raselkhan:~# pwd, the username is khan and the current directory is ~ which again means the home directory of the user. As the user in this case is khan so the pwd will show /home/khan (i think you have mistakenly typed /khan/home).

2
  • yes, my username khan, I want default directory /khan/home when type pwd
    – Rasel Khan
    Feb 5, 2015 at 14:25
  • Then don't be root. The pwd command will show /home/khan when the prompt starts with khan@raselkhan:~.
    – heemayl
    Feb 5, 2015 at 14:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .