The ls command lists the contents of a directory.

learn more… | top users | synonyms

1
vote
5answers
49 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
11 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 and underline the file if is a hard link. For instance, if I do ...
3
votes
1answer
45 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
89 views

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

In bash (Ubuntu) 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 the options related ...
0
votes
1answer
36 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, ID are always same (there are 1000's .sh's and ID's combination in environment). datetimestamp ...
5
votes
1answer
38 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
42 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
96 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
49 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
106 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?
1
vote
2answers
24 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
21 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
25 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
27 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
268 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
31 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
54 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
89 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
49 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
52 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
93 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 directory and check. Something like the ...
3
votes
2answers
132 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
69 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
47 views

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

Suppose there are several partition in my computer. So I'm not sure where is the folder I have to access. usually what I do is mount all the portions first and then search one by one. Is there a way ...
0
votes
0answers
79 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 ...
8
votes
6answers
603 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
146 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
34 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
110 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
139 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
226 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 ...
0
votes
0answers
84 views

Completely hidden directory on ACFS imported via NFS

how is this possible: [root@oda001-d0 .ACFS]# pwd /OVS/Repositories/repo1/.ACFS [root@oda001-d0 .ACFS]# ls -la .. total 148 drwxr-xr-x 8 root root 4096 Jun 23 11:45 . drwxr-xr-x 5 root root 4096 ...
0
votes
1answer
32 views

Find directory names with N occurences of a set of characters

Sorry in advance, I know there are hundreds of posts about find, but I genuinely don't understand what's happening here and haven't been able to find a definitive answer to this question: how to match ...
1
vote
1answer
91 views

change LS_COLORS behaviour

I am trying to modify LS_COLORS behavior. Presently it (say for sh or py), changes color depending on if it is executable or not, as shown here But, I want all my script, executable or not, have ...
13
votes
7answers
2k views

What to use when the “ls” command doesn't work?

I tried to use the ls command and got an error: bash: /bin/ls: cannot execute binary file What can I use instead of this command?
11
votes
1answer
864 views

'ls' showing two identical files in a directory

So somehow the command ls seems to be showing me two identical files in a directory. I am certainly not doing something right here. Behold $ ls -Blah /System/Library/LaunchDaemons total 32 ...
0
votes
1answer
41 views

How do I make 'sudo ll' work? [duplicate]

Every once in awhile, I find myself needing to list files in a directory that I don't have execution permission on. So I do a sudo: >sudo ll /opt/mydir [sudo] password for civfan: sudo: ll: ...
1
vote
4answers
509 views

How to use regex to match a pattern which does not have a specific string at the end

How to use a posix bre or a posix ere regex to match a word which does not have bak at the end. I want to do a ls | egrep '<regex>' to find all files which DO NOT have bak at the end of ...
1
vote
1answer
75 views

why grep does not print the entire line? [duplicate]

When I enter ls command I get the below output. -$ ls aNode ANode bNode BNode cNode CNode DUMP file1 hello.txt TEST.txt -$ As seen, above output is one line which has filenames separeted ...
4
votes
1answer
153 views

Permission errors even permissions are wide open

I installed anaconda on our new VM and I can't list it's contents. I can change my directory to .../anaconda/ but when I type ls -l I get: ls: cannot open directory .: Permission denied However, ...
0
votes
3answers
43 views

What rights signify when using ls -l? [duplicate]

When I type ls -l and press enter I get a list of files, with details about each file. Next to each file there is permissions and rights for each file. What do they mean? For example: -rw-rw-rw- I ...
0
votes
1answer
58 views

How to create a bash script that sees all files in a directory and tells me their size and date of creation?

I'm a beginner in the field of programing/coding. I'm trying to write a simple bash script that will see all files in a directory, and then tell me each file's size and each of their dates of ...
2
votes
5answers
157 views

Get Comma Delimited List of Initials of Items in Directory?

How can I generate a comma-delimited, case-insensitive list of the first characters of the names of the files and directories in a directory, excluding initial "." items, without duplicates? I don't ...
0
votes
1answer
70 views

What does this ls command do? [duplicate]

what does this command do if it was executed in my current working directory that has files in it? ls 2> result I think whatever ls writes will be redirected to the result file? Is that correct and ...
20
votes
9answers
2k views

Find files whose name is 4 characters long [duplicate]

I would like to find files whose name has only 4 characters. Example, there are three files under /tmp: $ ls /tmp txt file linux Output should only show file because it only has 4 characters.
4
votes
2answers
128 views

ls -e option not available in linux

I have shell scripts that run on Solaris UNIX that use the -e option on ls to ensure the same format for all files regardless of their age. This option is not available on Linux. The exact same ...
1
vote
2answers
42 views

User cannot see directory permissions

I'm working in Ubuntu 3.13. The permissions on a drive are such that the owner can see directories and files with these permissions: drwxrwxr-x 2 michael atlas 4096 Feb 15 12:34 temp2 ...
0
votes
4answers
68 views

Why does my “ls -a-l /home” not work?

Marias-MacBook-Air:~ mariasharapova$ ls -a /home . .. Marias-MacBook-Air:~ mariasharapova$ ls -a-1 /home ls: illegal option -- - usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...] ...
-1
votes
1answer
85 views

list files in ascending order

I am trying to display file names(with complete path) based on the created timestamp in ascending order. if files exists: display files with complete directory path in asc order. if files do not ...
3
votes
2answers
191 views

change file size format when using stat

The formatting character %s makes stat print the filesize in bytes # stat -c'%A %h %U %G %s %n' /bin/foo -rw-r--r-- 1 root root 45112 /bin/foo ls can be configured to print the byte size number ...