Questions tagged [ls]

The ls command lists the contents of a directory.

68 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5
votes
1answer
701 views

Changing the spacing between files in ls

This is more of a cosmetic question but this is really bugging me. On OS X, when I run ls -G (or use CLICOLOR=1) instead of regular ls it changes the spacing of the columns, as you can see in this ...
4
votes
1answer
570 views

change ls color on OpenWrt

I am not able to change the color of dir entries for ls command (dark blu is a very annoying color to read) on my OpenWrt device. I've added the line LS_COLORS=$LS_COLORS:'di=0;37:' ; export ...
3
votes
0answers
52 views

How can I debug or trace sorting for “LC_COLLATE=en_US.UTF-8 ls -l”?

(Unexpected sort order in en_US.UTF-8 locale explains the basics of UTF sorting) Consider this test scenarion: # touch abc{.{g,t,t.t},@.s,-{s-w,t.c}} # LC_COLLATE="en_US.UTF-8" ls -l test total 0 -...
3
votes
0answers
298 views

Include special characters when sorting files

I'm trying to make Linux include special characters when sorting filenames. The sort order I'm trying to achieve is: first all special characters, then numbers, then letters (case insensitive). The ...
3
votes
2answers
288 views

Is there a a shell extension which is like scm_breeze where the output is numbered and you can alias to a file by its number

In scm_breeze, output is numbered and you can use the numbers in subsequent commands. For example here I am doing git status to see the changed files and then staging the first file for commit: ...
3
votes
1answer
225 views

How can you group symlinks with directories in `ls` output but tell the difference?

In ls output, I'd like to group symlinks that point to directories along with the rest of the directories, but still have a way of telling that it's a symlink either with color or an appended symbol. ...
2
votes
0answers
194 views

What is the 'ls' command's output layout algorithm (how does it choose no of columns AND entries in each column)?

I have tried 'ls' command on different directories on my system, the output layout is not consistent between different directories (it is, of course, to make it human-readable-friendly). However, as ...
2
votes
0answers
410 views

Difference between Makefile and zsh

I'm trying to create Makefile rule: dev: ls {web,src}/**/*.* | entr make run-build And there is different behaviour between using make dev and using this command direct. Do you have idea what's ...
2
votes
0answers
96 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 + ...
2
votes
1answer
252 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?
2
votes
0answers
340 views

ls does not show a hidden file (OS X)

I am using lsof to view the list of open files. One such file that it displays open is : Google 3864 malaykeshav 46u REG 1,1 470455334 32578671 /Users/malaykeshav/Library/...
2
votes
1answer
101 views

The tilde ~ key combination doesn´t show up in bash

I am using an acer swift one laptop with Windows 10, the keyboard setting is on standard German. I downloaded bash today from git-scm.com/download/win and tried some commands. Starting of with the ...
1
vote
2answers
44 views

List a file from all directories but skip the ones whose folder contains a specific file

I have a perl script that processes .xml files which reside in multiple folders under a directory. The script takes the absolute file path using the output of ls using parallel. parallel -j 1 /home/...
1
vote
0answers
61 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
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
0answers
76 views

How to make alphabetical sorting work with whitespace?

I am on Ubuntu 19.04 ls outputs the following, and this is how it appears in nautilus as well Arca - Arca Arcade Fire - Funeral Arca - Mutant Obviously, this should be as below. Is it possible to ...
1
vote
0answers
279 views

ls command is too slow for some directories

When I run ls command for some directories, it may take about 1.5 seconds to complete even if directory has just a few files, but for most of directories it's very fast. It seems that it's slow for ...
1
vote
1answer
467 views

“bash: /usr/bin/ls: Permission denied” Arch linux

Today I discovered that the command ls to list files, only returns the error: bash: /usr/bin/ls: Permission denied This happens for every directory I try and also when running the command as root. ...
1
vote
0answers
279 views

Sort directories before files and underscore first with ls

When using 'ls' i want to sort directories first and then all files AND sort directories/files with underscore first. Here is an example: _folder2 folder2 _file2 file I can sort directories first ...
1
vote
0answers
59 views

How to make ls work as if it was outputting to terminal?

Colors can be adjusted with --color=always, but how to make it display the columns with default settings, nicely fitted to terminal window size?
1
vote
0answers
238 views

ls ~ permission denied with xonsh in Cygwin

I tried to use xonsh in my Cygwin terminal, but ran into some problems with permissions: loom@tatooine ~ $ ls xonsh: subprocess mode: permission denied: ls However, I can use the command ls as ...
1
vote
0answers
2k views

more /proc/mounts or ls /mnt/ or df hangs

Hi I have done some toolchain upgrade, when I am trying to bootup the device it is not able to launch Webkit, because when directfb is probing the file systems for shared memory mount, it will look at ...
1
vote
1answer
876 views

LS_COLORS not respected on Cygwin

Whilst trying to configure ls' colors on Cygwin (specifically the distro babun), I found that the custom extension colors that were in the LS_COLORS environment variable weren't being used. Here's an ...
1
vote
1answer
161 views

compare file size between two identical non sparse files while copying

I'm using KVM to live migrate VMs from one host to another. I have already written a web ui to do that. Now I want to implement a progress bar. My idea is to compare the file size of the disk on the ...
1
vote
0answers
60 views

`ls\` logs out of terminal session?

Like many, I have an alias ll=ls -l[.]+ set. A moment ago, I typed ll and then accidentally hit \ on the way to return. I hit return again to finish the command (on the continued line prompt), ...
1
vote
1answer
106 views

How to make ls warning me about parent directory is symlink

I just found a scenario which i (or someone new to linux) might accidentally rm file because user thought it's duplicated file. Let's say i have this two binary files: [xiaobai@xiaobai note]$ ls -...
1
vote
1answer
1k views

change LS_COLORS behaviour

I am trying to modify LS_COLORS behavior. Presently it (say for sh or py), changes color depending on if it is executable or not, as shown here But, I want all my script, executable or not, have ...
0
votes
1answer
28 views

how to make `ls` stop ignore `.` when sort items?

When trigger ls -alhF I see .ssh got placed near ssl instead of top of the list. How could I make ls to sort files and folders to be "native" (aka .ssh/ then abd-dir/ then ssl/ dir) [centos@ip-172-...
0
votes
0answers
18 views

How to keep directories sorted by interest or frequency of usage?

Current situation Let's say I have a cloud sync directory $CLOUD_DIR with sub-directories which I want to keep sorted by interest. In order to do that I use lexicographical order and use number to ...
0
votes
0answers
25 views

File browser and bash ls give different results

Im using a NAS server with AFP service for quite some while. Now I switched finally to debian buster and wanted to use my photomaniging software again. go everything up and running. A week ago I ...
0
votes
2answers
38 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
1answer
245 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
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
0answers
70 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....
0
votes
1answer
29 views

ls colors showing unicode replacement character

On Solaris 11.4 when I try to use ls with colors in an SSH session, the output is correctly colored but there is a question mark in a box at the end of every line like this. I tried ssh from both ...
0
votes
0answers
118 views

FTP listing files (ls) with dynamic date YYYMMDD pattern

Following a previous answer I'm trying to list the files on an FTP server that match a pattern, as shown below event_date=`date +%Y%m%d` ftp -n XX.XX.XX.XX <<END_SCRIPT ls *${event_date}* ...
0
votes
0answers
58 views

What is a great way to list files found in a directory that add up to a certain file size

This list will then be used to create tar balls for easy movement. This is what I came up with so far. Add up files that are just greater than 10GB list them to file. find . -type f -exec ls -al {} ...
0
votes
2answers
197 views

entr: recognition of new files recursively

To keep track of newly added files in a directory (and it's subdirs) I want to use entr ls -d /tmp/* | entr -p notify-send "new file added." But when I add new files to /tmp/ or /tmp/foo/ nothing ...
0
votes
2answers
76 views

Trying to do a Proof of Concept of poisoning 'ls' binary to hide files and folders

I am currently trying to modify 'ls.c' source file in order to hide files and folders containing the word hidden. After doing some research, I've found that this could be possible by adding this code ...
0
votes
0answers
301 views

ls hangs after the machine hosting the source folder is paused

I have two instances of RHEL 7 Linux, machine 1 and machine 2. Machine 2 has a folder that is mounted to a remote folder from machine 1. It is done with command: mount -t cifs -o user=aaa,pass=...
0
votes
0answers
49 views

Trouble getting to Desktop directory, with Bash on Microsoft's Windows (WSL)

I'm using the Bash terminal for Windows and currently this is what I get when I type ls -a <username@userPC>:/$ ls -a . bin data home lib64 mnt root srv usr .. boot dev init lost+found opt run ...
0
votes
2answers
67 views

Move the oldest files into a directory, source directory has more than 10,000 files constantly incoming

I am working on a command to move the x number of oldest files(FIFO) into a directory, is it better idea to pipe the "find" result into "ls" or just use the "ls" .. please suggest. ls -ltr `/bin/...
0
votes
1answer
212 views

How do I get rid of human readable format for ls?

My ls -l command automatically prints file sizes as human readable. I have tried exporting BLOCKSIZE in my bash profile in various formats to change this but literally everything I have tried on the ...
0
votes
0answers
164 views

How can I determine the “alternate access control method” when the access flags in ls end with a `+`

On my Ubuntu, the directory in which pluggable media is mounted (/media/me) is owned by root and has access flags drwxr-x---+, so without the "alternate access control method" indicated by the + I ...
0
votes
1answer
644 views

Limiting recursive 'aws s3 ls' searches by number of items in the folder

Here's the scenario: I need to recursively search through tons and tons of folders and subfolders and spit out the results to a log file using the ls command, BUT, I need to stop searching a folder ...
0
votes
0answers
96 views

zsh has problem with star wildcard in long path with space in name on Mac?

If I run a simple command containing the star wildcard, for example: $ ls -ltr *.txt in a folder with a long path and a space (it does contains *.txt files): /Volumes/GoogleDrive/My Drive/XXX/...
0
votes
0answers
357 views

AIX nfs mount-point disappears (not seen even from parent dir) until umount/mount

I have experienced my share of NFS "hangouts" and related things. But today I saw something different, and I am puzzled: the mount-dir itself is not visible (/foo, not visible from / ) until I ...
0
votes
1answer
61 views

Groking UNIX file timestamps

The find manual lists several different file timestamps: access time: (amin, anewer) changed time: (cmin, cnewer) last modified time: (mmin) This is the output from: ls -lrt *.log Which timestamp ...
0
votes
1answer
52 views

Create a listing of every user which owns a file in a given directory as well as how many files and directories they own

I am having trouble understanding the code : ls -l /projects/ghosttrail | tail -n +2 | sed 's/\s\s*/ /g' | cut -d ' ' -f 3 | sort | uniq -c. Can anybody give me a detailed explanation of what is ...