Questions relating to the Linux 'list' command (ls)
Questions tagged [ls]
390 questions
501
votes
6 answers
What do the different colors mean in ls?
What do the different colours in Ubuntu's ls command mean? For example, when I type the ls command in one of my folders, I get one of the files in light green, the other (which is a folder) in blue with green highlighting.
What do those colours…
Rafid
- 5,557
298
votes
14 answers
How do I change the color for directories with ls in the console?
On my console the color for directories is such a blue, that it is hard to read on a dark background.
How can I change the color definitions for ls?
rubo77
- 34,024
- 52
- 172
- 299
291
votes
10 answers
How to list all symbolic links in a directory
I have a symbolic link in my /var/www/ directory that links to WordPress. When I run the command ls -la from the /var/www/ directory the link to WordPress doesn't show up. Is there a way to list all of the symbolic links that are in a directory?
Isaac
- 3,105
- 3
- 15
- 13
252
votes
25 answers
How to show only hidden files in Terminal?
I have a directory that contains thousands of files, some of which are hidden.
The command ls -a lists all files, including hidden ones, but I need to just list hidden files.
What command should I use?
nux
- 39,152
214
votes
5 answers
How to Search for Files Recursively into Subdirectories
I am trying to look for all XML files in a particular directory and all sub-directories (recursively) inside it.
ls -R *.xml is only listing files in the current directory. I am quite sure, the sub-folders themselves have several .xml files, but…
Shamim Hafiz - MSFT
- 2,484
131
votes
5 answers
How to exclude certain files in `ls`?
I would like to run ls and exclude certain files in the output.
When I run the following command, I get all files, each on a separate line:
$ ls -1
file1
file2
file3
temp
I would like to run this command in a way so that it shows:
$ ls -1
Alice Ryhl
- 1,587
120
votes
8 answers
How can I make ls only display files?
I figure there has to be a way of making ls only display non-directories, but the man page doesn't make it obvious
user453720
100
votes
5 answers
Difference between 'dir' and 'ls' terminal commands?
I've been trying to find the difference between using the dir and ls commands in terminal. I know ls is the traditional UNIX method of viewing the files in a directory, and that dir is the windows command prompt equivalent, but both commands work in…
BretD
- 1,338
75
votes
10 answers
Count total number of files in particular directory with specific extension
I want to count the total number of files in particular directory that ends with ".mp4" extension.
I am getting following command:
ls -F |grep -v / | wc -l
It count all the files in particular directory, but I want the count of files that end with…
Prakash H
- 2,631
49
votes
5 answers
What is the significance of '*' (star, asterisk) in the file listing results?
I have noticed that some of my files have an asterisk at end.
Does the asterisk at the end have any particular significance? I think they are mostly executable and displayed in green by the ls command.
You will see that ./bkmp* and ./bkmp0* have an…
vfclists
- 1,949
45
votes
11 answers
How to list all the files in a tree (a directory and its subdirs)?
For a task of mine I need to list all the files in a tree (a directory, all its subdirs, all subdirs of those, etc.).
I'd prefer to see them in Nautilus or Krusader, but a command-line solution is interesting as well (in this case I will need files…
Ivan
- 58,745
44
votes
2 answers
Why does ls -l output a different size from ls -s?
I can't figure out why I'm getting the following results:
ls -l tells me the size of a given file (HISTORY) is "581944":
$ ls -l HISTORY
-rw-rw-r-- 1 waldyrious waldyrious 581944 Feb 22 10:59 HISTORY
ls -s says it is "572":
$ ls -s HISTORY
572…
waldyrious
- 2,207
43
votes
5 answers
How to activate pagination for ls command?
What is the equivalent option for the ls command to activate pagination as in DOS the dir /p does?
NES
- 33,935
39
votes
5 answers
What does the second column in the output of 'ls -n' mean?
When I run:
ls -n
I get something like:
-rwxrwxrwx 1 1000 1000 765528 2009-10-15 18:41 file1
drwxr-xr-x 10 1000 1000 4096 2010-12-07 20:50 dir1
drwxr-xr-x 3 1000 1000 4096 2010-10-24 16:57 dir2
What does the second column (the number)…
Nathan Osman
- 32,495
37
votes
4 answers
What do "." and ".." mean when in a folder?
When I used ls -a to view hidden files in folder, there were 2 hidden files created by default. What is the significance of these two files, . and ..?
ls -a
produces:
.
..
Vishwanath Dalvi
- 1,417