The ls command lists the contents of a directory.

learn more… | top users | synonyms

4
votes
1answer
470 views

What does the “@” (at) symbol mean on OSX ls? [duplicate]

When I check permission of less files from the command line on my Snow Leopard OSX system using Bash I see -rw-r--r--@ for certain files and for others I just see -rw-r--r-- What does the @ mean here? ...
1
vote
1answer
72 views

ls recursive on home dir only with no flags specfied other than color [closed]

Like the topic says whenever I am in my home directory and run ls it shows me every file in every folder recursively, I cannot find any documentation of why this would happen, I have been looking on ...
4
votes
6answers
595 views

ls with find :: report total size

I am trying to get the total size of files satisfying a find, e.g.: ls $(find -maxdepth 2 -type f) However, this kind of invocation of ls does not produce the total size as well.
2
votes
3answers
476 views

What do the fields in ls -al output mean?

The ls -al command shows the following output; -rwxrw-r-- 10 root root 2048 Jan 13 07:11 afile.exe What are all the fields in the preceding display?
1
vote
1answer
49 views

`ls` behavior on EACCES error for /root and /root/some-rubbish

I'm trying to code a clone of the ls command as part of a school exercise. I'm wondering why the following output is displayed by ls: $> ls -- -test_dir /root /root/some-rubbish ls: ...
4
votes
3answers
127 views

What could be the use case of changing modified time of a file to the future?

I was reading through the man page of ls on UNIX, specifically OS X Mavericks. This got me intrigued: If the modification time of the file is more than 6 months in the past or future, then the ...
2
votes
1answer
194 views

List a directory, including subdirectories, with file count and cumulative size

Is there a way to list out the content of a directory including subdirectories with a file count and cumulative size? I would like to see: Number of directories Number of sub directories number of ...
0
votes
1answer
124 views

Sorting with command ls in unix (ksh) [closed]

I'm wondering how does the sort works with ls. For example: ls - lrt tri par date ls - lSr par size, ... However I don't see how this pattern works.
6
votes
1answer
240 views

What does a “.” after the file permission bits mean?

I performed an ls -la on directory on my CentOS 6.4 server here and the permissions for a given file came out as: -rwxr-xr-x. I understand what -rwxr-xr-x means, what I don't understand is the . ...
6
votes
1answer
193 views

why ls reports a huge file and du does not?

When I run arm-none-eabi-objcopy -O binary add.elf add.bin everything seems to be ok. But, later when I run ls -lh add.bin add.elf this is the output I received: -rw-r--r-- 1 david david 2,6G nov 23 ...
3
votes
2answers
1k views

ls *.* gives: “*.*: No such file or directory” message [duplicate]

I'm using Linux app-server 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2+deb7u2 x86_64 GNU/Linux. When I go to a directory with several files named name1.php, name1.html, name2.php, etc. and type: $ sudo ls ...
8
votes
2answers
220 views

How do I columnate a list of items with minimal width?

How do I columnate any uncollumnated input like ls does? ls is creating an optimized table with minimum width for each row, for example: ls 2 dsao file with space with 5 e g ...
9
votes
4answers
7k 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
2answers
43k views

How to get only files created after a date with ls?

With ls command, does it possible to show only file created after a date, hour... I'm asking it because I have a directory with thousand of files. I want files created since yesterday. I use ls ...
3
votes
3answers
107 views

How can I list all files and symlinks in a compact view?

This is my setup in /tmp/test/ if I use ls -l -rw-r--r-- 1 rubo77 rubo77 0 Okt 21 04:15 a -rw-r--r-- 1 rubo77 rubo77 2 Okt 21 04:16 b drwxr-xr-x 2 rubo77 rubo77 4,0K Okt 21 03:58 c ...
2
votes
4answers
71 views

List only file size and name and symlinks

When I use ls -lah I get lots of information for each file. How can I get only the name and filesize? Additionally I would like to keep the listing of symlinks with the arrow like lrwxrwxrwx 1 ...
0
votes
1answer
304 views

When issuing ls in the /etc/ directory, I get “ls: reading directory .: Input/output error”

I have a Windows running a CentOS6 (32-bit) on a VMWare virtual machine. I am attemping to install a single-node Cloudera Hadoop according to these instructions. At one point I was asked to issue ...
0
votes
2answers
69 views

How can I for example list five largest files in /usr/lib -directory?

How can I for example list five largest files in /usr/lib directory? Please also add some minor explanation for each bit of code that you are using.
2
votes
2answers
459 views

How do I echo just 1 column of output from ls command?

Lets say when I do ls command the output is: file1 file2 file3 file4 Is it possible to display only a certain column of output, in this case file2? I have tried the following with no success: echo ...
-1
votes
2answers
42 views

How can the number of files in a directory be determined by viewing “ls -ld” output? [duplicate]

The command has to be ls -ld Just from viewing the output of this, how can I determine how many files are in this directory?
3
votes
2answers
270 views

Why does a new directory have a hard link count of 2 before anything is added to it?

Say I just create directory newDirectory and then I do ls -ld command. I see that the number of hard links is 2. What exactly makes the hard link 2 from the start? Also is the number of subdirectories ...
0
votes
1answer
70 views

How can number of subdirectories and files be determined from ls -ld command? [closed]

How can number of subdirectories and files be determined from the output of using ls -ld command? I realize that this command only lists the directories.
0
votes
2answers
265 views

Using `ls` recursively without -R

I am trying write a shell script that has output similar to ls -R without using the option -R. This is part of a programming assignment that forbids me from using -R, find and du. I need to identify ...
9
votes
2answers
2k views

What does the 'd' mean in ls -al results and what is that slot called?

In Linux, what does the d mean in the first position of drwxr-xr-x? And what are all of the possible letters that could be there, and what do they mean? I'm trying to learn more about the Linux file ...
1
vote
2answers
229 views

In a Bash if condition, how to check whether any files matching a simple wildcard expression exist?

Stupidly, I had been using a condition like this as part of a script: if [ $(ls FOO* 2> /dev/null) ] # if files named "FOO*" were downloaded then echo "Files found" # ... process and ...
0
votes
1answer
103 views

How to hide file size using ls command

I need to list some files in a directory using the ls command, but I need to also to hide the file sizes. How can I do that with the ls command?
1
vote
2answers
104 views

How to use `ls` to group and show only a first word of directory name?

I want to define a new ls command to do something like this The first when i use ordinary ls command: $ls undergrade.AI undergrade.KDD undergrade.AI2 undergrade.micro ...
6
votes
3answers
2k views

dircolors: modify color settings globaly

I understand ls uses dircolors to display colored output. dircolors has default database of colors associated with file extensions, which can be printed wiht the command dircolors --print-database ...
4
votes
3answers
288 views

How to inspect group permissions of a file

I would like to inspect group permissions of a file from a bash script. Specifically, I need to check whether a file has the group writeable bit on. That's it. Simple as that. However: I also need ...
3
votes
3answers
331 views

Different count for compressed file listing vs directory listing

I was taking a backup of a folder, where I used the following command : sudo tar -zcvf www.tar.gz /var/www/ It successfully compressed, just for verifying the number of files in the compressed ...
1
vote
1answer
75 views

What does * next to the file name mean in the output of ls? [duplicate]

I have a doubt related the output of ll command. When, in my shell, I execute the ll command I obtain this output: -rwxrwxr-x 1 andrea andrea 104215 ott 15 15:56 atmosfs* Why I have the * next to ...
0
votes
2answers
143 views

zsh alias being overridden somehow

I'm on a system running OS X 10.8.5. I recently tried to alias ls to ls -G -la command. I opened up ~/.zshrc, put in the alias, relaunched the terminal, but the change didn't take effect. Upon ...
-2
votes
3answers
177 views

make ls display current date and time

I'm new to Linux and I'd like ls to display current date and time as a side effect every time I use ls. How do I go about changing what a command does?
5
votes
2answers
2k views

What causes this green background in ls output?

There are two directories shown by 'ls'. Normally directories anywhere are blue on black background. But the first one is blue on green and impossible to read. Why is this? How to make it blue ...
6
votes
3answers
105 views

Excluding . and .. from results in find and ls

Is there any way to prevent find and ls -l from listing . and .. in their results? I never care about seeing this result in the output, and it prevents me from effectively piping their output to wc -l ...
1
vote
6answers
2k views

ls: Do not show directories that match same pattern in wildcard searches, only files

Supposing I have something like the following, a typical business PC situation: drwxr-xr-x 1 whatever whoever 3 Oct 3 16:40 invoices2009 drwxr-xr-x 1 whatever whoever 4 Oct 3 16:40 ...
3
votes
2answers
1k views

List subdirectories only n level deep

Festival stores voicepack data in the following example directory structure: /usr/share/festival/voices/<language>/<voicepack name> What is the simplest one-liner (preferably using ls) ...
26
votes
3answers
2k 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?
4
votes
2answers
262 views

'ls -l' file timestamp format

When I issue the command: ls -l The file/directory modification timestamp column (specifically the month part) is displayed in the native language of the country I'm based in instead of English. ...
1
vote
2answers
75 views

How to let `ls` display the results order in row first?

I type ls in my terminal, A0001 A0004 A0007 A0010 A0015 A0018 A0021 A0024 A0028 A0031 A0034 A0037 A0040 A0043 A0046 A0049 A0052 A0055 A0058 A0061 A0064 A0067 A0002 A0005 A0008 ...
4
votes
3answers
122 views

ls on device without mounting it

Is it possible to run ls on a device without mounting it first? Something like this: # ls /dev/sda1
20
votes
9answers
1k views

What's the most resource efficient way to count how many files are in a directory?

CentOS 5.9 I came across an issue the other day where a directory had a lot of files. To count it, I ran ls -l /foo/foo2/ | wc -l Turns out that there were over 1 million files in a single ...
3
votes
5answers
360 views

How can I concatenate a single column of output into a list?

I'm using: ls /proc | grep -v "^[0-9].*" to get a list of all the files and directories in /proc that don't begin with numbers. The output is a single column list, i.e.: acpi asound buddyinfo bus ...
2
votes
1answer
130 views

What file type categories do colors in the terminal represent in various distros (by default)?

I'm discovering new file type categories (if one can call different colors in the terminal in such a manner) almost on a daily basis. Still, I haven't found an exhaustive list of all recognized file ...
5
votes
3answers
175 views

How to ls using the long format (-l) while still following directory symlinks?

I've noticed that ls -l doesn't only change the formatting of the output, but also how directory symlinks are handled: > ls /rmn biweekly.sh daily.sh logs ... > ls -l /rmn lrwxrwxrwx 1 root ...
14
votes
6answers
9k views

How to match case insensitive patterns with ls?

I would like to list all files matching a certain pattern while ignoring the case. For example, I run the following commands: ls *abc* I need to see all the file that have "abc" as a part of the ...
2
votes
3answers
260 views

Command substitution in for loop not working

I want to keep all files not ending with .bat I tried for f in $(ls | egrep -v .bat); do echo $f; done and for f in $(eval ls | egrep -v .bat); do echo $f; done But both approaches yield the ...
10
votes
6answers
4k views

How do I list every file in a directory except those with specified extensions?

Suppose that I have a folder containing .txt, .pdf, and other files. I would like to list the "other" files (i.e., files not having the extensions .txt or .pdf). Do you have any advice on how to do ...
9
votes
4answers
15k views

Why is Debian's root shell colorless?

Are there any security concerns? What is the best way to enable it?
4
votes
3answers
1k views

Sorting files according to size recursively

how to scan a folder recursively and find the largest files in the folder, and sort them by size. I have tried using ls -R -S but it tends to list the directories as well I need to scan the folders ...