The command to list the contents of a folder/directory in Unix and Unix-like systems.

learn more… | top users | synonyms

10
votes
4answers
7k views

How to list files recursively and sort them by modification time?

How do I list all files under a directory recursively and sort the output by modification time? I normally use ls -lhtc but it doesn't find all files recursively. I am using Linux and Mac. ls -l on ...
0
votes
1answer
77 views

What can I use as parameters to specify the output behavior of `ls`?

What is the ls command that will produce the following output? 478661 .gconf/ 478662 .gconfd/ 450001 .gimp-2.4/ 450006 .gksu.lock 478706 .gnome/ 478664 .gnome2/ 478667 .gnome2_private/ 478669 .gnupg/ ...
1
vote
3answers
5k views

in shell how can I tell the difference between a directory and a file

How can I tell which ones are directories in ls output? It seems ls doesn't differentiate directories and files. I know I can use cd to test but is there a way to make it more obvious when I ls a pth? ...
0
votes
1answer
996 views

No permission for ls drwx--x--x

Is there any way to see a tree of directories with a chmod of drwx--x--x ? I know I can manually check by bash script with if [ -d dirname ]. However it is not the solution I am looking for. Cheers!
0
votes
1answer
154 views

“File” exists or not

ls -il ls: cannot access éaj/p╬σt.ó∙e: No such file or directory ls: cannot access éaj/p╬σt.ó∙e: No such file or directory ls: cannot access é@j/p╠φt.│∙N: No such file or directory ls: cannot access ...
0
votes
1answer
290 views

how to increase 16 character limit to display user name in Terminal / UNIX?

I have several Mac users attached to my NAS whose usernames exceed the 16 char user display (ie SportsFreelancer01), so under the ls -al command, it shows up as user "SportsFreelancer", without #. Is ...
5
votes
1answer
822 views

What is the + at the end of Unix permissions in a long listing format?

Here's an example drwxr-xr-x+ 6 reza reza 204 Mar 5 20:23 .ssh/ Although I am the owner of this directory, I cannot modify it without using sudo! Why is that? how can I remove '+' here (...
0
votes
0answers
32 views

What is the '+' at the end of long listing format? [duplicate]

Possible Duplicate: What is the + at the end of Unix permissions in a long listing format? Here's an example drwxr-xr-x+ 6 reza reza 204 Mar 5 20:23 .ssh/ Although I am the owner ...
2
votes
1answer
3k views

How to filter files with specific permissions or attributes while running ls?

For example, if I only want the files that have the permission g+s while running ls, how could I do this?
2
votes
2answers
129 views

ls working strangely

I'm used to typing ls Doc, and tabbing a couple times to complete to ls Documents/. However, now my ls is completing that same statement to ls Documents with a space at the end of Documents, so I can ...
7
votes
2answers
3k views

How to physically reorder files `03.mp3 01.mp3 02.mp3` (`ls -f`) in a directory?

The physical order of the files matters when I copy them onto my USB stick and listen in car mp3 player. Most of my music album folders are unsorted, e.g. ls -f may produce: 03.song3.mp3 01.song1.mp3 ...
2
votes
1answer
159 views

Screen “dies” whenever “ls” is executed

I'm running Screen 4.00.03 on my RHEL 5 server. Wheneven I open a new screen and execute ls the screen dies. This only happens in this server and not in other servers. What is causing this problem? ...
4
votes
3answers
2k views

Linux 'ls' - what does the * mean?

When I do a ls in a folder, I sometimes get entries like: a.txt* b.txt b.txt~ I believe: ~ means that it's a swap copy, however what does the * mean?
3
votes
1answer
128 views

Can I use my own Java program as a command in Windows?

I've developed a Java program which does the same task as the ls command in Linux. After developing it, I was thinking about using it as a command in the DOS prompt. Does Windows allow this? If it ...
3
votes
1answer
2k views

why don't ls -lrt `find .` and find . -exec ls -lrt {} \+ produce the same output?

I'm trying to sort files by date, including those that reside in subdirectories. I got it to work by using: find . -exec ls -lrt {} \+ which I found somewhere on StackOverflow. My initial try was ...
3
votes
1answer
613 views

ls sorted from right to left

Example list sorted from left to right. DATA2 DATA4 FILE1 FILE3 Example list sorted from right to left. FILE1 DATA2 FILE3 DATA4 How do I do this?
3
votes
2answers
137 views

mouse interaction with ls output - click to open

I would like to be able to (double) click a file from the ls output and open it with the associated program. Anyone knows a way to do this? Mouse-console interaction is possible with GPM and links ...
0
votes
2answers
398 views

What is a simple standard command line way of getting 'ls' to produce file permission in octal?

Any know a standard way, other than 'stat' to produce octal output for file permission from 'ls'? Standard way of using stat (on OSX) is: stat -f '%A %a %N' * where * can be any file pattern that ...
1
vote
1answer
1k views

ls: cannot access /directory/path/*.rar: No such file or directory

From the following results it appears the *.rar is being taken literally, and not expanded. man glob gives no detail as to how it expands. Would someone kindly explain why? ~/Films $ls "Night of ...
66
votes
6answers
53k views

How to have Linux ls command show second in time stamp

Something annoying about ls -l command is it shows only hour and minute for a file(like 08:30). How can I see the second portion(like 08:30:44)? man 1 ls and search for 'second' does not give any ...
9
votes
2answers
1k views

ls version number sorting Mac OS X

Is there an equivalent to ls -v in Mac OS X that will do version number sorting? In Mac OS X, ls -v does NOT do version number sorting, but the Finder seems to.
9
votes
5answers
22k views

How to list files by file owner in Unix command?

I need to list all of the files my WD sorted alphabetically by the file owner name. Does ls have something for this?
35
votes
7answers
46k views

ls -d is not displaying directories. Is there a way to get ls to only display directories instead of files and directories

Is there a way to get ls to only display directories instead of files and directories From the man page. -d, --directory list directory entries instead of contents, and do not ...
5
votes
2answers
2k views

How can I get colors with “ls -l | more”?

ls -l gives me color coded output. Folders are blue, executables green, etc. These colors are gone when filtering thorough | more. Anyway to achieve both paged output and colors?
8
votes
2answers
10k views

How to `ls` a remote folder?

This one uses Samba: $ ls smb://192.168.5.4/wdtvlivehub/abc ls: cannot access smb://192.168.5.4/wdtvlivehub/abc: No such file or directory I somehow managed to do it by; Browsing to the remote ...
45
votes
7answers
78k views

How to list folders using bash commands?

Is there any way to list just the folders in a directory using bash commands? ( as the ls command lists all the files and folders )
4
votes
1answer
990 views

List files beginning with underscores first when using `ls -l`

I'm using ubuntu (natty), and when I use ls -l, the files are listed, but apparently the sorting algo ignores any special characters. For ages I've used underscores to mark special folders. And it ...
0
votes
1answer
253 views

Why does ls-l not display locate as a symbolic link?

I ran the command ls -l /usr/bin/locate and from what I have read it is a symbolic link to slocate. Attached is a screenshot of what is displayed. As you'll see it is different to the results above it....
0
votes
2answers
676 views

How can I have ls follow the content of a directory like tail -f does on a file

I want to basically continuously update the file list of a directory similar to how tail does with the -f flag on a file. is there any reasonable way to do this?
0
votes
3answers
292 views

what is the command for listing files/dirs recursively of specific directories

suppose in my current directory, I have 50 sub-directories. Now, I am interested only in about 20 of those sub-directories (whose names match a pattern). I would like to recursively list the contents ...
2
votes
1answer
707 views

Changing the order of columns displayed with `ls`

Is it possible to change the order of displayed columns when running ls -l on *nix (or dir on Windows)? For example, I'd like to see the date modified, then the name, then other fields (or select ...
2
votes
4answers
2k views

Alternatives to cd/ls for command line navigation?

I generally work a fair amount from the command line in order to launch vim, git, ssh and so on. However, I find the Finder's columnar view more natural for browsing through my files. Unfortunately, ...
7
votes
1answer
3k views

How to use wildcards with ls without listing directory contents?

ls typically displays only the files and folders in the present directory. But once you add a wildcard it starts searching in sub-directories. example: $ ls fight_folder file1 file2 $ ls f*...
1
vote
2answers
446 views

Why doesn't ls -lh show the total size of all the files and directories in each directory?

For example, it shows the kernel as being 18M but the Applications folder as being 3.8K BSD/Darwin
47
votes
2answers
15k views

Icon? file on OS X desktop

When I ls my Desktop from terminal (by using ls ~/Desktop), I see a file named Icon?. As far as I can tell, it's empty (nano Icon? shows nothing). It doesn't show up on my actual Desktop, and open ...
0
votes
0answers
122 views

MacVim prints 'ls' output whenever run via the 'mvim' command

Whenever I launch MacVim via the mvim command, I get the output of ls ~ printed to my terminal repeatedly for as long as I'm using MacVim: $ mvim base.theme.bash $ ActiveGSLocalData Music ...
6
votes
2answers
1k views

Mac OS X: Is there a straightforward way to color ls output according to Finder label colors?

I have a client with a directory tree that has a number of high-level directories that I need to have on my local development machine. I rarely look at them unless something goes awry. I've marked ...
0
votes
2answers
80 views

How to do an ls as if you were in the group 'other'?

In a linux system, I've done a chmod o+r -R mydir/ and I want to check that users in the 'o' group are able to read the contents of mydir. How can I do an 'ls mydir' as if I were a user in the other ...
11
votes
1answer
4k views

Making ls aware of “hidden” file flag

Is it possible to make ls aware of the hidden file flag on Mac OS X? Currently, a simple ls -lO produces: $ ls -lO total 0 drwxr-xr-x@ 84 danielbeck staff - 2856 29 Mai 22:44 Applications ...
3
votes
1answer
99 views

Specific ls output

Right now I'm calling the the following command ls -R and am receiving an output like this: .: file.txt script.php ./dir: file.txt other.java Is it possible to get the output to look like this: ./...
3
votes
1answer
347 views

what does the First character (number) mean in ls -l on OSX Snow Leopard?

I've included an abreviated sample of ls -lasF output from OSX 10.6.7 - the man page for ls does not discuss the first number (0,8,16,32,48,80,376) per line that is shown in this output. (/etc links ...
4
votes
3answers
6k views

Filter ls output based on file size

I want to filter the output of the ls command based on file size. Any .jpg or .png files greater than 100KB should be reported in the output. I've been able to filter the .png / .jpg files, but I'm ...
3
votes
1answer
4k views

How to remove the @ / extended metadata of a file?

I know that the @ in -rwxrwxrwx@ 1 me staff 0 16 Mai 10:55 myLog.txt means, that there is some extended metadata attached. Fine. Doesn't interest me. I need to know how to remove it ? I ...
0
votes
2answers
6k views

`ls /users/applications` is not listing my applications on OS X

I would like to install xdebug here on my Mac (Macbook pro 8,1 13" running OS X 10.6.6), but I need to get into my applications folder in order to get to my phpize file. When I type % cd /users/...
4
votes
1answer
1k views

In ls, how can I remove bg color for sticky bit

How can I remove the background color for the sticky bit. LSCOLORS looks like this export LSCOLORS="Gxfxcxdxbxegedabagacad" Using oh-my-zsh Edit: As suggested I tested LSCOLORS="" ls but the colors ...
2
votes
2answers
140 views

Where does the “l” command come from on my system?

My Ubuntu allows the use of l as a command to print out the current directory much like ls except that it is actually better in that it specifies which are folders, files, and executables. Is this an ...
17
votes
2answers
16k views

How do I limit the number of displayed lines through ls?

Let's say I have a command ls -Bgclt /somwhere/in/the/past How do I limit the output to show me only first 2 files? (except for having only 2 files in that directory)
0
votes
2answers
2k views

chained commands to create directories on a remote server

To get rsync cronjob working, I need to first create the dir tree on the remote server before running rsync. The local directories shall mirrored (w/o content) to the remote server. I'm strugglying to ...
8
votes
3answers
8k views

Recursive ls with conditions

Why can't I use a command like this to find all the pdf files in a directory and subdirectories? How do I do it? (I'm using bash in ubuntu) ls -R *.pdf EDIT How would I then go about deleting all ...
1
vote
2answers
127 views

Error with find and ls

I'm trying to use find and ls to sort files based on date, however, it's not doing anything. Here's my command: find ./.BUBackups -name "test*" -exec ls -t {} \; I also tried: find ./.BUBackups -...