The ls command lists the contents of a directory.

learn more… | top users | synonyms

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
37 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
58 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
47 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
50 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
88 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
119 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
59 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
46 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
64 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 ...
7
votes
6answers
587 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
114 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
32 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
67 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
133 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 ...
-1
votes
0answers
20 views

What does ls > list do, what does ls >> list do? [duplicate]

I have been asked to explain how and why ls > list and ls >> list are different, unfortunately I don't even know what either of these do :( Also when I typed them into Linux nothing seemed to ...
2
votes
1answer
216 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
71 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
28 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
72 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 ...
11
votes
1answer
840 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
38 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
335 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
54 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
146 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
41 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
50 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
144 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
62 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

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
111 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
39 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
67 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
62 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
170 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 ...
0
votes
2answers
39 views

'+' and 's' in permission strings

If the ls -l command gives me a permission string like rwsr-s--x What does the 's' mean? The only sources I found mention that it can be present sometimes but do not elaborate. What does a '+' ...
0
votes
1answer
12 views

see newest release last (YML release files with the same timestamp from Git)

I pull from Git *yml files with "$packagename-$release.yml". The highest number is the most recent release. I wish to have the listening with latest release last. Correct sort order ...
0
votes
1answer
56 views

What's the -alhF flag in ls?

What is the -alhF flag in ls? I can't find it in the man page.
0
votes
3answers
99 views

Concat 1000 files within a directory [closed]

I know we can concat files by cat file [file] [[file] ...] > joined-file. I have directory which contains lots of files. I want to concat all of them. I want to concat 1000 files irrespective of ...
4
votes
4answers
159 views

How to show only the last k columns in ls -l?

I like to restrict the columns shown in ls -l command, by eliminating the first 4 columns. ls -lh shows: drwxr-sr-x 20 gamma alpha 4.0K May 22 13:18 Desktop drwxr-sr-x 3 gamma alpha 22 Oct 6 ...
1
vote
1answer
31 views

LS_COLORS for 256-color terminal

I thought ls colors are defined as <file_type>=[<bg(40-47)>];<font_spec(0:5)>;<font_color(30-37)> but, I recently found this where there are more colors and colors are ...
1
vote
1answer
17 views

Screen bind key requires extra Enter (RET) key

I was playing around with GNU Screen's configuration and put the following configuration in ~/.screenrc: bind l eval 'exec ls' So, now when I type C-a l, it runs ls under the current directory. ...
1
vote
1answer
49 views

Assigning ls output to a variable gives unexpected behavior

I was writing a script to clean a text file from a directory (I know,it's a bad idea but I really need it) and I wrote this: #!/bin/bash var=$(ls -p /direcotry/to/file | grep -v /) truncate -s 0 $var ...
1
vote
0answers
93 views

How to understand the security context in “ls -Z”?

After referring "man ls", it shows "ls -Z" can display the security context: -Z, --context Display security context so it fits on most displays. Displays only mode, user, group, security ...
0
votes
1answer
49 views

`ls / | wc -l` tells more lines than `ls /` shows [duplicate]

ls / outputs two lines. $ ls / bin cdrom etc initrd.img lib lost+found mnt proc run share sys usr vmlinuz boot dev home initrd.img.old lib64 media opt root sbin ...
2
votes
2answers
58 views

Efficient search of unique owners of files and directories

I would like to view the unique owners of all the files and directories underneath a certain directory. I have tried: ls -ltR <dir-path> | grep -P '^[d|\-]' | awk '{print $3}' | sort | uniq ...
0
votes
1answer
65 views

Solaris: How to run a system command on top of awk and combine all output in a single line

Have this peculiar requirement to print files in a given directory in the below mentioned format filename1 <type of file> owner group filename2 <type of file> owner ...
-1
votes
1answer
28 views

Advice with How to Return the # of Files found within a folder [duplicate]

Create a script to ask a user for the name of a folder and have the script return the number of files found within the folder. If folder doesn't exist, display error message to the screen I've gotten ...
0
votes
2answers
73 views

find and list -R returning different number of files

I'm trying to create an array variable with a list of files to use in a small script, needing the full path to the file. Looking around I tried something like this: find /path/ -t f | grep ...
5
votes
2answers
360 views

What defines “ll” in Fedora?

In Fedora, instead of typing ls -l, you can type ll. What causes this behavior? I've installed a new Debian system that does not appear to have this functionality. They're both running Bash. I can ...