The ls command lists the contents of a directory.

learn more… | top users | synonyms

3
votes
1answer
50 views

OS X: Can `ls` show broken symlinks?

When in Linux, I enjoy having \ls -l --color=auto show broken symlinks with red text for the name of the symlink and blinking text for the missing linkee. But in OS X, \ls -lG (the closest thing I ...
0
votes
2answers
67 views

What does “ls --dired - l” or “ls -D -l” actually print?

ls --dired -l prints all dir and files along with some number followed by //DIRED// ***66 69 122 131 ....*** //DIRED-OPTIONS// --quoting-style=literal What do these numbers in bold mean? --dired ...
3
votes
1answer
40 views

How to list files named like XXXmmyy.dat in natural chronological order?

I use a Mac OS X (V10.9.5) and work in the X11 window, and I often need to deal with thousands of files named like XXXmmyy.dat, where XXX is a 3-letter acronym of a place, mm is the 2-digit month, and ...
1
vote
1answer
28 views

Only color files according to file types? [duplicate]

When using ls to list files in a directory, the files are colored according to their access permissions. Is it possible to color the files only according to their file types (e.g. a regular file, a ...
1
vote
1answer
103 views

ls -l without file permissions

How can I use ls while using -l (long listing) without showing the file permissions? Right now I have the following alias for ls: alias ls='ls -lhaG --color=auto' I have found a solution close to ...
1
vote
2answers
103 views

Changing colors used by `ls` does not work in Emacs “Shell” mode

I followed http://unix.stackexchange.com/a/94508/674 to change the colors used by ls. This works in bash. When I open a buffer of "Shell" mode in Emacs (M-x shell), the change doesn't work. I wonder ...
10
votes
4answers
477 views

List files that match a pattern but ignore files that match another pattern?

Let's say I have a directory with files a1, a2, a3, b1, b2, b3. I only want to match files that start with a but don't contain 3. I tried ls -I "*3" *a* but it returns a1 a2 a3, even though I don't ...
8
votes
5answers
1k views

Why does “ls -all” show year or time?

If you issue ls -all command some files or directories have the year and some have the time? Why do some show the year while others show the time? Is the time representative of the time the file was ...
1
vote
2answers
60 views

Finding a file which has “info” in its title

By using the ls command I can list the names of all the files in the directory I am working with. However, how do I list all of the files in the directory which have contained in their title info? So ...
3
votes
3answers
92 views

Why size reporting for directories is different than other files?

I was wondering why an empty directory occupied 4096 bytes of space and I have seen this question. It is stated that space is allocated in blocks and hence, the size of a new directory is 4096 bytes. ...
0
votes
0answers
83 views

Cannot see files present on server when connecting via Filezilla / SFTP

I am not able to see the files present on the server using Filezilla ftp client. I am using SFTP connection. I am able to connect to the server. I can see only the directories but not the files. ...
3
votes
1answer
20 views

How can you group symlinks with directories in `ls` output but tell the difference?

In ls output, I'd like to group symlinks that point to directories along with the rest of the directories, but still have a way of telling that it's a symlink either with color or an appended symbol. ...
0
votes
2answers
126 views

Script that list file names by first letter bash type [closed]

I need a script that takes input from the user which specifies the first letter of the file names to be displayed, so that only file names starting with the letter specified are listed. I only need to ...
-3
votes
2answers
338 views

List all files that end in “ball” using ls command [closed]

I am trying to use ls command to find specific files that Have 4 letters in front of the word "ball" Must have the ending word "ball" I have been trying to use ls *ball but this shows words with 4 ...
1
vote
2answers
61 views

How to extend the ls command by a custom column

I wonder if it is possible to modify the ls -l command by a custom column. For example, I would like this column to contain for each file, say, the first line of $(CustomCommand FILE).
4
votes
5answers
599 views

How to list the n'th youngest file (without parsing ls!)

So I know parsing ls is bad!. Today I found this nugget: FILENAME=`ls -t $READ_FOLDER | head -1` So I believe originally this was designed to grab the newest filename, I actually now want to adapt ...
1
vote
3answers
57 views

How to list atime for files?

According to this post can stat be used to give the atime on Linux, but FreeBSD 10.1 doesn't have the GNU stat. How do I list the atime for files?
4
votes
1answer
93 views

Non-standard sorting of the ls output

I usually include a date in the filename so that files and directories are listed in chronological order when I use the ls command, e.g. 2015-08-29_letter_to_santa.txt. A drawback is that ...
1
vote
1answer
69 views

How to know if output is being redirected to a file? [duplicate]

I am working on displaying output like ls command (just ls, no options). And I have a working program using the system calls. But I experienced a strange behavior while testing as shown below. $ ls ...
2
votes
5answers
70 views

Making a *nicely* formatted list of number of files in directories - awk & sed probably

I have lots and lots of files in a series of directories, and would like a nicely formatted list of how many files are in each directory. The directories are ordered thus: Parent directories named ...
1
vote
0answers
19 views

LS_COLORS mixing matching criteria, e.g. file extension and hardlink

I'm wondering if there is a way to keep the characteristic color of the extension type in ls --color=auto as well as underlining the file if it is a hard link. For instance, if I do ...
3
votes
1answer
83 views

“Display all <num> possibilities? (y or n)” for ls command

When I attempt to tab complete a filename in the bash prompt, and the output would be many (>100) filenames, the shell asks Display all <num> possibilities? (y or n) Can I replicate this ...
2
votes
1answer
238 views

Why root bash output is colored but `sudo ls` output is not?

In bash (I am using Ubuntu 12.04) I get colored outputs either as root (after sudo su) or as a normal user. I checked (after reading this post) the files .bashrc for normal user and superuser and ...
0
votes
1answer
99 views

get list of files which are unique

I have a directory in which files are created as abc.sh.ID.datetimestamp.id.log In the filename abc.sh, the ID is always the same (there are 1000's of .sh's and ID's combination in the environment). ...
5
votes
1answer
70 views

Is it possible to make ls ignore Windows hidden files?

I'm using the GnuWin32 libraries on a Windows 7 machine. Everything is working fine except that the ls command is showing all of the NTFS hidden files. The solutions I've found for this so far all use ...
0
votes
4answers
458 views

Single line command to cat last file in ls -lrt output? [duplicate]

System log files are serialized and I use ls -lrt to show me the most recent file. I then cat that file. This requires typing a long serial number each time. How can I cat the last file appearing in ...
4
votes
1answer
120 views

ls -l numbers between the size and the group

when I run ls -l /dev/null /dev/zero /dev/tty I get: crw-rw-rw- 1 root root 1, 3 Aug 9 09:05 /dev/null crw-rw-rw- 1 root tty 5, 0 Aug 9 09:05 /dev/tty crw-rw-rw- 1 root root 1, 5 Aug 9 09:05 ...
0
votes
2answers
114 views

Get number of files in each directory [duplicate]

I have a directory with a very large number of subdirectories (~800) that were generated programmatically. I want to get a count of the number of files in each of these subdirectories to check for ...
0
votes
2answers
851 views

What is the alternative for ls command in linux? [duplicate]

How can I list the current directory or any directory path contents without using ls command? Can we do it using echo command?
2
votes
2answers
69 views

How can I list files by class/indicator (as in ls --classify) then by name?

ls --clasify append indicator (one of */=>@|) to entries. I would like to group the entries of the same class/indicator together. I can only find ls --group-directories-first for grouping the / ...
0
votes
0answers
22 views

To list only the file names in a present working directory using unix shell command [duplicate]

There are some links,directories and files in my path. I want to list only the file names eg. logfile1 redolog1 dumplog1 logfile2 lrwxrwxrwx spsy spec Jun 23 2343243 jpeg --> ~/home/s/jpegs ...
0
votes
0answers
26 views

how to list only files on Unix using ls command? [duplicate]

for listing only directories in Unix i can use ls -ld */, how to list only files? problem - I have some of files and directories in a directory, i want list only files
0
votes
1answer
53 views

ls displays files copied from an external drive with a yellow background

I copied some files from an external drive and now they appear with a yellow background under my ZSH shell on OSX. I believe that its a permissions thing as the normal ones display "drwxr-xr-x" and ...
2
votes
1answer
295 views

How to do ls with a wildcard and see the directory name

I have a directory called selenium_IDE if I do ls sel* I get to see directories that are in it, e.g. $ ls sel* HAPPY HAPPY_PLUS_OPTIONS SAD SAD_PLUS_OPTIONS but ...
1
vote
0answers
32 views

Who is this UID and GID? [duplicate]

When I do an ls -l on my ubuntu machine it shows the number 6226 as the UID and GID for some directories. Why? Most files and directories are owned by root, or by ubuntu (which is my usual login ...
0
votes
2answers
101 views

How to find all .zip and .rar files recursively and sort them by size [duplicate]

I am looking for all .zip and .rar files in comp_tuts folder and I am intersted in showing their file sizes and sorting them from biggest to smallest. I have tried ls -R *.zip ls: cannot access ...
0
votes
2answers
339 views

ls command lists hidden files

When I run ls command I get files like opencv.sh~ in my output which is not visible if I check the home directory. Basically, it also lists hidden files without supplying any other parameter. How can ...
2
votes
1answer
83 views

Why is vdir still around?

After installing Debian 8, I started poking around /bin (as I'm always wont to do), and I noticed that ls and vdir share, not only the same manpage (except for the whatis line), but the exact same ...
1
vote
1answer
65 views

Got weird result when executing bash command “cd /usr/share/; ls *z ”

I know the meaning of * wildcard But when I use Ubuntu 14.04 and type following command: $ cd /usr/share/ $ ls *z But why the part of the result is like this:    ...
0
votes
5answers
178 views

List only the count of all files/directories for the directory tree of present directory

I want to list the number of directories under each subdirectory tree of the present directory. As there are too many directories, I can't go into individual directories and check. I would like to ...
3
votes
2answers
257 views

rm not deleting file, thinks its a directory

I have a hard drive with windows loaded on it hooked up to my Linux machine for backing up some of the information. I want to delete one of the 'temporary internet files' folders and it deleted all ...
1
vote
1answer
116 views

Listing directories and understanding ls

On ls man page, I saw this -d, --directory list directory entries instead of contents, and do not dereference symbolic links on my current folder: drwxr-xr-x 2 oracle oinstall 4.0K Jul ...
0
votes
2answers
67 views

Is there a way to list files before mounting a disk partition

Suppose there are several partitions in my computer. I'm not sure where is the folder I have to access. Usually what I do is mount all the partitions first and then search one by one. Is there a way ...
0
votes
0answers
154 views

How to check if the shell script created a new error log file in a folder with the same shell script? [duplicate]

I am trying to check if the new file is created in the specific directory or not when I run the shell script. Here, I am creating a new file through the shell script itself and then checking whether ...
10
votes
6answers
672 views

How do I display the nth result of an ls command?

I used this command to display the first result of files in my directory. ls | head -n 1 My simple question is, how can I modify this command to display say the nth result? Thanks!
1
vote
5answers
517 views

list all files with extension .log except one

I would like to list all files with extension .log except the file backup.log. I have tried using this command: ls *.log -I "backup.log" But all the log files are listed, even backup.log! How ...
0
votes
2answers
42 views

Why is there a minor number in /dev for directories such as pts?

This is a part of /dev in CentOS 6.6. What is the meaning of the minor number for directories like ., .. , bsg, block and ... ? drwxr-xr-x. 18 root root 3800 Jul 3 06:00 . dr-xr-xr-x. 21 ...
0
votes
1answer
415 views

Meaning of chmod 1775

Created a folder "Sample_dir" and analysed its permissions. $ mkdir Sample_dir $ ll Sample_dir/ total 36 drwxrwxr-x 2 user user 4096 Jul 1 19:26 ./ drwx------ 71 user user 28672 Jul 1 19:26 ../ ...
1
vote
2answers
282 views

How to use logical OR in find?

In bash shell ls can use a logical OR functionality through (of course I could also do ls name1 name2 but my true examples are more complicated): ls @(name1|name2) Is there a way to do this using ...
2
votes
1answer
268 views

sudo ls not showing hidden files on Linux

Today I discovered that sudo ls shows hidden files (that is, those that have names starting with .) on OS X. This surprised me so much that I asked a question about this behaviour, which I still find ...