Questions tagged [ls]

The ls command lists the contents of a directory.

Filter by
Sorted by
Tagged with
-1
votes
0answers
35 views

Is there a DIR command for raspbian (debian I guess) and where can I get it?

I've come across some posts mentioning that there does exist a DOS-like dir command available for some versions of Linux. Is there one that runs on the RPi-4, and if so where can I download it from? ...
-3
votes
0answers
63 views

What does “.:” mean in the output of “ls”

I often see this path syntax in many place. For example, command output of my command find|xargs ls -1sh gives me: ./defaults: total 8.0K 4.0K defaultAlarmProvider.test.js 4.0K defaultCategories....
1
vote
2answers
84 views

diffrence between ls -l *.<sometthing> | wc -l and ls -l | grep <something> | wc -l

I have a folder with a huge file list that I want to count. I was doing ls -l *.json | wc -l and it was working fine, till the list apparently gone huge enough that this command didn't work any more. ...
1
vote
2answers
116 views

Why does ll -d */ result in an additional forward slash?

The command ls -d */ only lists directories as follows Desktop/ Downloads/ Pictures/ snap/ Videos/ Documents/ Music/ Public/ Templates/ The command ll -d */ limits the results to ...
1
vote
0answers
25 views

Oh My Zsh - execute ls after auto cd [duplicate]

Oh My Zsh has this lovely feature where you can just type dir-name instead of cd dir-name to access the directory called dir-name. In my old .bashrc I had a function that overwrites the builtin cd ...
0
votes
1answer
31 views

Set LS_COLORS in Alpine

I am trying to set the directory colors in alpine to be white. I tried to create ~/.profile with LS_COLORS=$LS_COLORS:'di=1;44:' ; export LS_COLORS in it. But it had no effect. I see many examples ...
1
vote
4answers
92 views

Bash - print reversed file list using glob

Is there a way to reverse a file list via glob? So I would get the same result as with: ls -r * I'm using this in a shell-script and shellcheck keeps complaining: ^--------^ SC2045: Iterating ...
0
votes
0answers
29 views

Newline delimited ls command? [duplicate]

I'm currently writing a help system for my window manager and I need to have a list of files that are delimited by newlines. I'd use the ls command but if there's the enough files ls will display ...
0
votes
1answer
76 views

why does the output of `ls` look different when piped through ``tr “\n” “\n”`?

The man page for tr(1) says: tr - translate or delete characters SYNOPSIS tr [OPTION]... SET1 [SET2] DESCRIPTION Translate, squeeze, and/or delete characters from standard ...
0
votes
2answers
40 views

list filenames stored in text file with a certain timestamp

I have stored a couple of file names in a text file by the name new1.txt in my home directory, now i'm using a loop to list all the files in the directory they are present in. I am able to write the ...
0
votes
1answer
27 views

aws ec2 ls command is showing the user@ip:directory/folder on the last line - How can I remove this from my ls output?

When I perform an ls command in my aws ec2 server, I am getting the correct list of files which I need, but for some reason the user@ip:directory/folder is showing on the last line of my results? Is ...
0
votes
0answers
19 views

How to solve -ksh: /bin/ls: cannot execute [Argument list too long] error? [duplicate]

I wrote a command line expression to generate count of files and directories in source file but I get -ksh: /bin/ls: cannot execute [Argument list too long] How to solve this issue? I used ...
0
votes
0answers
18 views

Why the following redirection doesn’t work? [duplicate]

i typed the following command which cp | ls -l It didn’t work as i expected. I wanted that the output of the which command will be a path name. So the ls command will show the information about the ...
13
votes
4answers
1k views

How to add new line between `ls -l` output

This is standard ls -l output. user@linux:~$ ls -l total 0 -rw-rw-r-- 1 user user 0 Nov 1 00:00 file01 -rw-rw-r-- 1 user user 0 Nov 1 00:00 file02 -rw-rw-r-- 1 user user 0 Nov 1 00:00 file03 ...
1
vote
2answers
34 views

Find a file and send email

I want to find a file for every 60sec. If the file exists between the time range then an email should trigger. i tried below but not working. Apprecite your help ! THanks Advance #!/bin/sh cd /my/...
1
vote
2answers
55 views

Drop stderr from ls

When I run ls on a filename that doesn't exist the output reports that. I'd like to drop that output but still report when a file is found. Is this stderr that reports the output below? $> ls foo ...
3
votes
1answer
198 views

Why does `ls` add a leading whitespace to its output for certain directories?

If I use the ls command in my home directory each line of output has a leading whitespace: $ ls bin Documents ... It only seems to do this for my home directory. Why does it do this? Note: I ...
1
vote
1answer
61 views

Difference between /$ and ~$

When I log into a server running Ubuntu 18.04.3 (LTS) x64 and run ls nothing shows and there is a ~$ at the end of the command prompt. When I type cd / the prompt changes to /$ and I can see many more ...
2
votes
1answer
66 views

How can I show hidden files with grep and ls? Problem with period ('.') at the beginning of the word

I'm trying to display hidden files in the current directory using grep and ls. The following command works fine: ls -a | egrep '^\.+', but this commands don't work: ls -al | egrep '\<\.+' or ...
1
vote
2answers
67 views

ls: use different color for “user” and “group” columns, when file owned by root

When using ls -lAhF, the 3rd and 4th columns are user and group ownership, ie: drwxrwxrwt 2 root root 60 Nov 15 15:50 .X11-unix/ srwxr-xr-x 1 marti marti 0 Nov 15 15:51 .menu-cached-:0-marti= ...
2
votes
2answers
93 views

`ls -l ~~` (two tilde)+ tab does not show directories starting with ~~, but users

In the bash shell, why does ls -l ~~ + Tab not show directories starting with ~~, but users? (all users). The ls -l is just an example. If I type ~ + Tab in any directory, I get a list of users.
1
vote
3answers
87 views

For loop to find files of largest size and copy them to another directory

I am trying to create a loop to sort files within each of many directories by size, then copy the largest two to another location, keeping the directory format (below). folder/sample 1 .../...
0
votes
1answer
210 views

How does one have custom LS_COLOR work for ZSH?

I wanted to make custom colors for the ls command with zsh, but I find that all the previous answers to this do not work for me. I tried all these options: Option 1) #LS_COLORS='no=00;37:fi=00:di=...
0
votes
0answers
34 views

How do I change the way lists are presented in the terminal?

I'm new to working with the terminal and recently I have watched a few videos online, and customized it a little bit to suite my workflow (Color Schemes). My issue is that some of the directories I ...
0
votes
1answer
30 views

Using paths from a function that uses globbing

It is known that parsing the output of ls is generally a bad idea and one solution is to use globbing instead of ls to 'safely' loop through files in a directory. for path in /path/to/search/*; do ...
0
votes
1answer
50 views

`ls -l` doesn't display the human-readable owner and group, how can I check the owner and group of a file?

I want to check the owner and group of a file, but I get: $ ls -hl canal.properties -rw-rw-r-- 1 500 499 514 Nov 4 19:12 canal.properties 500 and 499 are not human-readable, are there any other ...
0
votes
1answer
314 views

Difference between ls command options:`ls -a` `ls -al` `ls -all`

First look at the output of ls --help command: Several lines ignored in the output -a, --all do not ignore entries starting with . -l use a long listing ...
33
votes
4answers
3k views

Why would the command “ls *” generate an error about invalid options?

There is a thread that talks about ls "*" not showing any files, but I actually wonder why the simple ls * command doesn't output anything in my terminal other than ls: invalid option -- '|' Try '...
0
votes
0answers
18 views

Grub2 shell ls command shows nothing

in the Grub2 shell you have the ls command to show your drives. But, in my case, ls shows nothing, really nothing. lsmod shows a bazillion loaded modules, to be sure, I loaded these again: ls, ...
0
votes
5answers
140 views

How to iterate over files returned by ls

The first and second invocation are for comparison's sake. It's the third I'm trying to get to work. $ ls -a1 *mp3 DaftPunk_VeridisQuo.mp3 French79_AfterParty.mp3 French79_BetweentheButtons.mp3 ...
0
votes
2answers
37 views

Allow only ls on directories

how can I set permissions to a folder so all users not in my group, can only do ls on it? I don't get the difference between - and r.
0
votes
3answers
99 views

Piping ls to grep. Why does grep disregard the output from the ls command?

I am trying to use this command ls -p | egrep "\<[A-Z]+\>" to print all uppercase file and dir names with dir names having / appended. I do not understand why my command works even though I said ...
1
vote
0answers
59 views

bash colored completion doesn't obey LS_COLORS environment variable

In bash, I have colored output set up for commands such as ls. I customized the exact colors used with the LS_COLORS environment variable, since the default ones were kind of ugly. From what I ...
1
vote
3answers
86 views

Why is my perl regex in my bash script not working? MacOS Terminal

I'm trying to move away from AppleScripts for workflows at my job, and create something simpler that can run in the background instead. For this task, I am given 35-40 files (5 renditions of 7 or 8 ...
1
vote
0answers
39 views

Why is one directory's file larger than 4kB? [duplicate]

I have a directory on my EXT4 filesystem that's showing up as larger than the usual 4kB: $ ls -l total 24 drwxrwxr-x 2 jvilla jvilla 4096 May 24 17:57 'Season 1' drwxrwxr-x 2 jvilla jvilla 12288 Sep ...
1
vote
1answer
76 views

How does ls --tab-size work?

I can't figure out what does ls --tab-size=COLS (or ls -T<COLS>) do. From man: assume tab stops at each COLS instead of 8 And, for instance, what's going on here? Or what would be a useful ...
0
votes
2answers
89 views

How can I brighten up blue directories in ls --color?

I see one other Dark blue color...-Q with the same problem: Instead of two kinds of blue (normal and bright/bold) I have only one, very hard-to-read so-called "bold blue". Normal blue is even worse, ...
1
vote
3answers
79 views

Setting LS_COLORS has no effect

when using ls the directories are in a really hard to read navy blue, so I want to change them. I read that I need to set LS_COLORS but for me it doesn't do anything. Here's what I tried: LS_COLORS="...
0
votes
0answers
50 views

How ls -lh round off the actual sizes in human readable form?

I was using the command ls -lh to see the long list of files and their sizes in human readable form but i was unable to understand one thing that how the human readable form round off the actual sizes....
-2
votes
1answer
78 views

User cannot see a directory in /var/www, thought the directory is there

I'd like to create a repository folder that can be accessed by cpanel user. Let say I create a directory in /var/www/webassets, and set the access to 777. I can see the folder using ll command as ...
1
vote
1answer
120 views

total in the output of ls -l command

I know that total tells the number of 1K blocks used by the files in directory i am working on. For some purpose i entered the command ls -lh to see this in human readable form, i saw the blocksize of ...
1
vote
3answers
129 views

How to list all files under /etc and write it to a file in /home?

ls -a > /home/etc.txt -bash: /home/etc.txt: Permission denied I'm in /etc trying to list all the things under it and write it all into a text file in /home... but I'm getting permission denied. I ...
-1
votes
3answers
268 views

find directory or file that ends in any 3 characters

i am trying to find directory or file that ends in any 3 characters with using ls -l /etc | grep ???$ and this doesnt work,, what should I type to find any directory of files that ends with 3 or ...
0
votes
1answer
95 views

Who is setting my LS_COLORS?

I'm using the bash shell, and want to change some of my ls listing colors; I've noticed that this can be controlled using the LS_COLORS environment variable, which encodes terminal colors for various ...
-4
votes
3answers
74 views

Show only files which name starts with a specific letter

My task is to output a list of files with there attributes which names starts with 'p' letter using ls and grep. I am using ls -Rl to show list of files, like this, but I don't have an idea how to ...
2
votes
2answers
109 views

xargs combined with bash -c with multiple placeholders

I am combining ls, xargs and bash -c to run a specific program on multiple input files (whose names match the pattern barcode0[1-4].fastq. The program that I am calling with xargs is called krocus ...
0
votes
2answers
106 views

Pick randomly 30% of the files in a folder

I have a number of folders, each with audio files in it. I want to pick out 30% of each of this files and cut them (not copy) to another folder. I can see this post which can help me do this given ...
1
vote
0answers
30 views

lsattr returns different results depending on how it's run

I'm using lsattr on a linux container on the contents of a mounted drive that's been mounted using SAMBA and am seeing some interesting results. If I run lsattr in quick succession, I get differing ...
1
vote
1answer
63 views

What does 'mustard color' highlighted directories mean?

When I run 'ls -laGp' command in macOS some of the folders are highlighted with this color. What does that mean? I researched but couldn't find any documentation or anything. If you let me know ...
0
votes
1answer
31 views

How to interpret /var/log output

I have trouble interpreting the following output from /var/log. Both lines show the same result but of different date? What does this mean? Currently doing an audit to ensure that the directories are ...