The ls command lists the contents of a directory.

learn more… | top users | synonyms

-3
votes
0answers
26 views

Modifing RM & LS [on hold]

I am new in Linux, is there a way to do the following: Modifying RM command so that a file in a specific folder are not deleted (means making deception) Then Modified LS in such a way that it doesn't ...
0
votes
2answers
22 views

Listing numbered files using wildcard sequence with predefined range

I have a folder of numbered data files. I am trying to incrementally extract a predefined range of files. The range of files that I am looking for is predefined in two variables, ns and ne, which ...
0
votes
3answers
45 views

Seeing mode of file without listing all files

I want to see the mode of file/folder foo, in the form drwxrwxrwx. I would normally do ls -lah | grep foo, but in this case the folder had so many subfolders, that it took a long time for ls to run. ...
0
votes
3answers
35 views

Command to print the number of *.pdf files in a chosen directory [duplicate]

I am currently not on a Linux machine. Would the following command produce my wanted result? ls | grep ".pdf" | wc
1
vote
2answers
26 views

Tolerant file system for a failed automount

(I am running openSUSE 13.2) My current setup I have an external backup drive which I mount at boot with the following line in my /etc/fstab: /dev/mapper/cr_backup /backup ext4 ...
10
votes
14answers
2k views

'ls -1' : how to list filenames without extension

ls -1 lists my elements like so: foo.png bar.png foobar.png ... I want it listed without the .png like so: foo bar foobar ... (the dir only contains .png files) Can somebody tell me how to use ...
1
vote
1answer
45 views

passing ls variable to grep when doing a file search only works inside directory

I am running a command that I use to find the most recent file in a folder then grep the contents for a matching pattern. Here is the command flow that shows the problem I am having. root@backup /]# ...
0
votes
4answers
77 views

Is there a way to show the permissions for a file without using `ls`

That's all - just wondering if there's other way to find out the permissions for a file without doing a ls -l to see the string of values there. As far as I know, there's no show option in chmod.
0
votes
0answers
38 views

permission denied, cannot list files within a folder

I have a folder like: drwx--xrwx 9 user group 4096 May 1 11:17 160429_ST-E00110_0195_AHMFVNCCXX However my user other can't do ls: -bash-4.1$ ls 160429_ST-E00110_0195_AHMFVNCCXX ls: cannot open ...
0
votes
2answers
34 views

Doing ls -l /dev [duplicate]

When experimenting with the ls -l command I noticed that in the /dev folder ls -l was sometimes printing something like this in the first column : crw-rw----+ What is this "+"? What does it mean? ...
1
vote
1answer
49 views

Terminal color usage does not stay

I was wondering if any of you knew why doesn't my terminal keep displaying stuff colored, after I use the command ls -l -a --color=always I would like it to stay colored, so when the next time I type ...
0
votes
2answers
49 views

List Most Recent File per Sub-Folder

I have a File structure of : FOLDER/SUB_FOLDER/Text_File I have over 1k+ FOLDER and each FOLDER has at least 2 different SUB_FOLDER with each SUB_FOLDER their own Text_File. I'm trying to ...
2
votes
2answers
35 views

Instead of using ls, how does it make work with `find`?

I have this command: ls -Ra | grep -cve/ -e'^\.*$' and I would like to do exactly the same with find I tried this find . -name "^\.*$" -o -print | wc -l but the problem is, if I create new file ...
0
votes
2answers
34 views

Universal abstraction of ls

Specs OS: OS X; Client: Terminal; Shells: sh, bash Problem I'm writing a shell script that adds a layer of abstraction to the ls command. I want to make it "unbreakable", so I started by figuring ...
-2
votes
3answers
29 views

listing files with pattern with starting and ending

I want to list all files in a directory that start with 'abc' and end with '.zip' I'm trying to use ls. The directory has a lot of zip files starting with abc<date> and xvz<date>. I only ...
5
votes
5answers
530 views

Is it possible to run ls or find and pipe it through stat?

Is there a way to run ls or find to get the list of files within a directory and then run stat to get all of the specific information (i.e. File Group, File Name, File Owner, File Size (displayed in ...
-1
votes
1answer
44 views

What does this command do, exactly?

I have this command, but I don't get what it does. ls -Ra | grep -cve/ -e'^\.*$' And how can I do the same with 'find' command.
0
votes
1answer
52 views

List hidden files only (not just dot files) using an ls alias

I would like to use an ls alias (like l.) to output a colored list, consisting of only hidden files & directories, whether or not they begin with a dot. Any suggestions? Example of desired ...
5
votes
5answers
83 views

execute command on a defined range of directories

Is it possible to 'partition' a directory listing - say in to blocks of some number, to perform different actions on each 'range'? For example, lets say I have the following directories inside ...
2
votes
2answers
72 views

“ls” command stuck trying to list a stale mount point. How do you kill/stop it?

When working with remote filesystems such as sshfs or smbfs, it is command that they become stale due to network problems. To check if the mount is stale or not, I usually use the command ls to see if ...
1
vote
1answer
33 views

Set ls -l time format

I would like for all my ls commands that display a date, such as ls -l, to print the date column in a format of my choosing. Currently, I manually set this every time with --time-style. Is there any ...
0
votes
3answers
672 views

find -exec ls -lR {} \; returns every item twice

Background: I'm currently writing an archiving script, which creates gzipped tarballs from some folders and their contents. It should be able to synchronize the gzipped archives with the sources ...
2
votes
1answer
23 views

make ls gray out files that end with tilde (`~`) using `LS_COLOR`

Problem: I am trying to modify LS_COLORS to gray out all files ending with the tilde character. Question: Can anybody spot my mistake? Here is what I did: # write dircolors file: dircolors -p > ...
2
votes
2answers
38 views

List all the files in ending with several file extensions?

If I want files ending with .fas I know I can do the following with ls command : ls -l /users/jenna/bio/*.fas and this lists out all the files ending with .fas. But how can I get files ending with ...
3
votes
4answers
132 views

How do I extract a long listing field?

I want to extract the access day of a file in a shell script. I tried by writing the following script but it doesn't work. When I echo accessday, the output is "staff". file=$1 accessday=$(ls -lu ...
1
vote
1answer
75 views

What is the number at the top for the results for ls -l? [duplicate]

When you type in ls -l, there is a number on the first line labeled "total 22037"? What does this number mean? I am attempting to write my own version of ls -l( in C), and how do I get this value or ...
2
votes
5answers
157 views

Have the ls command behave differently based on the number of entries

Is it possible to have the ls command behave differently based on the number of directory entries that may be listed? If I just use ls (with no modifying options, but I can specify directories or ...
0
votes
0answers
27 views

File and folder size using ls and du [duplicate]

I created a folder and copied a 992 byte jpg file in it. Then I created a hard and soft links for the file. The hard link is the same size of the file and the soft link is 8 bytes. Now when I checked ...
-9
votes
1answer
51 views

Unix “ls” command? [closed]

Can someone explain to me what are all the options available with the -la flags for the ls command ? I have read the man pages, but still not sure.
6
votes
3answers
462 views

How do I get `ls -l` output for a link recursively until reached the original file?

Let me give an example (it's just an example taken from here): $ ls -l /usr/bin/gnome-text-editor lrwxrwxrwx 1 root root 35 Mar 16 2015 /usr/bin/gnome-text-editor -> ...
3
votes
2answers
54 views

Quoted filenames with spaces in ls output on OSX

The problem I don't want to see filenames quoted when they contain spaces. Example On OSX I see this when running ls: > ls -l total 0 drwxr-xr-x 2 mafro staff 68 Mar 16 09:02 'dir with spaces' ...
3
votes
1answer
36 views

Argument list too long when running ls -d “$PWD”/* command

I'm trying to execute ls -d "$PWD"/* > formmlFileList43k.list But I get the following error: bash: /bin/ls: Argument list too long I've read using a pipe won't have such limitation, how can I ...
2
votes
1answer
78 views

Different output of `find | xargs ls` for the same command on different Ubuntu versions

I have two Ubuntu installations: A: 14.04.3 LTS (GNU/Linux 3.13.0-77-generic x86_64) B: 14.04.2 LTS (GNU/Linux 3.13.0-61-generic x86_64) I'm running the following command: find . -name ...
-1
votes
1answer
38 views

wildcard usage for a directory displaying filenames in linux?

so one of the questions i have been working on is to display the contents of a directory files by using its wildcards do display specific contents, in this case aim using ls and the portion that I got ...
1
vote
1answer
44 views

What does @ in front of a directory name imply?

On my Synology NAS, when I do ls on my volume, I see that a few directories a leading @ in their names. A few also have a trailing @. What does this imply? Examples: @optware @autoupdate
2
votes
2answers
80 views

Sorting ls output where files end in numbers [duplicate]

Here is the output of my normal ls command: f1 f10 f11 f12 f13 f14 f15 f16 f17 f18 f19 f2 f20 f3 f4 f5 f6 f7 f8 f9 So I have 20 files. I need them displayed as : f1 f2 f3 f4 ...
0
votes
1answer
47 views

Size of a character/block file

Why is the size of a character or block file given as comma separated? crw-rw-rw-. 1 root root 1, 3 Mar 8 10:15 /dev/null brw-rw----. 1 root disk 8, 1 Mar 8 10:15 /dev/sda1 Size of a file is ...
12
votes
5answers
955 views

How to list all files in a directory with absolute paths

I need a file (preferably a .list file) which contains the absolute path of every file in a directory. Example dir1: file1.txt file2.txt file3.txt listOfFiles.list: ...
0
votes
4answers
55 views

use ls > filelist and change file list content to file list

I need to use the ls > filelist and, however when is use "cat filelist" it displays all the content in the filelist with filelist as one of the names in it, but i need to change it "* * * File List ...
3
votes
1answer
118 views

Why does “ls” sporadically output only “.” in the root directory of an external drive?

In the root directory of my USB flash drive, sometimes when I run ls, the output is normal and it lists the files. At other times, the output is simply one line: $ ls . If I try ls -la at one of ...
0
votes
2answers
135 views

Meaning of “l” in “lrwxr-xr-x”? [duplicate]

According to this website: http://ss64.com/bash/ls.html The first letter indicates the file type: f means file and d means directory. But in my case I've an l. What's the meaning of this l? In ...
1
vote
2answers
102 views

List files in current directory, prefix numerically

I'm trying to learn bash and I'm trying to list the files I have in a folder using a bash script from a.sh, like this: 1: a.sh 2: b.sh 3: c.sh I've looked at ls and find commands, but they don't ...
0
votes
1answer
58 views

find comand with -exec ls produces a different output

I am trying to determine which files will be touched based on their modified date. My directory is a top a list of perhaps several levels of subdirectories. From a terminal window I run this command: ...
1
vote
1answer
55 views

Show column headers with “ls” command

Does the ls command have any functionality to show the column headers for decoding what the columns are? I'm aware of the portion of support text that describes the columns in info ls
1
vote
2answers
174 views

How do get ls to list directories with a trailing forward-slash?

My shell is bash. How can I get the output of ls to show directories with a trailing forward-slash? When I do ls in tcsh it gives the desired output. How can I get this to occur in bash without ...
-1
votes
1answer
49 views

List just the permissions of a file [duplicate]

I want to know how to just check for the permission of a file. I know ls -l yourfile will show you it but I just need the nine permission letters. Thanks
0
votes
0answers
36 views

Sorting results from ls [duplicate]

I was wondering if there was a way to sort through ls results on the command line. Sometimes I use ls to get the exact name of the folder or file I want to use in a command. So it would be nice if ...
2
votes
2answers
84 views

List PDF files with missing metadata

I have had a few tasks where I needed to make reports on file changes on directories from different servers and have managed to make the reports using simple Unix commands. I used: ls -R -lT ...
3
votes
7answers
175 views

Find directories excluding ending bracket ')'

I'm trying to list all video directories (not files) which don't end in a year e.g. (2015) and more specifically which don't have a year listed, therefore don't end in a closing bracket ). How can I ...
1
vote
1answer
66 views

Help creating a bash shell script based around the ls command [closed]

I'm trying to create a bash shell script that will take an input directory and give me the name and size (with units) within. I'm a bit new to shell scripts, so I've been able to build the script to ...