The ls command lists the contents of a directory.

learn more… | top users | synonyms

3
votes
2answers
121 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
90 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
52 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
61 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
159 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 ...
6
votes
1answer
2k 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
139 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
111 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
40 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
161 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
115 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
194 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
138 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
21 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
104 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
1k 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
607 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
117 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
363 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
177 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
133 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
145 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
59 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 based 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
181 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
56 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
223 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
69 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
665 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
800 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
829 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
132 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
48 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
100 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
50 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?
3
votes
3answers
232 views

How to inspect the contents of /dev/sdt?

I have what I hope is not a huge problem, but could end up being a very large problem. For some context, I mistakenly ran this command on my 27'' iMac: sudo dd if=ubuntu-rescue.img of=/dev/sdt ...
2
votes
1answer
40 views

Disable of coloring for ls on NTFS filesystems

I like to have the output of ls colored so I quickly can spot files of specific types, however I have a separate disk in my computer which uses a ntfs-3g filesystem, this means that everything has ...
1
vote
3answers
86 views

ls option to cancel '-h'

I aliased ll to ls -alh. Is there an option to cancel the -h temporarily, so I can do ll -? instead of ls -al?
1
vote
1answer
179 views

ls --color=auto (dir colors) not working in one directory

I changed ownership of a folder to provide restricted access to some users (it previously was only visible to root) and after that, all files are now one color (bright green) and directories are blue. ...
0
votes
1answer
41 views

How to create a file name for the pipeline to delete all files?

So I want to delete all files in my current directory using the following pipeline: ls | sed -rn 's/(.*)\.jpg$/mv -n & \1.jpeg/pi' | sh How to create a file, named so that running the above ...
0
votes
3answers
125 views

Number of files in a directory starting with specific text

How to get count of files in a directory starting with specific text like dataxxx.csv
2
votes
3answers
497 views

only show the source file and target linked file using `ls`

I can show the target file that a link points to using ls -l: snowch$ ls -l /usr/local/bin/mvn lrwxr-xr-x 1 snowch admin 29 12 Dec 08:58 /usr/local/bin/mvn -> ../Cellar/maven/3.2.3/bin/mvn Is ...
1
vote
3answers
687 views

List files that do not begin with a specific prefix

I need to list only the files in a directory that do NOT begin with qc_dl, qc_dt or qd_df, but that also DO end in .sas. I can list the files that do not begin with "qc_dl" as such: ls -I "qc_dl*" ...
1
vote
3answers
488 views

What does “>” do vs “>>”? [duplicate]

I am currently doing preparation for my GCSE computing controlled assessment on Linux. I type ls > list and ls >> list into the command line, but it does not do anything. I have googled it ...
0
votes
2answers
105 views

How can I capture two columns of ls output in a bash script

I want to create a script to delete any directories with numeric groups. What I have so far captures and analyzes the group: #!/bin/bash re='^[0-9]+$' for x in `/usr/bin/ls -l /var/indexes | sort ...
0
votes
3answers
488 views

How to print only certain characters?

I have to translate the permissions of a file this way: r ► c w ► s x ► e Then, I must extract the group of characters which are related to owner group. Last step is to print that group of ...
0
votes
2answers
67 views

How can I recover disk space shown by the difference in disk usage between ls and du

I have a one Terabyte external hard disk drive that I intend (should have done this long ago) to use for backups, and I have done a lot of experimenting to get my mind round it. When I looked again ...
0
votes
1answer
79 views

How can I write an alias for cd such that it will fire ls after going into the directory to which I just cd'ed into? [duplicate]

Lets say I want to do cd home and then ls -lrth. I want these two things combined into a single command. I tried writing an alias, but it didnt work. Can you help me ?
2
votes
3answers
78 views

Remove files from listing that are created/modified on Saturday

I am not sure if it is possible. I do ls -l, it gives all the files in the current directory. Is there a way to say list only files that weren't created/modified on Saturday's with shell command?