Learn Linux Quickly
上QQ阅读APP看书,第一时间看更新

Hiding files

You can hide any file by renaming it to a name that starts with a dot.

Let's try it; you can hide the file dogs.txt by renaming it to .dogs.txt as follows:

elliot@ubuntu-linux:~$ ls
apple.txt banana.txt carrot.txt dogs.txt Desktop dir1 small
elliot@ubuntu-linux:~$ mv dogs.txt .dogs.txt
elliot@ubuntu-linux:~$ ls
apple.txt banana.txt carrot.txt Desktop dir1 small
elliot@ubuntu-linux:~$

As you can see, the file dogs.txt is now hidden as it got renamed to .dogs.txt. You can unhide .dogs.txt by renaming it and removing the leading dot from the filename:

elliot@ubuntu-linux:~$ mv .dogs.txt dogs.txt
elliot@ubuntu-linux:~$ ls
apple.txt banana.txt carrot.txt dogs.txt Desktop dir1 small
elliot@ubuntu-linux:~$

Yes, Sir! You can also hide and unhide directories in the same manner. I will leave that for you to do as an exercise.