4

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 .virtualenvs

and I got:

bash: cd: virtualenvs: No such file or directory

How to acces from Terminal then?

thank you

1
  • 1
    In terminal, if you're currently at your home directory (/home/daniel) then cd .virtualenvs will work, as .virtualenvs is a sub-directory of /home/daniel. IF HOWEVER, the path you show is correct, then you'll need to cd /home/.virtualenvs to get there. Note that /home/.virtualenvs would not be a normal place to put the .virtualenvs directory.
    – heynnema
    Mar 19, 2017 at 15:04

1 Answer 1

6

Before we start lets locate the folder:

  1. realpath virtualenvs
  2. realpath .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/.virtualenvs

Now note two things here:

  1. We used the absolute path to get to it

  2. We inserted the _environmental variable %USERNAME into the path. We could easily have inserted or used daniel if 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 .virtualenvs

This 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.

  1. Relative Paths:

    • If I typed pwd and the result was /home/daniel. That means I am sitting or located in /home/daniel and when I type realpath .virtualenvs then also get the result /home/daniel/.virtualenvs then to get into virtualenvs ( which if you also is in /home/daniel) I will type:

      cd .virtualenvs
      
    • Now this is the relative path, i.e. in relation to where I currently am.

  2. Absolute Paths:

    • If I don't know where I am, but know that the .virtualenvs folder is in the /home/daniel as seen when we use realpath .virtualenvs command. Then I will use the absolute path to get to it with:

      cd /home/daniel/.virtualenvs
      
    • Or if I type pwd to know where I was in the filesystem and I get a result like: /usr/lib then 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 ~/.virtualenvs

and this would have got me there.

2
  • Need to change .virtualenv to .virtualenvs :-)
    – heynnema
    Mar 19, 2017 at 15:11
  • Also note that OP wasn't quite clear if the directory is at /home/.virtualenvs or /home/daniel/.virtualenvs. See my comment to the question.
    – heynnema
    Mar 19, 2017 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.