Results 1 to 9 of 9
Hi,
I need to hide a file from the directory but when i use the command ls -a the file should not be shown in the hidden files list.is there ...
- 02-27-2010 #1Just Joined!
- Join Date
- Feb 2010
- Posts
- 1
Need script for hiding the file
Hi,
I need to hide a file from the directory but when i use the command ls -a the file should not be shown in the hidden files list.is there any script to perform that task?
Thanks in advance
- 02-27-2010 #2Just Joined!
- Join Date
- Nov 2008
- Posts
- 29
Not to my knowledge. But tell us why you want to hide a file in the first place? Can you set permissions so that it is not readable by most users?
- 02-27-2010 #3
I am not 100% sure if I understood correctly.
Are you saying, that dot files do not offer enough hiding for you?
Question would be, what is the purpose of hiding here?
Regular dot files are used for config storing, maintained (mainly) by their applications.
So the hiding of dotfiles and directories is convenient for the user to keep directory listings short and focused on datafiles.
But sometimes you want/need to see and edit them, thus ls -a will show dot files.
If you have reason to *really* not show some files, the fuse overlay cmdfs might be usefull:
http://cmdfs.sourceforge.net/You must always face the curtain with a bow.
- 02-27-2010 #4
and yes, setting permissions as guus.leeuw.jr suggested, might also be effective.
You must always face the curtain with a bow.
- 02-28-2010 #5
I do not believe there is a way to stop the listed on any hidden file when using the '-a' for that is what it is designed to do, list all files. Changing the permissions will also no change this. For example in /etc/ do 'ls -al' you will see that there are files with root only access that are still displayed.
- 02-28-2010 #6Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
AFAIK, the only way to hide files listed in a directory entirely is to make the directory unreadable by anyone other than the owner and/or group. IE: chmod dirname o=-wrx will block access to a directory to all but the owner and group that the directory belongs to. Basically, none of the files there will be visible to "others".
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 02-28-2010 #7
Lazydog: My thought was: no permission, no access: content hidden

But of course, you are right.
Setting permissions on a file wont hide it.
Ruberman: There is another way, the above mentioned fuse module
http://cmdfs.sourceforge.net/
Basically: If a file does not meet certain criteria, it is not shown in the fusemounted directory.
But I admit, this might be a bit overkillYou must always face the curtain with a bow.
- 03-01-2010 #8Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
Yes, a fuse-based virtual file system would work, though the cmdfs that Irithori mentions only filters based on file names, not on the user trying to view the directory, which is what I think rajkumarlynx is trying to do. However, the source for cmdfs would be a good place to start to create a filtering file system with those characteristics.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 03-02-2010 #9
This makes me think of when I .... had a friend who would hide files in c:\windows\system32\temp\hidden\dont\look\here\stu ff.jpg .... I mean ... stuff. extension.
make it so people couldn't find it and .... determine what it was

Then I .... told my friend .... he could tar the files up on linux, and run them through gpg so that they're encrypted .....
.....
........
.........
Suckers, they'll never figure out what I'm talking about ....New to the internet, technical forums, or the hacker / open source community??
Read this to learn good posting habits http://www.catb.org/~esr/faqs/smart-questions.html
RHCE for RHEL version 5
RHCT for RHEL version 4


Reply With Quote