Questions tagged [ls]

The ls command lists the contents of a directory.

Filter by
Sorted by
Tagged with
2
votes
3answers
42 views

nl: How to start line numbers on the second line?

This is the standard output of ls -ln | nl wolf@linux:~$ ls -lh | nl 1 total 24 2 -rw-rw-r-- 1 wolf wolf 186 Sep 24 22:18 01.py 3 -rw-rw-r-- 1 wolf wolf 585 Sep 24 22:21 02.py ...
1
vote
1answer
46 views

Operation not permitted when executing ls in home directory

I want to list all the files inside ~/Downloads directory on macOS Catalina. When I execute ls I get the following error: ls ls: .: Operation not permitted ls command works in other directories (...
1
vote
0answers
28 views

xargs with zgrep is giving the error

I have many gzipped files and I am trying to find some string pattern from the thousands of file but I am getting extra .gz while trying to zgrep it. Please refer the below, could you please advise. ...
-4
votes
3answers
53 views

What does the command ls -L do?

What does the command ls -L do in ubuntu and what are some use cases for it? Examples would be appreciated. Thank you!
0
votes
1answer
17 views

how to suppress error message in Unix for apache

I know that we can suppress error message when the command is ls ls /usr/tbin/httpd || /home/app/httpd/bin/apachectl 2>/dev/null However, i want to suppress No such file or directory for the below ...
4
votes
1answer
302 views

What does “?” means in ls -l output? [duplicate]

I saw a few files/dir are inaccessible even to the root user: find: ‘/run/user/1000/gvfs’: Permission denied. So I went a level deeper and ran ls -l; below is the output. /run/user/125# ll ls: cannot ...
0
votes
1answer
40 views

How to find evey softlink to a directory?

Take /etc dir as example. On my system it has 144 links. And as dir's can't have hardlinks (this is my understanding), the number 144 should refer to softlinks (1 original + 143 softlinks). $ ll -i ...
1
vote
1answer
41 views

Why inode numbers of /dev and /run are same as that of /? [duplicate]

Please see below output: In below output, the inode numbers of /dev and /run are same and equal to 2. The inode numbers of ./ and ../(could be a special case as ../ should point to ./) are also 2 and ...
0
votes
1answer
38 views

Trouble with the command “-exec ls -l {} ”

I was working on a lab and was having trouble with the function of part of a command we are supposed to learn. Here it is: find . -name "*.txt" -exec ls -l {} \; I have determined that the ...
0
votes
1answer
38 views

Bash script selecting folder

I am trying to list all the directory latest modified folder first using select, but I am stuck. Let's say I have: Folder1 ThisIsAnotherDir Directory New Directory This IS not_Same Directory When I ...
-1
votes
2answers
28 views

How to check if one or more file/s (directory /ies) exist with Bash?

In CentOS with Bash 3.2.52(2) I try to create two backup directories after ensuring they did not exist before: rm -rf "${general_backups_dir}" rm -rf "${specific_backups_dir}" ...
0
votes
1answer
43 views

Print only files, directories containing files and empty directories

I am trying to index some LTO tapes (and some hard disks as well) and would like a simple output, stored in a text file. Something like the example below: ... /home/norg/Desktop/empty\ dir/ /home/norg/...
1
vote
1answer
14 views

Why does setting 'mi' in LS_COLORS effect postgresql and python tab completion?

So I have a custom LS_COLORS setup, and in that I have the following: mi=05;01;33: or=05;01;33: mi is for missing files on the right column when in ls's list view, and or is for a missing files in ...
0
votes
2answers
40 views

Count the number of directories in a list of directories

I have a large number of directories, and I want to count with bash commands the number of directories in each of these directories. I am having a hard time piping ls and wc to achieve what I want. E....
0
votes
2answers
44 views

recognize symlink from symlinked folder

Let's say I am in console in a subfolder, that is a child (or grandchild, etc.) of a symlinked (soft) folder. From the subfolder, if I do ls -la nothing indicates all the files are inside a symlinked ...
1
vote
1answer
56 views

What does 'ls | sort file.txt' do?

I am just learning about shell commands; more specifically, I am learning about pipe. Right now I cannot tell the difference between the following commands: ls | sort file.txt and sort file.txt. ...
2
votes
1answer
106 views

ls -Z option yields “?” in output

I was reading the book "Linux Bible", chapter 24 to understand SELinux. In the book the author says that using $ ls -Z my_stuff in the command should display the DAC controls and RBAC ...
1
vote
2answers
32 views

Custom colors for ls are correctly applied for some categories, but ignored for others

With the help of dircolors, I changed ls colors. My .dircolors file is FILE 00;97 DIR 00;96 LINK 00;95 MULTIHARDLINK 00;34 ORPHAN ...
0
votes
3answers
53 views

how to use find command on top of the output of ls

I have below command which displays files/directories having EXEC_EC command: ls -ltr | grep 'EXEC_EC' By using above command: Can we write a find command to filter the files created before 7 days? I ...
0
votes
2answers
78 views

What command in a SCRIPT will cause the next “ls” to list the files IMMEDIATELY?

Summary What command can I run in a bash script that will make the next ls at a terminal list the files in a directory immediately, instead of having to wait 10 seconds? And see Questions 1 and 2 at ...
2
votes
2answers
104 views

Wondering about a nice combo of ls & cat?

As ll, I use ls -alh /some/file frequently, and just as often then, follow immediately with cat /some/file. I have to believe this has been addressed with various aliases. And on the next level, with ...
3
votes
1answer
94 views

ls says file exists, but file says no such file or directory

So when I were tweaking my laptop touchpad input, I came across this directory, and I found something weird. Maybe checking the command output is better than me trying to describe it: [root@T480-arch ...
1
vote
1answer
26 views

combine ls -alt with readlink

I have a directory containing a lot of symbolic links and some huge subdirectories. I want to get a detailed listing, sorted by time, of just the files in the parent directory, but with targets ...
0
votes
1answer
20 views

Why do I see different files/folders when open desktop with terminal “li -a” vs desktop + “cmd+shift+.”?

When I run the terminal and type "ls -a", and what I see is a lot of additional file starting with a dot as it is supposed to be: However, when I try to visualize the hidden files with ...
3
votes
0answers
86 views

find command “finds” file I'm looking for but it doesn't exist

I am searching for a particular file so I use the find command and it finds the file that I'm looking for: $ find / -name connect_power.aif 2>&1 | grep -v "Operation not permitted\|...
0
votes
1answer
32 views

Why is the size of the log files larger than the disk capacity? linux + ubifs

I am using a Linux-based switch and it has created many logs due to some known bugs. The problem is that the log files even exceed the physical flash size. I would like to ask what happened to the ...
0
votes
1answer
51 views

failure reading sector 0x465aa00 from 'hd0'

Currently in grub2 ( trying to solve a boot problem ) , coming from this post grub error: you need to load kernel first However whenever I am tying to set the Linux kernel using this command linux (...
2
votes
1answer
40 views

How to configure .dir_colors

So, I found out about the file .dir_colors. So I configured it and I added the following to my ~/.bashrc file: if [ -x /usr/bin/dircolors ]; then test -r ~/.dir_colors && eval "$(...
2
votes
1answer
31 views

Long listing showing hours since modification

Is there an option (preferably a GNU and/or FreeBSD option) that instructs ls to display modification time, not in absolute date time, but instead showing a number indicating hours (or days) since ...
0
votes
2answers
74 views

What does it mean when a file descriptor is a link to a pipe?

When I look at ls -la /proc/<pid>/fd, I see that stdout is a link to a pipe: lr-x------ 1 admin root 64 Jul 9 21:22 1 -> pipe:[1155] What does it mean? Who is listening to ...
1
vote
1answer
51 views

How do ls file names in numerical order that have space characters in the filename

Hi I have the following files, whose names contain spaces, on a Linux machine. I need to ls them in numerical order myfile_2020-Jul-06 00-00-00_1.csv myfile_2020-Jul-06 00-00-00_2.csv myfile_2020-Jul-...
0
votes
1answer
27 views

Error: find argument list too long and -maxdepth 0 is not helping, directory contains many files

I'm trying to delete image cache files older then 100 days via command find /mnt/data/cache/*.jpg -maxdepth 0 -mtime +100 -type f -ls -delete but the thing is /mnt/data/cache/ contain large amount ...
3
votes
1answer
137 views

What is the difference between (*) and (“$(ls)”)?

What is the difference between (*) and ("$(ls)")? Are they essentially the same except the delimiters are different?
0
votes
1answer
39 views

List contents of a directory and all sub directories including file details, i.e. size, date created, date modified, and date last opened

First I should apologize in advance - I have no idea what I'm doing when it comes to the Mac terminal... I need to do an inventory of all files in a directory/folder. There are several sub ...
1
vote
1answer
62 views

ls: reading directory '.': Input/output error on a network volume

I am using the same volume from different Linux and MS-Windows machines: /run/user/1001/gvfs/afp-volume:host=... (in Windows it is mounted as standard network drive) It was working ok for some time ...
0
votes
1answer
45 views

How to make “ls -Al” work the old way?

In CentOS 6.9 final, ls -Al lists files by ASCII code order, and files starting with a dot(the hidden files) will be displayed on the top of the output. But when I upgraded to CentOS 7.5, ls -Al doesn'...
0
votes
2answers
183 views

find only the files that ended with .whl

I am trying to capture all .whl file as the following ls -l /python/*.{whl,} ls: cannot access /python/*.: No such file or directory -rw-r--r-- 1 root root 23000 Jun 14 11:02 /python/argparse-1.4.0-...
1
vote
3answers
151 views

Making a pipe from `ls` to `mv`

I am trying to make a small utility for myself on the command line - for a given current work directory I would like to find the most recently added file and mv it to a name given by argument I have ...
0
votes
1answer
85 views

what is different between red file and green file in Terminal (macOS)

I have 2 backup files but they have 2 different colors? So what is different between red file and green file in Terminal (macOS)
1
vote
0answers
32 views

ls how to sort dotfiles first when using the -X option

Basically title. I want ls to sort by extension so I'm using the -X option, but I'd also like dotfiles to be shown first. I could use the -v option for that, but then -X no longer works. How can I ...
0
votes
0answers
39 views

What does the columns of the output of ls -la signify? [duplicate]

When I enter the command: $ ls -la some_directory It gives the output: drwx------. 5 user1 user1 1418 Mar 7 11:17 some_directory What does the dot behind drwx------ signify? What does the 5 before ...
0
votes
0answers
30 views

Using awk and local variable for filtering [duplicate]

I have a command: $var=test_file_20200612000000 aws s3 ls [s3 bucket name] --profile [profile name] | grep "test" | awk '$4 > $var' This is looking at files on an s3 bucket and ...
0
votes
1answer
91 views

Filter files on a s3 bucket based on the file name

I have an s3 bucket which has files named as such: example_test_20200612010000 example_test_20200612020000 example_test_20200612020000 example_control_20200612010000 example_control_20200612020000 ...
-1
votes
1answer
27 views

How to solve an “output going to a pipe” overflow? Does an asynchronous pipe exits? My command : “ls -l *.htm | wc -l” is failing [duplicate]

A directory I have is filled by a lot of files. I want to discover of what kind they are and whose of them are so numerous. Here are the events when I try some commands : ls -l | wc -l 1514340 ls | ...
-1
votes
1answer
45 views

What does the ls ????? command do? [duplicate]

I was trying to learn more about Linux and came across the command ls ????? and it displayed a few files in the directory but I am not really sure what it is specifically displaying. I tried to use ...
1
vote
4answers
96 views

How can I exclude . and .. when listing only hidden items?

ls -d .* lists only hidden "items" (files & directories). (I think) technically it lists every item beginning with ., which includes the current . and above .. directories. I also know that ls -A ...
0
votes
1answer
46 views

Why does mkdir dir{1..10} create dir10 before dir2? [duplicate]

[xxx]$ mkdir dir{1..10} [xxx]$ ls dir1 dir10 dir2 dir3 dir4 dir5 dir6 dir7 dir8 dir9 When I make 10 directories like this, why does dir10 appear right after dir1? Shouldn't it be the last ...
0
votes
3answers
54 views

How to get the total duration of all video files in current folder and sub-directories [duplicate]

I am trying to get the duration of a bunch of files in current directory and its sub-directories all ending in .mp4. I'm trying to use ffprobe. To make things simple, I am not using find, but ls. If ...
0
votes
2answers
47 views

ls cmd not showing files and dirs in the order I need

I have a mymid_LS script: #!/bin/sh ls -pt it is supposed to list all files and dirs(not hidden) and sort them by the order of time modified. I made my script executable: chmod 755 my_midLS I ...
1
vote
1answer
37 views

Why is ls much slower than echo *? [duplicate]

(Inspired by the comments for this question) Why is ls this much slower than echo *? $ time bash -c 'for i in {1..10000}; do ls -f > /dev/null; done' bash -c 'for i in {1..10000}; do ls -f > /...

1
2 3 4 5
24