How to create a hidden file in Bash

試著忘記壹切 提交于 2019-12-31 04:06:27

问题


What is the bash command to create a hidden file. I want to name it .httName.

I have tried googling for this, but none of the forums suggest any work around for this. I am simply looking for the command to solve my issue. If anyone happen to know the answer please help me out.


回答1:


Files starting with a dot are by default hidden. You can create it simply by

touch .httName

anyone will still be able to see it using

ls -a

If you want files to be properly hidden, you will have to change folder permissions using chmod. For example

chmod 770 folder_name

will prevent users (except the owner and people in the group) from listing the whole directory "folder_name".




回答2:


Any file starting with . in file name is "hidden".

If you've a file and you want to hide it use:

mv filename.txt .filename.txt



回答3:


Just to go further on the hidden point. As covered after the creation of a hidden type file .hidden changes to the permissions of the file and its parent are advised, especially within a multiuser box.

after you : touch .hidden secure the item with: chmod 600 .hidden and secure the parent directory: chmod go-w ~/parent/




回答4:


the file which start with .(dot)filename is always hidden and its used for setting configuration of the application. In Linux dot files are used for same purpose.Even you are working in current directory ls command should not display hidden file use la to shoe hideen directories.



来源:https://stackoverflow.com/questions/17361792/how-to-create-a-hidden-file-in-bash

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!