Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [ls]

The command to list the contents of a folder/directory in Unix and Unix-like systems.

0
votes
1answer
53 views

Remove the padding spaces in the `ls` result on macOS

When I run command ls on macOS, it shows the folder names with same length, padding spaces for short folder names: jihu@ksm1 Home $ ls bin code devel opt personal shared While on ...
0
votes
0answers
11 views

Where to find the meaning of each color coming out of `ls --color`?

Different shells have different colors for different things. Where exactly are those colors assigned? For example, when I ls, I get two similar files but with different color and I would like to know ...
1
vote
0answers
70 views

ls command not working in the home directory

The ls command works fine for me in all other directories except my home directory, where I get the following error: * Exit with code 1, no result found, command line was:?? locate -b -i [\^g]*g[\^a]*...
1
vote
1answer
27 views

Why are files lwith the same time stamp not sorted alphabetically when listed using “ls -lt”?

I read that ls -lt will order files by modification time before sorting by lexicographical order. However, when I use the command with this syntax, I get this result: ls -lt total 192 -rw-r--r-- 1 ...
0
votes
1answer
31 views

Can't show manual pages for `ls` in Vagrant

That's my first question in here and I'm still a beginner so please bear with me. I'm having a Linux Command Line Basics course on Udacity. I got to the point where I'm asked to open a manual page for ...
0
votes
2answers
31 views

Preview current directory in shell

What often happens when I work in a shell - zsh - is that I have cded somewhere and I want to have a quick look at the directory. Using ls may produce a lot of output and leaves it in the terminal. ...
0
votes
2answers
73 views

'ls' command very slow

I have about 17k files in a directory. When I run ls directory, I have to wait for about 15-20 seconds before the results are displayed. On the other hand, when I run ls directory | wc -l or ls ...
0
votes
2answers
31 views

ls -l shows symlinked directory with two trailing slashes

I just copied my ~/.config directory to another and symlinked it back to $HOME. When I run ls -l this shows up like this with the double slash at the end: lrwxrwxrwx 1 lud lud 22 Jul 23 20:25 ...
0
votes
1answer
305 views

'ls' output doesn't show color anymore in macOS High Sierra

I use zsh and oh-my-zsh: As shown in the screenshot ls is not showing color output anymore. I set color theme from iTerm2 and set zsh theme (wezm+ theme) from oh-my-zsh. I try to set manually ...
3
votes
1answer
44 views

find or ls does not list all files in a folder in MacOS (HFS+)

ls or find command do not seem to locate all files located in a specific folder. I'm running a Mac (under El Capitan 10.11.6 (15G21013), 500GB SSD, HFS+). In one of my folders, where I have about 700k ...
1
vote
1answer
20 views

File/directory in the CentOS looks weird

I am connected to CentOS server via PuTTY and I see a weird file/directory in one of the sub-directory which looks unreal. I am not sure how the file exists there and Its not related to our work. Can ...
1
vote
1answer
489 views

'ls' command in terminal is showing all files and file permissions. How do I get back to normal with 'ls' showing only normal files and folders?

Want to get the terminal back to bryce@macbookpro instead of bryce@machine and have the 'ls' command only show visible files and folders.
7
votes
2answers
985 views

How to color output columns of ls?

Title kind of says it all: I would like to get those neat colored columns of the output of something like ls -al, say, as in 10basetom’s answer to this question.
0
votes
0answers
71 views

Unreadable colour in iTerm with spacemacs colour scheme for ls on /dev/

Running ls -l /dev/d* results in unreadable output: I reckon that this due to my colour settings in iTerm: What can be done to change it? Running ls -l on a directory where entries do not have ...
0
votes
1answer
68 views

dot “.” and “..” hidden files taking up space in empty directory

When I ls -ltr on the danny directory, it shows that the quarantine directory size as a little over 2 megabytes. Then I go to the quarantine directory and do an ls, and it has nothing in it - it is ...
0
votes
1answer
96 views

simple way of describing / tagging files in bash

Is there a quick and simple way to tag files in bash so that a list like this one -rw------- 1 root 88039 Sep 29 16:31 7CCE2EC3-3191-4379-C036-1C48CCCE4C6C -rw------- 1 root 1985554 Sep 27 16:09 ...
1
vote
1answer
46 views

How do I get a list of the fullpaths of every .git subfolder in a directory tree?

I am unable to figure out the right set of commands in a Windows Command prompt FOR /? or bash ls to do this. The following batch file I wrote demonstrates what I want, but I would like to know if ...
-3
votes
1answer
201 views

How to create tar file like this?

I need to create a .tar file testDay00. When I run the command ls -1, the output should look like this
0
votes
2answers
384 views

Bash: List files with absolute paths, one per line, no other information

I am looking for a command that lists all files in the current directory. Requirements: Absolute paths One file per line No other information (like size, permissions...) Don't show folders What I ...
2
votes
1answer
92 views

ls(1) acts strangely when input is a variable / subcommand or just typed

D I'm facing a issue on ls(1) that I'm almost sure that it's a silly thing that I'm just letting pass away. Anyways, I can't understand really why this isn't working. I'm using bash for cygwin (Don'...
0
votes
1answer
137 views

How to add a background color to a executable, without replacing the foreground color?

Currently I setting the ~/.dircolors file to: LS_COLORS='fi=93:'$LS_COLORS LS_COLORS=$LS_COLORS':ex=41' Which are: # 41 = red background # 93 = yellow # fi = file # ex = file which is executable ...
0
votes
1answer
48 views

nemo and ls showing different filenames

I'm trying to analyze a piece of malware from the internet. I found out, that nemo browser and ls command show the filename of the malware in different ways. ls displayes filenames IMG147pgj.exe, ...
2
votes
2answers
572 views

How to distinguish a file from a directory in a ls output?

How to distinguish a file from a directory in a ls output? I want to work with files and go into directories, however, I just get a list of names of them all: for i in ls B do echo $i done
0
votes
1answer
113 views

Removing a file with special characters through terminal, which has been selected by another command

this is my first post, so go gently :) I'm creating an AppleScript which runs bash commands to select and delete the most recently modified file within a specified group of folders. The file name ...
1
vote
1answer
320 views

ls add host name prefix?

Is there a compact way to list files, with the host name prepended? My efforts to combine ls, xargs, paste and process substitution have failed me. This is the best I came up with: ls * | paste <...
1
vote
1answer
107 views

Color of 'ls' changed after zsh upgrade

I am currently using zsh 5.0.2 (x86_64-pc-linux-gnu), when doing ls the folders was showing in blue, but after an upgrade everything is in white .. When doing ls --color=auto or ls --color=tty it goes ...
1
vote
1answer
124 views

`awk -F_ “{print $1}”` not removing everything before the underscore in each line

I'm using Mac. I have a directory in which the files have names like ABC_2016-06-08_09-23.csv. I want to extract the part of each file name before the first underscore. I tried doing ls | awk -F_ "{...
4
votes
1answer
1k views

How do I show hidden files beginning with a certain letter in Linux?

I'm trying to show hidden files that begin with the letter b. I have tried: ls b ls b* and many other options but can't find a solution. How can I do this?
0
votes
1answer
154 views

Mac OSX Terminal ls, cd & ditto command return odd results

My MacBook Pro (Retina, 13-inch, Late 2013) running OS X El Capitan has some weird thing going on with terminal and more specifically when I run the ls, cd or ditto commands. I have my disk ...
0
votes
2answers
134 views

Combine tabnew and ls in vim

When I need to open a file in a new tab in vim, I do :tabnew relativepath/filename. I find it difficult to hunt for files from tabnew. It does auto-completion and it even cycles through items in a ...
0
votes
3answers
389 views

Why won't ls command show users in home directory?

In unix, when I create a user with useradd it creates their home directory in /home by default. But I specified another user to have its home directory in /home/summer. When I use the ls command ...
0
votes
0answers
109 views

ls /dev/sda2 - same as dir c:

I want to install linux mint. The problem is, I have drive c and d. I want to install it in drive c. I think it is /dev/sda2 but I`m not sure. I want to dir this drive to see files and check if I can ...
17
votes
2answers
2k views

What does the first dash mean in an ls -l output?

From the bash man pages about viewing permissions with ls: User ls output Owner -rwx------ Group ----rwx--- Other -------rwx That makes sense, but what is the first - used for then? It's ...
0
votes
1answer
109 views

changing colors in ls?

Is there a way to change the colors for directories etc for ls while using gnu screen? I have tried using this but it doesn't work.
0
votes
2answers
395 views

Why does Red Hat 7.3 (not RHEL) `ls` show file sizes in bytes, even when `-k` or `--block-size` is specified?

We have an old Linux server, some OS version information, as follows: $ uname -a Linux dm.inside.com 2.4.18-17.7.xsmp #1 SMP Tue Oct 8 12:37:04 EDT 2002 i686 unknown $ cat /etc/redhat-release Red Hat ...
1
vote
1answer
244 views

ls --group-directories-last ? (List directories AFTER files)

We know there is a way to list directories before files using: ls -1 --group-directories-first Is there a way to get the opposite? I thought --reverse would do the trick but apparently not. NOTE: I ...
3
votes
4answers
84 views

Directory content sizes integrated into `ls`?

ls lists directory contents. du lists directory content size. Is there some way to get a ls-like listing but with directories showing content size?
0
votes
1answer
87 views

Regarding files resulted in equating file properties in “ls” command

I have a folder in which there are thousands of images. Of those thousand images, I want to bring together all those images whose “Last created” and “Last modified” properties are exactly same. ( In ...
0
votes
2answers
572 views

Exclude a directory from `ls -R` command in FreeBSD

I want to list all of my files in a directory in FreeBSD 9.2, but I don't want to include a specific directory. I checked both -I and --ignore parameters for ls, but I only ignores superuser mode and -...
0
votes
1answer
44 views

rename top 10 latest file according to their names

I have some .xls files in a defined directory (say in /A/B). I want to rename top 10 latest files and append "-bkp" in their names. I tried, not working ls -lt *.xls | head -1 | awk '{print "mv " $...
0
votes
2answers
27 views

display number of files in current moment like what tail -f do

I have a folder which files are copied to it like /home/my/. I want to run a command which shows number of files inside it in real time like what tail -f do with file contents. I know I should run ls *...
1
vote
3answers
68 views

Sort by `ls -l` Dates Without Using `ls`

I have a text file with a bunch of ls -l output, such as: -rw-r--r-- 1 root root 7554952082 Dec 15 22:11 /var/spool/stuff/Investigation/messages.tgz -rw-r--r-- 1 root root 4315 Mar 3 2015 /var/...
-1
votes
1answer
2k views

File does NOT exist but ls shows “No such file or directory” error

File system ext4 // which ls -> /bin/ls // Bash -> 3.2.57(2)-release // whoami -> admin If I run ls then I firstly get a list of files with error "No such file or directory" and then ...
-1
votes
2answers
1k views

ls: show date of last updated file in directory tree, for each directory/file in list

I am looking for parameters to ls, or something equivalent, that do the following for a specified directory: For each subdirectory: Look at each file and directory it contains, recursively. Find the ...
2
votes
3answers
310 views

cd to most recently modified directory after ls -lt in one command

When i browse logs, i use ls -lt in order to see most recently modified folders. Is there a shortcut for entering this folder in one command? Perhaps pipe to other command will do the trick? For ...
0
votes
1answer
54 views

Find last edited directory in a bash script

I have been told never to parse ls, but I would like to use the last edited directory in myDir as a variable in my bash script. I know I could capture this via ls -ltr myDir | tail -n1 | awk '{print $...
1
vote
1answer
86 views

Alternative to ls to group extensions before sorting

I'm looking for some way to modify/replace ls with a command that is capable of: Grouping directories first (as ls does) grouping files by user-defined extension groups (e.g., all image-type ...
2
votes
1answer
2k views

ConEmu + ls — 256 colors not working

I'm using ConEmu (specifically Cmder's version). Running 'cmd', it supports 256 colors (top). However, I can't get other programs to run in 256 color mode. I've tried Perl (middle) and ls (bottom), ...
1
vote
1answer
638 views

Displaying unicode emoji in filenames on Ubuntu

I'd like to use emoji in filenames and access them on the command line, but I can't seem to get it to work with ls. Weird thing is, if I pipe into just about any other program, the emoji are correctly ...
0
votes
2answers
60 views

LS but exclude suffixes

I have files foo.mp3 bar baz.mp3 bar baz 2.mp3 What command would output the following? foo bar\ baz bar\ baz\ 2 I know ls -1b handles the escapes, but how do I cut the ....