Create hidden directory with dot '.' and '..' as filename.


Create hidden directory with dot '.' and '..' as filename.


Now lets play around with the hidden directory. In this example, we create hidden directory or hide directory using the same or look like the dot (.) and double dot (..) directory.

EXAMPLE 01:

1. Issue mkdir command, as we know the '.' directory is represent the current directory that we are currently in. The mkdircommand below actually making the hidden directory with '. ' as filename, notice that we actually instruct the mkdir to make new hidden directory called 'dotspace'.

[root@fedoracore folder]# mkdir '. '
[root@fedoracore folder]#

2. Now we use ls command to see what happen after the execution of the mkdir command above.

[root@fedoracore folder]# ls -a
. . .. .hidden_directory
[root@fedoracore folder]#

[root@fedoracore folder]# ls -al
total 20
drwxr-xr-x 4 root root 4096 Jun 19 05:56 .
drwxr-xr-x 2 root root 4096 Jun 19 05:56 .
drwxr-x--- 40 root root 4096 Jun 19 05:53 ..
drwxr-xr-x 2 root root 4096 Jun 19 05:55 .hidden_directory
[root@fedoracore folder]#

Note: Now from the naked eye, we can see that we have two '.' directory.

Using the hidden directory.


3. To change directory (cd) or go inside the '. ' directory make sure you put single quotedot and space after the dot and end with the single quote again. The example below show the step to change to the hidden directory.

[root@fedoracore folder]# pwd
/root/folder
[root@fedoracore folder]# cd '. '

3a. Verify with the pwd (print current working directory) command.

[root@fedoracore . ]# pwd
/root/folder/.
[root@fedoracore . ]#

EXAMPLE 02:

1 Issue mkdir command to make hidden directory that use '.. ' as filename (dotdotspace).

[root@fedoracore folder]# mkdir '.. '
[root@fedoracore folder]#

1a. Use the ls command to verify that the hidden directory created.

[root@fedoracore folder]# ls -a
. . .. .. .hidden_directory
[root@fedoracore folder]#

[root@fedoracore folder]# ls -al
total 24
drwxr-xr-x 5 root root 4096 Jun 19 05:57 .
drwxr-xr-x 2 root root 4096 Jun 19 05:56 .
drwxr-x--- 40 root root 4096 Jun 19 05:53 ..
drwxr-xr-x 2 root root 4096 Jun 19 05:57 ..
drwxr-xr-x 2 root root 4096 Jun 19 05:55 .hidden_directory
[root@fedoracore folder]#

Using: the hidden directory.

2. Change current working directory to '.. ' (dotdotspace) directory.

[root@fedoracore folder]# pwd
/root/folder
[root@fedoracore folder]#
[root@fedoracore folder]# cd '.. '
[root@fedoracore folder]#

2a. Verify.

[root@fedoracore .. ]# pwd
/root/folder/..
[root@fedoracore .. ]#
[root@fedoracore .. ]# cd ..
[root@fedoracore folder]# pwd
/root/folder
[root@fedoracore folder]#