Current Directories
The current directory is the directory you are currently working on. Current means "current" in English. A directory in Linux corresponds to a folder in Windows.
Change current directory
Use the cd command to change the current directory.
cd /home/kimoto/labo
The directory "/home/kimoto/labo" will be the current directory.
Specify a relative path from the current directory
As an effect of setting the current directory, the file name can be specified from the current directory with relative path.
Let's specify the file "foo" with a relative path with the ls command.
ls foo
This actually has the same meaning as specified by absolute path as shown below.
ls /home/kimoto/labo/foo
File name of the current directory
The current directory itself is represented by a special file name ".".
# File name of the current directory ..
If you give "." To ls and execute it as shown below, a list of files in the current directory will be displayed.
ls .
Check the existence of the current directory
The current directory actually exists as the contents of the current directory as hidden files.
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.