Parent Directories

A parent directory is a directory one level higher than the current directory. Also known as the parent directory.

For example, if you have the following directories:

/home/kimoto/labo

The parent directory for this directory is:

# Parent directory
/home/kimoto

Parent directory file name

The parent directory as seen from the current directory is represented by the special file name "..".

# Parent directory file name
..

Change the parent directory to the current directory

To change the current directory to the parent directory, give ".." to the argument of cd command.

cd ..

If the current directory is "/home/kimoto/labo", the current directory will be changed to "/home/kimoto".

Check for the existence of the parent directory

The parent directory actually exists as hidden files as the contents of the current directory.

Let's check using the "-a" option of the ls command. This is a sample output result.

drwxrwxr-x 6  kimoto kimoto 4096 Aug 14 17:51.
drwxrwxr-x 40 kimoto kimoto 4096 Nov 9  10:08 ..
-rw-r--r-- 1  kimoto kimoto 1116 Aug 15 08:28 convert_markdown.pl
-rw-r--r-- 1  kimoto kimoto 162  Sep 11 08:42 giblog.conf
drwxrwxr-x 8  kimoto kimoto 4096 Oct 12 19:52 .git
-rw-r--r-- 1  kimoto kimoto 8    Aug 10 15:01 .gitignore
drwxrwxr-x 3  kimoto kimoto 4096 Aug 10 15:01 lib
drwxrwxr-x 7  kimoto kimoto 4096 Aug 10 15:04 public
-rw-r--r-- 1  kimoto kimoto 227  Aug 10 15:01 README
-rw-r--r-- 1  kimoto kimoto 219  Aug 10 15:01 serve.pl
drwxrwxr-x 5  kimoto kimoto 4096 Aug 10 15:01 templates

".." is displayed.

Associated Information