How do I change directories to downloads, from the home folder, in the latest version Ubuntu 12.10? I tried
cd /downloads, but it gave an error saying that there is no such directory.
Downloads directory, you can quickly return to your home directory by simply typing
cd at the prompt.
cd ~ does the same thing.
There two basic ways to get around in BASH:
- Using absolute pathnames
- Using relative pathnames
Absolute pathnames start at the root directory, denoted by a leading
/, and can be used from anywhere. To use the absolute path to go to
Downloads, you can run:
<username> is replaced with your username. You can also replace it with the environment variable
$USER which usually expands to the username of the user currently running the shell. You can also replace
$HOME, which will usually expand to the absolute path of the home directory of the user running the shell.
A useful shortcut for this is
The tilde character (
~) takes the place of
/home/<username> - it expands to the home directory of the user currently running the shell. Note that this expansion will not be performed if the tilde character is in double or single quotes.
Relative pathnames start at the working directory (the one you're in). So if you know what directory you're in, you can use some shortcuts to get around. For example
.(dot) refers to the current working directory
..(dot)(dot) refers to the parents directory of the current working directory
when you are in your Home folder and type
cd Downloads you could also type
./ is implied when you just type
cd Downloads (working directory is implied if you don't include a pathname).
When you are in the
Downloads directory, you could also use
cd .. to return to the parent directory
/home/<username>. In this case it is easiest to just type
cd, because that changes the working directory your home directory immediately wherever you are. However, the
.. becomes very useful when you are navigating around nested directory structures or other locations on the system.