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

learn more… | top users | synonyms

39
votes
2answers
9k views

Icon? file on OS X desktop

When I ls my Desktop from terminal (by using ls ~/Dekstop), I see a file, 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 Icon? ...
0
votes
0answers
109 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 ...
5
votes
1answer
952 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
79 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 ...
9
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
97 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
339 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
4k 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 ...
2
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
4k 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 ...
4
votes
1answer
794 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
138 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 ...
15
votes
2answers
12k 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
1k 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 ...
6
votes
3answers
7k 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
121 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 ...
10
votes
1answer
15k views

ls | grep | rm — How to format this command?

I'm trying to delete a bunch of files in a certain directory (on Mac OS X using Terminal) ls | grep \([1-9]\) | xargs rm should do the trick, but it doesn't. I'm trying to delete any file with a ...
8
votes
3answers
7k views

Show both ctime and atime in ls output

Can I get both ctime and atime in ls output? Seems I can only pass one --time=ctime or --time=atime argument (the second is ignored). Is there any other way?
13
votes
2answers
6k views

How to diff file names in two directories (without writing to intermediate files)?

I am trying to do something along the lines of: diff `ls -1a ./dir1` `ls -1a ./dir2` But that doesn't work for obvious reasons. Is there a better way of achieving this (in 1 line), than this? ls ...
2
votes
3answers
4k views

How to recursively list all files with timestamps and full path?

I want to recursively list all files in a given directory, with their full path and their timestamps. Something like this: 10:30 Dec 10 2010 /tmp/mydir/myfile I've tried with: find . -type f -exec ...
5
votes
4answers
723 views

How to turn off --classify option in ls command?

My ls command is aliased to have certain options automatically applied, including --classify (same as -F) Normally this is fine and I don't want to screw around with my .bashrc file. Just this one ...
2
votes
4answers
4k views

Run an ls without getting the full path

I want a simple list of files in a directory that is not my current directory. I run ls /other/directory/*.txt and get: /other/directory/file1.txt /other/directory/file2.txt I want: file1.txt ...
2
votes
3answers
5k views

How to display only Permissions and file names using ls command?

How can I display only Permissions and file names using ls command and how to list all files in a directory including full path, owner, group and permissions for each file?
2
votes
2answers
10k views

Unix - List all directories and subdirectories, excluding directories without files

I would like to list all the directories and sub directories in and below the current path. Since I only wanted to display directories I came up with the follwing command: find -type d -exec ls -d1 ...
1
vote
1answer
247 views

What is the difference between 'ls *.py“ and ”ls *py"?

This happens in cygwin (CYGWIN_NT-5.1 MYPC 1.7.5(0.225/5/3) 2010-04-12 19:07 i686 Cygwin) First command, ls *.py shows nothing $ ls *.py ls: cannot access *.py: No such file or directory First ...
4
votes
1answer
4k views

What does the + mean in the output of “ls -l”?

ls -l -rwxr-xr-x 1 root root 885 2010-07-08 13:55 /etc/backup-number-of-files* -rwxrwxr-x+ 1 levchuk Users 1067 2010-08-30 14:37 /etc/backup-running-time* Please notice the + on the 2nd ...
4
votes
3answers
11k views

ls -rt (How to list just THE LAST file? e.g. for: | xargs gnome-open)

e.g. directory containing jpeg files: how to easily open just the most recent jpeg in the current directory?
3
votes
2answers
5k views

How to sort ls by column in Ubuntu via piping to sort?

I'm a Linux newbie trying to learn how piping works in the Ubuntu terminal. I tried to sort by file size: ls -al | sort -k5 The files were listed in this order: drwx------ 19 min10 domain users ...
2
votes
1answer
757 views

Overwrite ls in .bash_profile

I'm new to bash and unix. I'm trying to create an alias for ls. In my .bash_profile I have the following: alias ls="ls -lhHG" This doesn't work at all. If I change it to: alias la="ls -lhHG" ...
11
votes
7answers
16k views

How can I list only non-empty files using ls?

How can I list (using ls) all files that are not empty (size > 0) using linux?
30
votes
6answers
18k views

How do I get ls --color=auto to work on Mac OS X?

I'm trying to move my bash configuration from Ubuntu to Mac OS X and it looks like ls is slightly different. For instance, it won't accept the --color option. How do I get this to work?
34
votes
5answers
43k views

what does the asterisk mean after a filename if you do ls -l

I've done an ls -l inside a directory, and my files are displaying like this : james@nevada:~/development/tools/android-sdk-linux_86/tools$ ll total 9512 drwxr-xr-x 3 james james 4096 2010-05-07 ...
0
votes
2answers
479 views

How do I interpret “total 18” in the output of the “ls -l” command in Solaris10?

auyantepui# ls -l total 18 drwxr-xr-x 2 root sys 512 May 23 13:11 READMEs/ drwxr-xr-x 2 root sys 1024 May 23 13:11 bin/ drwxr-xr-x 2 root sys 512 May 23 13:09 docs/ drwxr-xr-x 2 ...
21
votes
2answers
13k views

How do I interpret the results of the `ls -l` command?

I want to learn about the meaning of values for example first line; drwxr-xr-x 2 ataka root 4096 2008-11-04 16:58 ataka is ataka here the owner of directory ? kioutsovkm@orkide:/users/lnxsrv2/ee$ ...
5
votes
1answer
2k views

Ubuntu's ls can show unicode characters, but tree cannot, even with tree --charset unicode

Ubuntu 10.04's ls can show unicode characters, but tree cannot, even with tree --charset unicode or utf8. Is there a way to solve it. echo could interpret the escape characters except cat list.txt | ...
3
votes
3answers
1k views

Is there a tool on Unix, Linux, Mac, Windows, Ubuntu, that will list file / directory structure?

I wonder if there is a tool that will list file / directory (i.e. take a snapshot of the folder and file structure) like the following: audio mp3 song1.mp3 some other song.mp3 audio books ...
36
votes
7answers
13k views

What does the @ mean on the output of “ls” on OS X' terminal?

When doing an ls in a directory I get the following output: 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 ...
1
vote
1answer
685 views

the commands ls and get of ftp are not working in vmware

Iam using vmware player version 3.1 to boot a minix 3 os image. After booting the minix os I want to get some files from a server using ftp. the ftp connection to the server works but when i use the ...
3
votes
2answers
9k views

How can I sort ls by owner and group?

How can I list directories with ls and sort them by their owner and group?
1
vote
1answer
384 views

How do I change the color of binaries listed by 'ls'?

In Mac OS X, when I do ls the binary files have red color, how change this color to green? Similar to other Unix.
43
votes
10answers
29k views

Unix: ls, how to sort first directories then files etc

I would like to use ls command to first show direcotries and then files. I tried ls -la | sort -k 1 But I got a wrong order.
2
votes
2answers
2k views

ls in cmd window gives one hour off time

I have ls installed on my Windows XP computer. It came with msysgit. I've had it a while and it turns out I use it quite a lot even in the DOS prompt. More than dir. The thing is that it gives me ...
0
votes
3answers
1k views

Bash: overridding ls -la with ls -la | more (basic bash scripting problem)

Pretty new to bash scripting. Trying to over ride the ls -la command to be: ls -la | more (Seems more useful for me). I added this to the end of my .bashrc. 154 # alias 'ls -la'='ls -la | ...
0
votes
1answer
332 views

Would linux map the owner id of files coming from other computers to the account name in /etc/passwd?

When I use ls -al to show files downloaded from internet, -rw-rw-r-- 1 427 6011 7544 Jul 20 2006 INSTALL -rw-rw-r-- 1 427 6011 4229 Dec 9 15:36 Makefile.am -rw-rw-r-- 1 427 6011 27893 ...
1
vote
1answer
928 views

Why are some files in ls -l on Mac OSX (Snow Leopard) tagged with “@”? [duplicate]

Possible Duplicate: What does the @ in ls -al mean? When doing an ls -l some files are tagged with "@" like this: -rw-r--r--@ 1 master staff 2074042 Feb 3 19:26 ...
2
votes
2answers
3k views

List files based on modification times

How can I run the ls command with all its options and list all files in directories recursively and sort it based on last modification times? ie ls -lth on all files in directories recursively
3
votes
2answers
2k views

directory listing on Mac OS X

I dumped a bunch of files (music and otherwise) onto my shiny new Macbook, and since I'm more comfortable with linux than Mac (at this point) I tend to use the terminal. I did a ls -al on the files ...
0
votes
1answer
1k views

Total folder size with ls -lh

I created a directory where I put ten files, each one with exactly 1,048,576 characters (1024^2). The size of each one of them should be exactly one megabyte, counting megabyte as 1024^2 bytes. If I ...
6
votes
4answers
1k views

Pass the output of ls to diff

I have one file that contains a list of files from a server, and a local folder that I compare to that manifest. Obviously, I do 'ls -1 > listing_local' and then diff that file with listing_server. ...
12
votes
8answers
26k views

Tell `ls` to print only the base filename

This is the default behaviour of ls ls /net/nas/data/languages/pypm/sites/rex/free/2.6/*/pool/v/vi/virtual*1.4.4*pypm ...