Questions tagged [ls]

Questions relating to the Linux 'list' command (ls)

372 questions
483
votes
5 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,367
  • 6
  • 21
  • 20
271
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
  • 2,905
  • 3
  • 13
  • 13
262
votes
13 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
  • 31,573
  • 49
  • 159
  • 281
239
votes
23 answers

How to show only hidden files in Terminal?

I have a directory that contains thousands of files, some of them are hidden. The command ls -a list all files, including hidden ones, but I need just to list hidden files. What command should I use?
nux
  • 37,371
  • 34
  • 117
  • 131
201
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,354
  • 3
  • 18
  • 18
116
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,437
  • 3
  • 11
  • 12
106
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
89
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,228
  • 1
  • 9
  • 11
64
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 V Holkar
  • 2,521
  • 7
  • 20
  • 29
46
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,839
  • 3
  • 16
  • 20
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,189
  • 2
  • 21
  • 36
44
votes
10 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
  • 55,987
  • 65
  • 150
  • 212
41
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
  • 32,845
  • 41
  • 101
  • 115
37
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
  • 31,915
  • 40
  • 179
  • 259
36
votes
5 answers

Why is ls -R called "recursive" listing?

I understand that ls -R displays a listing of directories. But why is it recursive? How is recursion used in the process?
Mint.K
  • 775
  • 3
  • 9
  • 18
1
2 3
24 25