Questions tagged [ls]
The command to list the contents of a folder/directory in Unix and Unix-like systems.
336 questions
15
votes
2
answers
3k
views
Why does the 'ls' command show some files with a year and others with a time?
I am working on Debian Stable Linux, which is otherwise working very well.
I am using the following command to list the files in the directory so that they are sorted and the most recently modified ...
5
votes
1
answer
669
views
Why are surrounding single quotes missing if output of ls -1 is passed to a pipe?
Scenario:
$ ls -1
'x y.pdf'
$ ls -1 | cat
x y.pdf
Here we see that surrounding single quotes are missing if output of ls -1 is passed to a pipe. Why does this happen? How to keep the surrounding ...
0
votes
1
answer
362
views
Why can I not see my c drive in msys2 with ls -la?
In MSYS2 the windows c drives gets mounted to the filesystem root at /c with the command cd /c I can change into the directory. However, the directory is not visible when I run the command ls -la /. ...
1
vote
0
answers
59
views
Why is there a discrepancy between du and ls (on Linux)? [duplicate]
Please see the following image:
enter image description here
You can see that the lichess_db file is listed as 209G in ls, but du -hd1 indicates a folder size of only 196G. Why does that happen? Which ...
1
vote
1
answer
158
views
Why are UTF-8 paths (differently) escaped in outputs across core CLI utilities?
Let's say that I'm a psychopath who names my files like:
[-] `{title: "Non-Metadata", id: "s4a4ji"}`{.JSON5}.dir
That's my best attempt at making the most hideous plausible ...
4
votes
1
answer
2k
views
`ls` command stuck when run as root
I have this folder containing only two files. If I use root and cd to that folder, ls would get stuck. However, ls runs correctly when I log in as a common user, or ls from parent folder like ls ...
1
vote
0
answers
1k
views
"Directory not empty" and "Input/output error" when "cd"/"ls" into certain dirs or "rm -rf" certain files of a mounted storage drive
I have a storage device (sda) where I stored some backups in its partition 1 (sda1). Disgracefully, I killed the process (rsync) that was backing up data into the mounted storage device and, I guess, ...
1
vote
1
answer
8k
views
Powershell shortcut to list all files and folders (including hidden files) and order them by date
I'm basically looking for something like ls -alt, but in Powershell (Windows 11). Currently I'm using
gci -fo | sort LastWriteTime -Descending
but it's a bit of a doozy, and definitely not easy to ...
0
votes
0
answers
6k
views
ls to list directories sorted by date in timestamp AND by date in filename appendix results in little satisfaction
For listing of directories I always use commands like
ls -la --time-style=long-iso <directoryname>
And all is at best.
Yet on some cases I append a date-time suffix to the filename. This is ...
1
vote
1
answer
201
views
The Ranger file manager for Linux hangs with just "loading...ranger"
When I run Ranger, it prints its standard message:
loading...ranger
But then hangs forever. What is the root cause?
0
votes
1
answer
489
views
ls with range name of file
I have files with numeric as it's file name.
10asdfsfl.txt
11sdfkf.txt
20sdfdf.txt
22sdfdf.txt
30saadf.txt
40asdfdf.txt
51sadfsf.txt
62ddgfg.txt
if I use
ls -l [40-50]*
it returning list of files
...
3
votes
0
answers
244
views
hiding files with Windows "hidden" attribute in msys2 "ls"
I'm running msys2 on Windows 11:
$ uname -a
MINGW64_NT-10.0-22621 couch-potato 3.4.9.x86_64 2023-09-15 12:15 UTC x86_64 Msys
And I have it configured to use my Windows home directory (/c/Users/<...
0
votes
1
answer
88
views
How to understand the hardlinks field of a directory
I've run ls -l command but I have got a big confusion:
Ouput of ls -l in home directory:
$ ls -l
total 16
drwxr-x--- 19 farah farah 4096 اگست 18 18:40 farah
drwxr-x--- 40 hussain hussain 4096 ...
-3
votes
2
answers
3k
views
ls -R instead of find
I can see ls -R lists all files and folders. I can grep the file name from the list.
What are the advantages of "find" ?
Also, any caveats if I use ls -R instead of find?
1
vote
1
answer
249
views
Difficulty performing complex sorting when listing files in a directory with the ls command
The behavior I'm seeking is a nested sort with the ls command where sorting by one method doesn't cancel out sorting by a second method. The exact desired behavior is essentially:
First sort with ...