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

learn more… | top users | synonyms

4
votes
2answers
3k views

What does the number after Unix/Linux file permissions like “-rw-rw-r--. 1 ” mean in “ls -l” output

Can any one explain "-rw-rw-r--. 1 " and give some "detailed" information on ls -lart command. Why does the number change after "-rw-rw-r--. 1 " <----
1
vote
2answers
215 views

How do I list only source code files when I type ls on OSX?

when I type ls, I don't want to see .o files because everytime I ls, It see X.cpp X.h X.o, how do I not list .o files?
1
vote
1answer
348 views

What's permission 's'?

I did a ls on my /bin in OS X. I got the following output. What's the 's' permission in rcp line? /Users/snihalani/.oh-my-zsh on master at 11:12AM ➜ lsa /bin --------------.oh-my-zsh-------------- ...
3
votes
1answer
425 views

ls -l shows file size 0 of files in /proc, but cat produces content

# cat /proc/version Linux version 2.6.18-308.8.2.el5.028stab101.1 (root@rhel5-build-x64) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)) #1 SMP Sun Jun 24 20:25:35 MSD 2012 # ls -l /proc/version ...
1
vote
2answers
853 views

How do I recursively list the contents of all files in a repository (extension-agnostic) into a single text file?

I know that using "ls -R ." in bash you can recursively list the filenames. Can I use some similar command to list the contents of each file just the way their names are displayed using the ls ...
19
votes
3answers
3k views

How can I make “ls” show dotfiles first?

Somewhere along the way I screwed up my ls command and now I get this ordering when running $ ls -AhHl --color=auto -rwxr-xr-x 1 clang clang 640 Mar 1 02:46 apple-touch-icon-precomposed.png ...
0
votes
1answer
86 views

Bash Profile Coloring

I would like to make a few changes to my bash profile. Changes I would like include: Coloring Files: I would like files with the execute permission bit set to be colored green. I would like to ...
4
votes
3answers
1k views

What is user/owner 24561?

So, I just installed the node.js package from nodejs.org and I was poking around to see what it installed. Over in /usr/local/bin I saw this owner 24561. I see it in a few other places too. What is ...
6
votes
2answers
997 views

Is there a tail -f equivalent for ls?

Basically the question is in the title. I want to monitor a directory for new files that are written or deleted, the way I can monitor a log file with tail -f. Is this possible?
1
vote
1answer
214 views

Formatting pwd/ls for use with scp

I have two terminal windows with bash. One is local on the client computer, another one has an SSH-session on the server. On the server, I am in a directory and seeing a file I would like to copy to ...
1
vote
1answer
457 views

Accidentally removed read permissions from folder. How do I get back in?

I wished to have a given folder and file and all descendants, write permissions. I wished that ALL files and folders could be recursively granted he following permissions: 777 So I tried: chmod -r ...
0
votes
2answers
208 views

How can I hide .un~ files when I run “ls” in OS X?

Is there any option I can pass to ls to hide .un~ files from the output? I want to be able to see all files (e.g. dotfiles) except .un~ files, so I need to run ls -A and add something to hide the ...
0
votes
1answer
1k views

Compare content of directories in Linux

In Linux, if I have two directories, how I can see the differences of content in these directories? Now I use this command: diff <(ls -d dir1/*) <(ls -d dir2/*) Any other idea?
0
votes
4answers
926 views

Using the ls -l with a pipe how can i get it to display the 8th file in the list without the file details

I am looking to display the 8th file name in a directory using ls -l and pipe for example ls -l | wc -1 would give me the count but what i want to have returned is the 8th file name in the directory ...
0
votes
1answer
2k views

iTerm2 loses “ls” colors if I ssh to a server

Why do I lose ls' colors when I ssh to a server? I would like those colors to be preserved. Is this possible? Should one do something on the server side?
-1
votes
1answer
680 views

ls -al list order re-arranged on osx terminal - can't we do this?

Does anyone know a way to re-arrange the ls -al returned list in a way that: a) Directories first, files after; and b) Date first, name second and permissions at the end and c) Without losing ...
16
votes
2answers
2k views

What is the magic separator between filenames in ls output?

The output of ls (with no arguments) appears to separate filenames with linebreaks. Evidence: ls | grep foo works as expected, with grep treating each filename as a separate line of input. ls > ...
0
votes
1answer
283 views

list files with full modification date

I want to produce a list of files in a directory and feed it into a script to generate database entries including their creation dates. The database is Solr, so I need to be able to translate ISO 8601 ...
5
votes
2answers
1k views

is there a way to read the cumulative size of all files in a folder?

I want to read the size of a folder from the command line. ls -lh shows all folders as being 4k, which presumably is the size of the footprint of the folder itself, rather than the contained files. ...
1
vote
1answer
696 views

“ls -t remotefile localfile” does not work over FTP

I'm interested in listing remote files (with names matching a pattern) by date, and storing this list locally. The various things I've tried follow: ls -t SL*.txt ...is interpreted as a request ...
8
votes
6answers
25k views

how to list all files and directories in given directory with full path but not recursive?

Somehow like dir /b command but I need also hidden and system files there. Built in dir command doesn't allow to list such 'hidden' files with the rest and I must use /s to have full path in there, ...
10
votes
4answers
5k 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
76 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
3k 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
833 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
148 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
258 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
725 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 ...
1
vote
1answer
2k 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
127 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 ...
5
votes
2answers
2k 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
120 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? ...
3
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
125 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
1k 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
406 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?
2
votes
2answers
120 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
316 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 ...
38
votes
3answers
25k 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 ...
5
votes
2answers
914 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.
7
votes
5answers
13k 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?
29
votes
7answers
31k 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
1k 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?
4
votes
2answers
6k 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 ...
42
votes
6answers
61k 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
841 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
219 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 ...
0
votes
2answers
519 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?