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]

Questions relating to the Linux 'list' command (ls)

22
votes
2answers
1k views

Filenames with space showing as 'file name' after upgrade to 18.04

After a upgrade to 18.04, from 16.04, all file names with spaces shows as 'file name'. Previously it was simply file name. File names without space shows up normally: $ ls bar 'foo bar' While it ...
0
votes
0answers
29 views

Is there really a Bug in ls -l not observing the Environment Variable TIME_STYLE? [duplicate]

Look at this: I want to let ls- l always show the date formatted as long-iso. I was told to add a file /etc/profile.local with the line export TIME_STYLE=long-iso. I did so, as shown below under #1. ...
0
votes
2answers
68 views

Why there is no difference between / and ////// in bash path [duplicate]

ls -R /home/username/some/path is the same as ls - R /home///username/////////////some////path Is there explanation for such interpretation of '/' character in bash? I can't see implementation of ...
2
votes
2answers
75 views

Sorting files and folders with underscore at the beginning

I use an underscore at the beginning of file and folder names to mark them as something "special". But this sorting doesn't work for the most programs under Linux. I tried LC_COLLATE=C ls and other ...
-1
votes
0answers
27 views

What is the color code for the output of ls? [duplicate]

What is the color code for the ls output? I know, for example, that dark blue (not sky blue) means that it is a directory. What do red, sky blue, green and the other colors in the output of ls mean?
3
votes
2answers
177 views

Use read line to iterate over variables

I have the following files: $ ls *.png | egrep -i "am|pm" output-0 11.42.30 AM.png output-0 5.10.12 PM.png .... I want to remove them but get this error: $ ls *.png | egrep -i "am|pm" | while read ...
1
vote
0answers
37 views

How can I selectively change the background colors of previously visited directories in ls output?

I am trying to selectively change the background color of a directory as a way to label a directory already used. I have used the option: vi .dircolors dircolors -p> ~ / .dircolors I replace the ...
2
votes
1answer
29 views

Is there a way to provide customized sorting rules to “ls” command?

I work in material science so many of my directories are named by chemical element or equation. As such, ls and ls -v list my directories out of chemical order. I know I could rename my directories so ...
2
votes
1answer
19 views

Examples folder not showing in ls output

I have just installed Ubuntu 16.04 desktop on my machine and I have been getting to know it better. I used ls -la in my home directory. The result is as expected. I have Downloads, Desktop folders etc....
0
votes
2answers
54 views

What is the fastest way in terminal to get a count of files when there is so many of them? [duplicate]

$ ls -l JSON_files/*.json | wc -l bash: /usr/bin/ls: Argument list too long 0 How can I get the count of files in a folder if I have 300k or 1M or more JSON files in a directory?
13
votes
3answers
2k views

How to sort the output of `ls`?

Is it possible to view this output sorted with titlepage_1.pdf before titlepage_19.pdf? $ ls allTitlepage.pdf titlepage_12.pdf titlepage_19.tex titlepage_26.pdf titlepage_32.tex ...
1
vote
3answers
81 views

How do i make dir have colors for files/directories like ls does it?

Im running Ubuntu 18.04 and I'm very used to typing dir instead of ls as a habit. When i use ls, I get the directory contents listed with different colors for files and directories, as to be expected, ...
33
votes
10answers
5k views

Will ls always list the files that rm will remove?

Something I feel I ought to know for sure: if I ls <something>, will rm <something> remove exactly the same files that ls displayed? Are there any circumstances where rm could remove files ...
1
vote
2answers
84 views

ls < text.txt (with files in subdir and resolution of files)

Long time lurker, first time questioneer! I can't find the following: I would like to make a textfile which is filled with filenames including the ones in subdir's, their path and and metadata (...
0
votes
1answer
22 views

How to list some files, in a specific range

I would like to list multiple files in a range. My files structure is PR181111???.s01 or PR189999???.s01 so the variable I have to use are 1111 and 9999. This can be an operation to do several times a ...
0
votes
2answers
40 views

Delete 3 oldest files based on filename

I want to delete the 3 oldest files based on their filename. Here is an example of what is in my backup directory. There will be multiple copies with different times. Ubuntu_Scripts.zip_2018-08-09-...
0
votes
1answer
34 views

How can l display files from 1 to 17 and from 3605 to 3610 using ls?

l would like to display files of the following format : train_example_X.py such that X varies from 1 to 9000. What l have tried ? ls train_example_[1-17].py returns only train_example_1.py and ...
9
votes
1answer
658 views

Can ls output in CSV format with directory and file columns?

I need a recursive directory listing like ls -R, but in CSV format. I want separate columns for the directory and filename.
4
votes
1answer
376 views

Difference between output of `ls -sh` and `ls -lsh` [duplicate]

$ ls -lsh file.qcow2 204K -rw-r--r-- 1 root root 193K Jul 19 15:18 file.qcow2` $ ls -sh file.qcow2 204K file....
0
votes
1answer
46 views

ls utility cannot interpret ambiguous file references?

In one of my favourite Linux textbooks, I found a statement that ls utility cannot interpret ambiguous file references. The argument, more or less, goes like this: "First ls is called with an ...
0
votes
0answers
66 views

Error accessing a file no such file or directory (I want to rename it)

I am struggling to rename a file, I had a similar issue sometime ago but in that case I wanted to delete, this time I simply want to access it. I have cleared the directory, so only this single file ...
0
votes
0answers
64 views

Meaning of 4th column in output of ls -l [duplicate]

In 2nd line here I see 'u001' then 'root', 1st is owner as I understand, but what is 2nd ? drwx------ 13 u001 u001 4096 jun 21 03:29 .cache drwxr-xr-x 18 u001 root 4096 jun 21 03:30 .config ...
-2
votes
4answers
294 views

ls command - switch the output rows to columns [closed]

Is there any way possible to change output of ls? Normally ls displays something like this: something something1 something2 something3 something4 something5 something6 something7 and I want it to ...
0
votes
0answers
34 views

What is the “total” when running ls -la? [duplicate]

When running ls -la in the terminal the first line answer is total 12 drwxrwxr-x 3 root root 4096 Apr 28 10:44 . drwxr-xr-x 4 root root 4096 Apr 28 10:44 .. drwxrwxr-x 4 isa isa 4096 Apr 28 10:44 isa ...
0
votes
1answer
105 views

Tab completion not always working for ls command [duplicate]

If I stand in my home directory, press ls and then press Tab then I get a list of files. But if I try that with /etc/elasticsearch then I don't get a list of files. Is there some way to achieve what ...
0
votes
2answers
464 views

How to make locate output look like `ll` or `ls -la` but nicer?

The locate command output is a little bland: $ time locate etc/profile /etc/profile /etc/profile.d /etc/profile.d/appmenu-qt5.sh /etc/profile.d/apps-bin-path.sh /etc/profile.d/bash_completion.sh /etc/...
3
votes
2answers
8k views

ls -s command, what type of file size

When you type ls -s, what size unit does it use to display the file sizes - bits, bytes, megabytes?
0
votes
1answer
70 views

“ls”-command not doing anything

Doing "ls" gives me absolutely no response. No "command not found", no "permission denied", absolutely nothing. I'm really confused. Please help. Info: Running Ubuntu Server 16.04.4 on a Digital ...
1
vote
0answers
149 views

ls without parameters - No such File or Directory

while creating a backup of a Windows PC I encountered an odd File. I first discovered it while copying the parent backup where exactly the same error came up. Note that I masked all [A-Za-z0-9] with ...
0
votes
2answers
174 views

List MP4 by “ file '*.mp4' ” to a .txt

I want create a .txt with all mp4 files of a folder, but vertically and with file '/root/mp4/*.mp4' line by line. In Windows it's like (for %i in (*.mp4) do @echo file '%i') > files.txt
0
votes
1answer
43 views

List file number and size (directory and sub-directory)

I need to list the number of files (hidden AND visible) on a hard drive, including those in subfolders. Looking for a simple command for this please? This is separate from my previous question where ...
8
votes
4answers
2k views

How do I display filetype with ls?

I am ignorant as to whether ls is capable of displaying a filetype column. Doing a quick online search and searching the man did not reveal such a capability. Is it capable of doing this? ...
2
votes
2answers
128 views

How do I substitute “ls -l” with the same in “dir”?

I'm using Ubuntu server using local access only SSH, but when I issue the dir command all I get is a single list of files and folders with no details, but using dir -l gives me the long list, but ...
-3
votes
1answer
142 views

Why can't I access this folder?

Why can't I access the folder /website1? juozas@personal:/opt/lampp/htcdocs$ ls website1 juozas@personal:/opt/lampp/htcdocs$ cd /website1 bash: cd: /website1: No such file or directory juozas@...
15
votes
2answers
1k views

Different results for ls when accessing Ubuntu via SSH from different clients (Windows-PuTTy, Mac-Terminal)

Consider the following directory structure, printed to the screen using ls -l "$dir" ($dir is a bash variable standing for some folder on the same server, a few levels up), on a remote Ubuntu server (...
0
votes
2answers
145 views

Listing files of identical type with ls command can produce files with different colors

Can someone please explain to me why when listing certain files with the same extension, eg .jpg files, why they are sometimes listed green, as well as shown in pink. These are all image files. It ...
0
votes
0answers
39 views

auto colour on ls not enabled even after copying /etc/skel/.bashrc to home

Refer to a comment here I wanted to ask to the poster the question where to copy the .bashrc file to. Because copying it to the home of the user does not enable the auto color ls command. Please, can ...
0
votes
0answers
107 views

/dev/mapper/ubuntu--vg-root does not exist [duplicate]

Whenever I turn on my PC which is running ubuntu 16.04, an elert comes up, so i ran my computer in emergency mode instead and this is what comes up: Gave up waiting for root device. Common problems: -...
2
votes
0answers
2k views

Error in brand new External Hard Drive: “ls: reading directory '.': Input/output error”

This morning I was downloading some files directly to an EXTERNAL Hard Drive (1TB Seagate Hard Drive, bought a week ago) and I had to shut down the PC without unmounting the disk and while it was ...
-3
votes
2answers
56 views

Finding all .config files [duplicate]

I am new to Linux and on of my projects is to find all .config files. I made sure to be logged in as root. What command would I run to do this.
-1
votes
1answer
784 views

ls command to exclude certain files [duplicate]

Can some one please help me write an ls command to list files starting with abc (abc*.txt) and exclude the ones containing _DEL_ in the name (abc*_DEL*.txt) I am trying something like this: ls abc*....
1
vote
1answer
648 views

ls color white vs. green

I tried looking at What do the different colors mean in ls?, but the list doesn't state the color white. Look at the image below: What is the green and what is the white (libfuse.so and libfuse3.so)?...
0
votes
3answers
1k views

How can I use the ls command to find out a folder's owner and group, and what rights they each have? [duplicate]

Just switched completely from Windows to Ubuntu and am happy. I have a problem; there is a folder called /root. I want to know how I could use the ls command to find out the owner and group ...
0
votes
1answer
85 views

`ls'` command opening another shell [duplicate]

I typed ls' (ls with single quote ) and it opened another shell. Which type of shell it is? what is it used for? below is the reference:
0
votes
0answers
30 views

What does “total = n” in the output of “ls -l” indicate? [duplicate]

ls -l total 36 -rwxrwxr-x 1 vips vips 8776 Jan 11 20:56 a.out -rw-rw-r-- 1 vips vips 52 Jan 11 21:44 filemk.sh drwxrwxr-x 2 vips vips 4096 Jan 11 22:14 hello -rw-rw-r-- 1 vips vips ...
3
votes
0answers
51 views

rm -r /media/externalHD --> can't boot without external HD anymore

My external HD was mounted in /media/user/TRANSFER. By mistake I typed sudo rm -r /media/theo/TRANSFER There was an error because the device was occupied and fortunately, I haven't lost my data. ...
2
votes
1answer
300 views

Why does ls show wrong permissions for the group when using ACL?

I have the following script for setting permissions for the Joomla CMS directory: #!/bin/bash if [ ! -d "$1" ]; then echo "Error: Folder does not exist or no folder given." echo "" exit 1 fi # ...
0
votes
1answer
62 views

How to print parent working directory

How can I list everything in the parent directory without having to cd there. Can this be done with echo? In othere words instead of having to do this: cd .. && ls | grep somefile && ...
4
votes
2answers
2k views

Listing files in directory in one column

Is there a command to print the files in a directory in a single column without this additional info? Basically an ls command but with the output format of: file1.txt file2.txt file3.txt as opposed ...
2
votes
2answers
76 views

List all files in dir with color-coding alphabetically (dir and files separated)

I'm looking for a command to list all files in a directory with ls command. Requirements: - Alphabetically - Folders first, then files (both alphabetically) - No timestamps or other information, just ...