how to access to a hidden folder?
Matthew Barrera
I want to know how to access to a hidden folder using Terminal.
I am nos asking how to make it visible.
I have the folder home/.virtualenvs
In Terminal I tried:
$ cd virtualenvs and $ cd .virtualenvsand I got:
bash: cd: virtualenvs: No such file or directoryHow to acces from Terminal then?
thank you
11 Answer
Before we start lets locate the folder:
realpath virtualenvsrealpath .virtualenvs
Now assuming you get a return of /home/.virtualenv from option 2(again assuming it was actually a hidden folder), then we need to move it to the proper place which aught to be in /home/$USERNAME or /home/daniel in your case.
We do so by typing this in the terminal:
mv /home/.virtualenvs /home/daniel/But if it returns /home/virtualenvs, then the folder isn't hidden and should be moved thus:
mv /home/virtualenvs /home/daniel/NOTE: If not hidden run through the answer without the . before every occurrence.
Now you access hidden folders from the terminal like any other, except you have to add the . character before the name. Now in your case the fault is that you did not add the exact location of the virtualenvs folder.
Say the virtualenvs folder is in our /home directory ( as we had moved it there ) then to get at it from the terminal we will put it this way:
cd /home/$USERNAME/.virtualenvsNow note two things here:
We used the absolute path to get to it
We inserted the _environmental variable
%USERNAMEinto the path. We could easily have inserted or useddanielif that is the name Ubuntu knows you by. In which case we would have had it like this:cd /home/daniel/.virtualenvs
Now to see where your virtualenvs folder is run:
realpath .virtualenvsThis will return the path location of that folder which you will then use with the cd command to enter into it.
Absolute and Relative Paths:
Now let me try to explain this so you won't need to always type /home/daniel/.virtualenvs to get into .virtualenvs folder.
Relative Paths:
If I typed
pwdand the result was/home/daniel. That means I am sitting or located in/home/danieland when I typerealpath .virtualenvsthen also get the result/home/daniel/.virtualenvsthen to get intovirtualenvs( which if you also is in/home/daniel) I will type:cd .virtualenvsNow this is the relative path, i.e. in relation to where I currently am.
Absolute Paths:
If I don't know where I am, but know that the
.virtualenvsfolder is in the/home/danielas seen when we userealpath .virtualenvscommand. Then I will use the absolute path to get to it with:cd /home/daniel/.virtualenvsOr if I type
pwdto know where I was in thefilesystemand I get a result like:/usr/libthen to get to .virtualenvsthe absolute path will be need as the relative path won't get me there. So from location/usr/lib` I would type:cd /home/daniel/.virtualenvs
Now another important note is the use of ~/ in place of /home/daniel. This can be used to avoid typing the full /home/daniel, so for the absolute path to .virtualenvs I would have typed:
cd ~/.virtualenvsand this would have got me there.
2