The ls command lists the contents of a directory.

learn more… | top users | synonyms

0
votes
1answer
36 views

Is it possible to have total no. of blocks taken by same files be different on two PCs? [closed]

I used ls -l mysoftware/ on two different machines, each running ubuntu 12.04. But the 'total' returned by this command is different on the two machines. On one machine it is printing 6, and on ...
3
votes
2answers
67 views

What means the s in ls file permissions? [duplicate]

Have a quick question. Please see the below line ls -al -rws---r-x 1 root root 21872 2009-10-13 21:06 prg1 Compared to this -rwx---r-x 1 root root 21872 2009-10-13 21:06 prg2 That first line ...
7
votes
2answers
576 views

Why “ls” doesnt show the file that “find” discovered ?

(New to unix) In ubuntu When I am up in "/" folder i type sudo find . -name .erlang.cookie and the result is ./var/lib/rabbitmq/.erlang.cookie then when I am on the folder - /var/lib/rabbitmq ...
4
votes
3answers
480 views

What does 'l' in file metadata mean

When we type ls -l, we get meta data regarding all the objects in the current directory. The meta data has 10 dashes and the 1st dash indicates if the object is a directory or file or a link d ...
5
votes
4answers
807 views

maximum number of files ls can list [duplicate]

Im using a script to delete old file in a directory, but the script kept showing /usr/bin : Argument list too long It turned out the number of files were 40000 and more, So I want to know what is ...
0
votes
1answer
85 views

Understanding ls -l output

When I run ls -lrt command on a Unix folder , I get the following output MyServer> ls -lrt total 10 drwxr-x--- 3 UnixUser other 512 Jul 22 2011 FolderA lrwxrwxrwx 1 UnixUser other ...
5
votes
2answers
241 views

ls for cut -f string not working

I have a problem with feeding cut output to ls. This doesn't work: rep="S1_1000,0000-00-00c,0000-00-00d,0000-00-00e" ls tab_yeast/{`echo $rep | cut -f2- -d','`}*.tab.gz ls: cannot access ...
1
vote
1answer
112 views

Linux ls wrong date format

I try to find why when I do the command ls or whatever ls -la the column format is wrong with date. It should be like that: -rw-r--r-- 1 johndoe johndoe 55 janv. 26 2011 not like that : ...
2
votes
2answers
80 views

Very strange ls > textfile problem when viewing with emacs

I want to list the components of the current working directory in a text file ls -1 > textfile Output looks fine with more. 1010661085645 1010729039145 1010747080245 1010849051345 ...
1
vote
1answer
97 views

ls: show file size with thousand separator [duplicate]

Is there some simple way to make ls display the file size number with thousand (and million, billion, ...) separator? A sample output should look like this: $ ls -lAF /bin/ -rwxr-xr-x 1 root root ...
0
votes
3answers
564 views

Use of ls with wc command

What does the command : ls | wc -l do? I know wc <filename> gives lines, words, and characters, and wc -l <filename> print the line count. But how it is being used with ls` ...
19
votes
2answers
602 views

Is there a reason why ls does not have a --zero or -0 option

This question was prompted by questions about ls' -1 option and the recurring tendency of people to ask question and answers that includes processing the output of ls. This reuse of the output ls ...
2
votes
3answers
417 views

Where is “showing the output of the 'ls' command vertically” documented?

I found out it's possible to show the output of the ls command vertically using the -1 switch: $ ls -1 But couldn't find it in the manual of ls. Is it a secret option?
1
vote
0answers
57 views

Display full ISO time in OSF1

I am working on an HP OSF1 (Tru64) based server and need to display file listings with the full-iso time format style. Example of this in Ubuntu Linux, user@hostname:~/Desktop$ ls -lrt --full-time ...
4
votes
1answer
117 views

ls -l --group-directories-first (act on symlinks as well)

ls option --group-directories-first causes directories to be listed on the top, which makes the output of ls nice and clean: ls -l --group-directories-first However, it does not act on symlinks, ...
11
votes
1answer
154 views

Include colouring in GNU ls time-style

I know, I can specify custom time format for ls like this ls -lAF --time-style="+ %Y-%b-%d %H:%M:%S" --color=always but I would like to "smuggle in" colors inside the time format. For example, I ...
2
votes
3answers
251 views

Count number of characters per listed filename

Given the following ls result: $ ls Desktop Documents Downloads Music Pictures Public Templates Videos This will give the total number of characters for all files: $ ls | wc -m 67 But how ...
2
votes
3answers
146 views

Preserving color output with cut

Using bash interactively I am trying to use cut to prevent the lines from going longer than my terminal width. But when using a command with colorized output all the color gets removed by cut. For ...
12
votes
6answers
729 views

Why does “ls” require a separate process for executing?

Why does ls require a separate process for its execution? I know the reason why commands like cd can't be executed by forking mechanism but is there any harm if ls is executed without forking?
3
votes
2answers
165 views

dot instead of comma as thousand separator

I read about --blocksize for ls to get a thousands separator. However my computer gives me dot (.) and not comma (,): $ ls -l --block-size="'1" total 11.893.190.656 -rw------- 1 carlah users ...
3
votes
1answer
46 views

= sign at the end of .sock files in the ls output

I'm running the zsh shell in emacs. When I run ls I get a = at the end of .sock files. What does the = mean? Is it unique to unix sockets?
1
vote
3answers
440 views

How to turn off color with `ls`?

It is normally nice to have color output from ls, grep, etc. But when you don't want it, is there a switch that can turn it off? ls -G turns it on (with BSD-derived versions of ls) if it's not the ...
1
vote
2answers
827 views

Differing outputs of the commands “ls .*” and “ls *.”

The command ls .* when run gives as output the following : All the files in the current directory starting with a . (hidden files) All the files in the hidden directories present in the ...
6
votes
1answer
1k 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
85 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
878 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.
3
votes
4answers
3k 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
57 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: ...
3
votes
1answer
1k 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
213 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.
4
votes
3answers
199 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 ...
7
votes
1answer
434 views

What does a dot 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
222 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
3k 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
267 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 ...
2
votes
4answers
109 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
887 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 ...
2
votes
2answers
2k 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
47 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
799 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
83 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
83 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.
1
vote
2answers
251 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
2answers
396 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 ...
0
votes
1answer
194 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
119 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 ...
4
votes
3answers
397 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
121 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 ...
1
vote
1answer
86 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
313 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 ...