The ls command lists the contents of a directory.

learn more… | top users | synonyms

0
votes
2answers
34 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 ...
4
votes
2answers
323 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 ...
6
votes
2answers
118 views

Exclude one directory in `ls` matching pattern

I'm trying to ls dirs that have .png files inside (no need for recursiveness, though it would be extra useful), exept one. Exlude one directory i.e. ls */*.png works fine. ls (^one)*/*.png ...
0
votes
4answers
76 views

Foreach loop for ls output

I am trying to process some files in directory using foreach loop for ls output: IFS=$'\n' for i in $(ls -1Atu); do echo "$i" done At first time i thought it works, but when i created file ...
2
votes
2answers
60 views

ls pattern matching

I know that [] is working in ls pattern matching: $ ls foo.c foo.h $ ls foo.[ch] foo.c foo.h but I cannot find where this is documented. I would like to know the syntax that would match these: ...
1
vote
5answers
54 views

Difference between 'ls -ltr abc*' and 'find ./ -name abc*' command? [duplicate]

To search a file in a directory, I found two commands as below: ls -ltr initialfilename* find ./ -name initialfilename* Sometime, first command gives me the search result but sometime I used to ...
0
votes
3answers
87 views

How do I copy the latest file from one directory to another?

I have 3 zip files in a directory. I want to copy the most recent version to a backup directory. My code works fine for .sh and other files, but not for .zip. Is there something else I have to do? ...
-1
votes
2answers
41 views

Linux Bash Scripting Issue with Wildcard

I'm having issues with what I imagine should be a simple bash command I'm basically just trying to loop through a bunch of files and get there names `ls ./*.sql` # list all files ...
1
vote
1answer
46 views

How to distinguish between output of numerous similar commands

Say I am issuing ls -la in a directory that has hundreds if not thousands of files, then changing to another directions and issuing ls -la. I then need to scroll up to see what files are in the most ...
1
vote
2answers
52 views

How to list only the last line of each directory?

I learned thanks to you, how to display only the last line of a listing,e.g. ls -ltr | sed '$!d' Now I thought, how to combine it with the find command, in order to repeat this onto each directory ...
0
votes
3answers
39 views

How to display only the last line of a listing ?

Supposed I make a listing and sort the files by its temporal attribute: ls -ltr -rwxrwxrwx 1 bla bla 4096 Feb 01 20:10 foo1 -rwxrwxrwx 1 bla bla 4096 Feb 01 20:12 foo2 . . . -rwxrwxrwx 1 bla bla ...
1
vote
1answer
65 views

Why are files and directories colored in different ways? [duplicate]

On Ubuntu 14.04, in bash under gnome terminal, Why are files especially directories colored in different ways? The green colors hide the text to me (How about to you?). Is it done by terminal or ...
1
vote
0answers
41 views

ls or find option to exclude binary files

How can I list only files that aren't compiled code in the current directory? I'm reviewing the custom scripts and code on several HPUX and Linux servers before transferring them to a newer system. ...
0
votes
1answer
65 views

du and ls commands reporting wrong directory size

I'm used to the du command. I often use it with -h option. I report the result in a text file which I use to track space consumers. But I was wondered today to see a directory being reported as using ...
3
votes
2answers
77 views

How to list files on terminal so that we can see the file types such executable, ascii etc?

I have been trying to list files in directory using ls and passing it different options. Does it have the ability to list types of files as well ? I want to know which ones are executable , ...
1
vote
1answer
69 views

What does the @ symbol mean on filenames [duplicate]

When I do an ls in the /proc/PID directory a number of @ symbols show up next to the file names. Normally I would consider this to mean extended attributes but when I do the long form of ls they do ...
1
vote
1answer
41 views

BASH: looping through ls [duplicate]

I'm having trouble with this piece of code: 22 for filename in "$( ls "$1" | grep ".*\.flac$" )"; do 23 file_path="$1${filename}" 24 ffmpeg -i "${file_path}" -f ...
0
votes
1answer
43 views

*ls* font differences between files and folders with “--color” option

I have recently switched to urxvt from xterm for better unicode support and it does much better as to the font fallback. However I find an interesting issue: names of files and folders are rendered ...
1
vote
1answer
107 views

How to remove all but last 10 files

I accumulate sequentially named files as the result of an automated process, and I would like to keep only the last 10 around. I tried this, which had the effect of deleting everything: ls -r | more ...
5
votes
1answer
671 views

No such file or directory but I can see it!

I'm trying to run a python script, on a headless Raspberry PI using winSCP and get the following error message: Command '"./areadetect_movie_21.py"' failed with return code 127 and error message ...
0
votes
2answers
73 views

“ls” in directory outputs “No such file or directory” for some files

I cd to a directory that has a large number of files, 40,948 to be exact. When I issue ls it takes a long time and before the command finally prints the results to the screen it tells me "ls: cannot ...
2
votes
1answer
80 views

Question marks instead of national letters in console

I have Netgear Stora MS2000 (which uses a modified version of Red Hat) and have strange font issues while connecting by SSH. Note that this occurs both when connecting by PuTTY from Windows and by ...
0
votes
0answers
36 views

getting ? in permissions when running ll/ls command

I am trying to remove a folder and I am getting rm: cannot remove ‘...' when running the ll command I am getting : > ll ./folder/ ls: cannot access ./folder: Input/output error total 64 ...
1
vote
3answers
101 views

What is the meaning of ls -d ?

I entered the man page of ls, the entry for the -d option is as follows: -d, --directory list directory entries instead of contents, and do not derefer‐ ence ...
0
votes
2answers
74 views

Solaris 11.2 extended permissions shown by ls

I have a file that shows up as having extended file permissions. ls -V /usr/share/X11/app-defaults/XScreenSaver rwx------ 1 root root 53 Dec 2 21:52 ...
4
votes
1answer
153 views

Can the command completion for `cd` be modfiied to only show directories and ignore files?

When I am in a directory in bash, and I press cd Space Tab, it shows everything in the directory as a possibility. (Show all 1000 possibilities?) This is really cumbersome when I am in a directory ...
1
vote
4answers
86 views

get file size and line count at the same time

I'm looking for a way to list all files in a directory, with both their size, and a line count. Right now I'm using stat -c \"%s %n\" /directory/* to get file names and sizes, and I know I can use ...
1
vote
1answer
18 views

How to display metainformation for different kinds of time of a file ?

As far as I know each name within a path, e.g. /name1/name2/name3, is allocated to one inode. This inode is a collection of meta information for each name (file or directory). Some of these ...
0
votes
2answers
64 views

bash permissions - unknown problem

So strangely enough I have the following problem in a directory inside a script: #!/usr/bin/env bash MAIN_DIR=/home/ec2-user/dir/ LAST_DIR=$(ls -d -t ${MAIN_DIR}*/ | head -1) When I run it I get: ...
11
votes
5answers
856 views

How do I get the size of a directory on the command line?

I tried to obtain the size of a folder (containing folders and sub folders) by using the ls command with option l. It seems to work for files (ls -l file name), but if I try to get the size of a ...
12
votes
3answers
499 views

No colored output in less for the ls command

If I run ls I get colored output which I find pretty handy for quickly getting a glance of the kind of file. When I try to pipe it to less even with the -r and -R flags the coloring always get lost. I ...
1
vote
1answer
88 views

What are all possible letters for Unix file permissions?

I'm trying to write a regular expression to match Unix file permissions returned by ls -l command. Here I found that all possible letters for the first field are d,c,l,p,s,b,D. Now, what are all ...
2
votes
2answers
180 views

Using find to list all files under certain directory

I'm trying to use a single line command that will find every directory (or sub-directory) named bin and will then print a list of all the files under it, but will not also list the directory names ...
0
votes
1answer
81 views

What does the option -C achieve in ls output?

In the man pages it says: -C list entries by columns However, I really cannot notice any difference between the output of ls or ls -C, could someone explain this to me?
-1
votes
2answers
65 views

How do I get a list of all directories and files with absolute paths each line ?

Using ls -R / i get every file and directory listed that exists, but not in the desired format. What do I need to write on the command line in order to get a list in such a format, that every line ...
6
votes
1answer
99 views

stat: print time in “long-iso” format

For my script, I would like to have stat command to print time in a nice, human friendly, way: 2015-02-04 00:48:31. ls calls this format long-iso and it can be used like this: $ ls -lA ...
0
votes
4answers
54 views

What is the command to find the read/write permissions for a single file?

I know that ls -l lists the permissions of every file in a directory but what is the command if I want to see the permissions of just a specific file?
19
votes
5answers
3k views

Understanding UNIX permissions and their attributes

I've never really got how chmod worked up until today. I followed a tutorial that explained a big deal to me. For example, I've read that you've got three different permission groups: owner (u) ...
4
votes
4answers
172 views

list folders and their content

I'd need a file reporting for each folder the content and the name of the folder itself. If I do ls -l * I have (this is just a subset of hundreds of folders) ...
0
votes
1answer
43 views

Change the way folders are displayed in terminal [duplicate]

I moved over from Xubuntu to Fedora. In a colored Xubuntu terminal the folders appear in bold blue wheras in Fedora they appear as normal blue. I'm familiar with ANSI codes for colors and style but ...
4
votes
2answers
199 views

Appending works without >> when redirecting standard output and error

I have a file test.txt and have no file named test. When I tried ls test test.txt > new 2>new I was expecting new to be overwritten since >> is not used. But in the output file I got ...
2
votes
3answers
54 views

How to determine if a soft link's target is a directory or a file?

Given the ll command outputs as follows #> ll lrwxrwxrwx ... How to determine if a soft link's target is a directory or a file from "lrwxrwxrwx"?
3
votes
2answers
562 views

How to ls without recursive

I am trying to ls some files with a pattern in a directory. I only want to scan the first level not recursive. My script: for i in $(ls $INCOMINGDIR/*$BUSSINESSDATE*) do echo $i; done Above ...
4
votes
2answers
752 views

Why does ls display a non-existing file?

I want to list all the files whose name begins with uppercase: [root@localhost /]# ls /usr/bin/[[:upper:]]* /usr/bin/AtoB /usr/bin/GenIssuerAltNameExt /usr/bin/PKCS12Export ...
0
votes
3answers
421 views

Making a text file of list of directory entries in bin

How could I make a text file of the list of directory entries in /bin/ along with the attributes of all the files stored there?
1
vote
1answer
98 views

How can I list hidden directories, then directories, then hidden files and finally files with ls?

I'm trying to figure out how to list the contents of a directory in the following group order: Hidden directories Non-hidden directories All other hidden files (including regular files, symlinks, ...
2
votes
0answers
46 views

What uses Linux “application memory”?

Just for fun, I wanted to watch what ls -lR / does to my "buffers" memory on a Linux system. As expected, the value increased. But I noticed that the "application memory" (i.e. "used" - (buffers + ...
0
votes
0answers
30 views

Pipe to `ls` Not Working as Expected [duplicate]

When I issue: [dave@dhost ~]$ which tar | ls -l I get the output of ls -l of the pwd. I expected to get: -rwxr-xr-x. 1 root root 395472 Feb 21 2013 /bin/tar Why doesn't the pipe work as I ...
1
vote
1answer
74 views

List files from time X to time Y

How to list out all files created between from 'x' to 'y' time? I want to list out files created between "29-dec-2014 18:00" to "30-dec-2014 18:00". Using ls or stat?
2
votes
1answer
44 views

GNU ls long listing without permissions/mode bit

Is it possible to make GNU ls omit permissions/mode bits in long listing? If not, is there an alternative, practical and commonly available program that is more flexible?