The ls command lists the contents of a directory.

learn more… | top users | synonyms

5
votes
6answers
3k views

Compare files that are in directory 1 but not directory 2?

I'm having trouble with a bash script I want to make I know ls will list files that are in a directory but I want it to list directories that are in directory1 but NOT in directory2, and then list ...
15
votes
4answers
14k views

last time file opened

Is it possible to get the time when file was opened last time and sort all files in a directory by those times?
15
votes
3answers
14k views

Find the owner of a directory or file, but only return that and nothing else

I am looking for a command that will return the owner of a directory and only that--such as a regex parsing the ls -lat command or something similar? I want to use the result in another script.
3
votes
1answer
227 views

ls pagination on MontaVista with BusyBox

I'm logged into an IP Phone running MontaVista with a very stripped down BusyBox binary (by stripped down, I mean the OEM has removed almost all of its functionality, except the basics like cat, ls ...
11
votes
3answers
9k views

What is the Linux equivalent of DOS “dir /s /b filename”?

List all files/dirs in or below the current directory that match 'filename'.
4
votes
2answers
2k views

Scrolling through ls output without a mouse

In some directories there are quite a few files. When I use ls the output is more than my terminal can handle. Typically I just use one of the following: ls | less ls | more depending on my mood. ...
2
votes
2answers
303 views

Is it possible to change the spacing between files using ls

I'm fairly new to unix and I was wondering if there's some attribute of ls that I can use to change the spacing between the files. Currently I've aliased my ls to output ls -G, so that I have colored ...
4
votes
2answers
1k views

How can I search for a file with fixed name length using ls?

In a directory, I have files like lazer_100506 lazer_100707 lazer_091211 lazer_110103 lazer_100406_temp lazer_100622#delete etc How can I get a listing of only the first four files? $ ls ...
4
votes
1answer
291 views

Set ls color listings based on regex instead of globbing

Is it possible to set regex patterns for color matching in the LS_COLORS variable? So instead of just *.jpg=38;5;220 Can I do \.(jpg|gif)=38;5;220 That's just an example, I'd like to get more ...
14
votes
5answers
6k views

What is the difference between ls and l?

I accidentally typed l instead of ls today and found that the command still printed a list of the files in my current directory. Trying l --help brings up the help file for ls suggesting that l is ...
19
votes
3answers
3k views

ls command: what does the first line mean?

When I do ls -l I get this: calico@A000505:~/Documentos$ ls -l total 2020 -rwxr-xr-x 1 calico calico 8559 2010-11-16 11:12 a.out -rwxrw-rw- 1 smt smt 2050138 2010-10-14 10:40 Java2.pdf ...
5
votes
3answers
5k views

list full path of file without tying it from relative relative path

I could do this root@server [/home/user/public_html]# ls /home/user/public_html/.htaccess but I'd like to do this ls --switch .htaccess /home/user/public_html/.htaccess is it possible?
2
votes
1answer
3k views

Find the disk-space usage of a directory and all it's files [duplicate]

Possible Duplicate: How to know the size of a directory? If I run ls -lh then any given directory is just shown as 4.0K. How can I can make it consider the files the directory refers to ...
1
vote
0answers
141 views

How can I list only the directories present in a directory using ls? [duplicate]

Possible Duplicate: Is there any option with 'ls' command that I see only the directories? I have a directory with a lot of files but only a few directories. To get a list of only ...
2
votes
1answer
1k views

LS_COLORS settings for specific types of files

I'm trying to set up my color scheme for ls, and I'm having trouble finding information about exactly what parameters I have to work with, or where those come from. And especially setting colors for ...
4
votes
2answers
2k views

ls'ing through an entire directory tree to produce one pipeable list of files

This might have been answered already. But I wasn't able to find it. I have: directory directory/subdirectory/subdirectoryofsubdirectory ...
5
votes
1answer
5k views

+ or @ mark after running 'ls -al'

In Mac OS X, run 'ls -al' gives me something like this. drwxrwxrwx+ 4 smcho staff 136 May 5 09:18 Public drwxr-xr-x+ 6 smcho staff 204 Feb 1 2010 Sites drwxrwxrwx 9 smcho staff ...
27
votes
5answers
7k views

Is there any option with 'ls' command that I see only the directories?

Sometimes, I need to check only the directories not files. Is there any option with the command ls? Or is there any utility for doing that? EDIT: I'm using Mac OS X, and ls -d gives me . even though ...
6
votes
1answer
599 views

How do I get a long listing for a single directory?

I want to see a long listing for a single directory. When I type ls -lha, I see this: drwxrwxr-x 4 username groupname 4.0K 2010-08-05 09:55 files drwxrwxr-x 7 username groupname 4.0K 2010-08-05 ...
28
votes
3answers
3k views

What does size of a directory mean in output of 'ls -l' command?

What does size of a directory mean in output of ls -l command?
26
votes
6answers
6k views

what does the @ mean in ls -l?

I am using Mac OSX. When I type ls -l I see something like drwxr-xr-x@ 12 xonic staff 408 22 Jun 19:00 . drwxr-xr-x 9 xonic staff 306 22 Jun 19:42 .. -rwxrwxrwx@ 1 xonic staff 6148 25 ...