0

I'm new to linux and python. I'm just thinking can i go back to default root folder (Home) from terminal, and not by closing and reopen the terminal.

After activating the folder:

root@root:~/anaconda2# source bin/activate ~/anaconda2/
discarding /root/anaconda2/bin from PATH
prepending /root/anaconda2/bin to PATH

I get:

(/root/anaconda2)root@root:~/anaconda2

Then i run the ipython notebook and after finish my work and shutdown, i returned back to:

(/root/anaconda2)root@root:~# 

How can I get back my root folder (Home):?

root@root:~# 
cafce25
  • 15,907
  • 4
  • 25
  • 31
Suhairi Suhaimin
  • 143
  • 3
  • 13

4 Answers4

1

You're already back to home directory.

Maybe you meant deactivate the virtualenv? Issue deactivate or source deactivate:

(/root/anaconda2)root@root:~# source deactivate
root@root:~# 
falsetru
  • 357,413
  • 63
  • 732
  • 636
  • Thank you for your help. It's not working, but giving the correct one. Error: deactivate must be sourced. Run 'source deactivate' instead of 'deactivate'. So the working one is: 'source deactivate'. Thank you @falsetru. Have a nice day! – Suhairi Suhaimin Nov 20 '16 at 04:48
  • @SuhairiSuhaimin, Thank you for the feedback. I updated the answer accordingly. – falsetru Nov 20 '16 at 04:50
1

Hmm why are you using root in first place?

If you are doing it for avoid use sudo It's a bad idea.. you need to have control what things are you installing with root privileges or not.. If you are logged in with root.. well you are installing all with root privs. when it's not necessary. And It's not recomend it for security reasons mostly.

for go back to your root folder.. did you try just run cd? is that what you want?

The reason that your home directory is /root is because you are using the root user. You need to create an user on Kali to use the /home/username.

llazzaro
  • 3,970
  • 4
  • 33
  • 47
bySamo
  • 475
  • 5
  • 12
  • Thanks for asking @bySamo. I'm using kali linux. It starts with root@root:~#. Reason is i want to use python from anaconda environment rather than my kali linux's python (some anaconda package issues). cd cd.. or .. none working. – Suhairi Suhaimin Nov 20 '16 at 04:41
  • `cd` It's not working.. wow.. what about `cd ~` ? If that still doesn't work you can easily create an alias pointing to the all path where you want to go.. for eg. first type `alias cd1="/root"` then you can just run `cd1` You need to put the right path in the alias and that should work.. Sorry, I don't a kali linux for test it for you. – bySamo Nov 20 '16 at 04:49
  • Thank you. cd ~ also not working. I've tried all the cd command before asking. The @falsetru solution I think we're looking for. Once the virtulenv/source activated, it must be deactivated. It just don't cross my newbie mind at first. – Suhairi Suhaimin Nov 20 '16 at 05:00
  • @SuhairiSuhaimin create an user with adduser command before using anything in Kali. then add your user to the /etc/sudoers – llazzaro Nov 22 '16 at 15:07
  • Noted. Thanks @llazzaro – Suhairi Suhaimin Nov 23 '16 at 09:50
0

Whenever you want to go back from sub-directory to parent directory use .. or change the working directory to user’s home directory use cd ~

Abdel-Raouf
  • 700
  • 1
  • 8
  • 20
-1

If you are in root and want to go back in the simple user you can try typing "exit"