Results 1 to 5 of 5
For some reason files with a '.' in front of them don't show up when I do 'ls' in the command line. I'm not sure why. I was thinking it ...
- 09-08-2008 #1Just Joined!
- Join Date
- Mar 2008
- Posts
- 34
Viewing .files
For some reason files with a '.' in front of them don't show up when I do 'ls' in the command line. I'm not sure why. I was thinking it may be because I don't have read permissions for the file, but why would it have a '.' in front of it? Is there something you need to do to the 'ls' command to make it so it sees these files?
- 09-08-2008 #2forum.guy
- Join Date
- May 2004
- Location
- arch linux
- Posts
- 18,095
Files and folders with the dot in front of them are hidden.
Try the command like this to see all files:
Code:ls -a
oz
→ new members/users: read this first | new member faq
→ no private messages requesting computer support - post them on the forums!
→ please use the "report post" button to alert our forum admins to problematic posts rather than responding to them yourself.
- 09-08-2008 #3Just Joined!
- Join Date
- Mar 2008
- Posts
- 34
Ok, thanks. Sorry for the big thread for nothing. Usually I would find this with google, but I didn't know how to word the search for this.
- 09-08-2008 #4forum.guy
- Join Date
- May 2004
- Location
- arch linux
- Posts
- 18,095
No problem... you can find more options to use with the ls command by checking the manual page:
Code:man ls
oz
→ new members/users: read this first | new member faq
→ no private messages requesting computer support - post them on the forums!
→ please use the "report post" button to alert our forum admins to problematic posts rather than responding to them yourself.
- 09-09-2008 #5Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
As ozar very well said, dot files are -by convention- considered as hidden files. I say "by convention" because it is just that: a silent agreement. Most applications will not show dot files, unless explictly asked to do so (i.e. with -a in ls, or via an option menu or a config option in graphical programs, etc.).
This is implemented at application level, and not at filesystem level (like file permissions for read, exec or write, for example).
Most configuration files and directories are dot files in our $HOME directory, since the regular user doesn't need to see them all the time.
Related to this, there's a shell option in bash, called "dotglob". Usually, by default, if you use "*" to reffer to ALL the files in the current dir (or whatever dir), dot files will not be included. If you turn dotglob on then they will be included in "*".
Simple example:
This also illustrates the slight, but still relevant, difference between "ls" and "ls *"Code:$ mkdir tmp $ cd tmp $ touch file1 file2 .file3 $ ls file1 file2 $ ls * file1 file2 $ shopt -s dotglob $ ls * file1 file2 .file3

Note that if you use "shopt -s dotglob", all the *'s will include dot files if they match the wildcard expansion, including when you use rm, a thing to be careful about when using it.
Cheers.


Reply With Quote
