As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [ls]

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

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

How to remove all files with a pattern except the recently created file

How to remove all files with a pattern except the recently created file ls -l total 655748 -rw-r--r-- 1 jetty jetty 120579643 May 10 19:59 2023_05_10.jetty.log -rw-r--r-- 1 jetty jetty 115205809 May ...
user352290's user avatar
-2 votes
1 answer
128 views

Why do `ls` and `du` commands show a different size for the same file? [duplicate]

I am currently using Ubuntu 20.04. When I check a file's size using the du command, I get the following output: ubuntu@ip-172-31-49-39:/myxfs$ du -h newquota 4.0K newquota With the ls -la command, ...
Alakananda S's user avatar
6 votes
1 answer
228 views

Why does ls show different size for some directories (not 4k)?

While ls shows most directories having a size of 4.0K, some directories have different sizes, as shown in the output below: drwxr-xr-x 8 root root 4.0K Aug 13 2022 room drwxr-xr-x 2 root root 138 ...
randall's user avatar
  • 71
-2 votes
1 answer
63 views

Can you execute multiple commands in the shell without the use of '&&', '||' or ';'? [closed]

Without the use of '&&', '||' and ';' - Can you write a 2-line Linux script that lists all files (even ones hidden) in the current directory and the parent of the working directory and the /...
Paballo Mogane's user avatar
0 votes
3 answers
145 views

Bash command based file manager

Is there a way I could run 'ls' command, and be able to navigate through the results using the arrow keys, and selecting with spacebar, possibly going back by pushing escape? Is it something that can ...
824NZ's user avatar
  • 19
0 votes
0 answers
31 views

Check if network drive is mounted in a timely manner

I have a network drive mounted through cifs with the following configuracion in fstab: /ip/drive /local_path cifs username=username,password=password,acl,rw 0 0 I need to know as soon as possible if ...
Ulisha's user avatar
  • 1
-3 votes
1 answer
152 views

Trying to pipe, redirect, or use `grep` or similar commands in a sftp environment

How can i limit the ls command output to display only the most recent X number of files created within a folder in a sftp environment ? tail, grep, or > >> (redirect commands) are not ...
GreuDeFumat's user avatar
4 votes
2 answers
284 views

Is there any way to control ls output format

I have a directory contains some svg images among its contents. I list them with following ls command to save the output in a file: ls *200px.svg > animList.js The output file looks like: file1-...
SaidbakR's user avatar
  • 725
0 votes
2 answers
201 views

Can't view file in parent directories with a script

I have a script that looks for files in the present working directories and says if a file is a file or a directory for file in $(ls | sort) ; do if [ -d $file ] then ...
Volodya Shulga's user avatar
0 votes
1 answer
106 views

Why is the size of a symlink equal to the size of it's path string?

I've read a different question regarding this where the answer was that a symlink stores the name and target + a few bytes for other metadata. Using "ls -l dir" on ext4, why does the symlink ...
Navy's user avatar
  • 3
0 votes
0 answers
19 views

permission files option ls -l

I have problem to access to several files in a same directory. Printout of ls -l: -rwxr-x--- 1 -rwxr-x---+ 1 I can access to the second file but not the first one. What does this "+" ...
kwen38's user avatar
  • 11
0 votes
1 answer
652 views

Why does "ls --all --recursive -1 *.htm*" only list files in current directory?

In Terminal I do this command: ls --all --recursive -1 *.htm* or this: ls -a -R -1 *.htm* But it only lists the html-files in the current directory...?! According to 'man ls' that option has this ...
Henrik R.'s user avatar
  • 931
0 votes
1 answer
873 views

"cat ls" messes up my terminal's characters [duplicate]

when I go to my /bin directory and do cat ls it messes up my whole terminal's characters, even my input gets messed up and I have no option but to restart the terminal. I was just watching a toturial ...
JohnDoeVI's user avatar
0 votes
0 answers
43 views

strace doesn't output as expected for 'ls'

When I use strace with ls and save it using `-o' option, it's going to show output like the below: ➜ test strace -o st.out ls st.out test ➜ test But my question is, how did this happen? Because ...
mohammd salehi's user avatar
0 votes
1 answer
476 views

What are columns in ls -la? [duplicate]

I can't find what are columns when I use ls -la For example: -rw------- 1 myuser root 3272 may 14 16:30 my_file -rw------- 1 - access rights myuser - owner of the file? root - ? 3272 - ? may 14 16:30 ...
adroit.levees.0r's user avatar
0 votes
1 answer
119 views

Bash STRING != STRING not working with string split from `ls`

I have a bash code which assigns all files into a variable, splits the string by a space and loops over them like this: $ ls README db_password.example db_username.example files_str=$(ls) files=(${...
Daniel Katz's user avatar
1 vote
1 answer
228 views

Lists only hidden files in my home directory in long format? [duplicate]

I don't want to list recursively the sub directory as well. I have tried following but it did not worked correctly. ls -lad ~/.* ls -la ~/.*
Life rocks's user avatar
0 votes
1 answer
741 views

How can I change directory text color in C shell?

I want to change directory color in cshell. So I copied /etc/DIR_COLORS file to my ~$home and named .dir_colors. I modified that file but it doesnt change the text color. If I source that file then ...
Cho's user avatar
  • 1
0 votes
3 answers
653 views

Nested dollar $ signs for sustitution

I want to avoid creating temporary variables and get ls element by index. Here's what I tried so far echo ${"$(ls)"[2]} But I'm getting bad substitution error.
antshar's user avatar
9 votes
1 answer
2k views

Why does the "ls -l /bin" command show only 1 file?

The ls /bin command shows many files. I need to get a detailed list. But the ls -l /bin command shows only 1 file. Tell me, please, what is wrong?
Tetiana's user avatar
  • 107
0 votes
2 answers
474 views

How to determine the parent of a process like "ls"

I've read methods of determining the parent of running processes but how would I determine the parent of a process thats lifecycle is too short to run a command like pstree without the process already ...
georgelid6's user avatar
-2 votes
1 answer
192 views

Getting the total size of my five largest files in bash

I am trying to get the total size of my five largest files found in a directory but I am not getting du to work on my list. I have two ways of finding and sorting, the five largest files. #!/bin/bash ...
Delpux's user avatar
  • 1
3 votes
2 answers
2k views

`ls` with wildcard with subdirectories

When I execute a command ls *, it will show files in the current directory directories in the current directories files and directories in the directories in the current directories. When I do use ...
Tom's user avatar
  • 625
-1 votes
1 answer
46 views

Supposed to see '~' when listing file in directory

I'm working on a assignment for school and I'm having an issue getting this portion to work properly. The assignment is having me create a file in the CLI, open and edit the file in GEDIT without ...
KAi tiE's user avatar
0 votes
0 answers
461 views

ls or ll listing without permissions and hardlinks

I need recursive listing of directories for my DVD backups. The prefect format is following: Name of the directory: subdirectory0/ subdirectory1/ size date time name0.txt size date time name1.sh size ...
xerostomus's user avatar
3 votes
1 answer
949 views

How to set to Black background

Ver: Ubuntu 21.04 In order to change the color scheme, I have set as follows in my .bashrc; export PS1='${debian_chroot:+($debian_chroot)}\[\033[01;96;40m\]\w\[\033[00m\]\$ ' setterm -term linux -back ...
Mohan's user avatar
  • 61
1 vote
0 answers
818 views

ls -a or ls -lR shows empty result

at my /usr/local/lib/python3.8/dist-packages, I run sudo ls -a and it shows empty: $ sudo ls -a . .. With ls -lR it also shows empty: $ sudo ls -lR .: total 0 But there is actually stuff there when ...
Phạm Huy Phát's user avatar
0 votes
1 answer
217 views

why is /bin/ls linking to libpthread?

so strange, is ls multi-threaded somehow? what could ls possibly need libpthread for? ldd /bin/ls linux-vdso.so.1 (0x00007ffff7fce000) libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so....
hanshenrik's user avatar
2 votes
1 answer
119 views

Understanding command ls .*

I found that command ls .* shows all files and folders in upper directory. It is the same like I do cd .. ls * But how this achieved with one command ls .*? What is the meaning of . and * in this ...
vico's user avatar
  • 4,377
2 votes
1 answer
2k views

display the filenames with 4 or more characters using ls

How to display the filenames with 4 or more characters using the ls command
ben sunny's user avatar
-2 votes
1 answer
47 views

Packages and meaning of gcc-8

ls -la commands below brings file information gcc-8 that looks strange for me. I suppose it is not link. I know there are different GCC packages with different GCC versions and it looks like I have ...
vico's user avatar
  • 4,377
0 votes
2 answers
271 views

Which file operations trigger directory modification time and date to change?

I have a directory named IT-documentation. Using ls -l in the terminal at its parent directory level yields (among numerous other lines) drwxr-xr-x 16 robin robin 4096 Oct 31 08:02 IT-documentation ...
robin's user avatar
  • 1
0 votes
2 answers
1k views

Accidently make ls colors (folders, files, links...) to white

I accidentally delete/change LS colors when listing directories with the 'ls' command, so I tried the command "ls --color=auto" it works temporarily because when I reboot my terminal ls ...
Moez Ben Rebah's user avatar
-1 votes
3 answers
1k views

How to list all ASCII files present in a directory?

I want to list all ASCII files that are without extensions(.txt) in my present working directory(home). I started with the ls command in the terminal but i don't know what i should put in the options ...
skekmal's user avatar
  • 135
0 votes
0 answers
315 views

I can't create a "nordvpn" folder in /run

As you can see on the joined picture. 1 - When I type : sudo mkdir nordvpn in /run I can create a folder "nordvpn". I type once "ls"; I can see the folder, I type a second times &...
AndyFromParis's user avatar
0 votes
1 answer
48 views

Why do `ls -1 filename` just lists the filename?

When I run ls -1 filename, it just lists the filename, instead of permissions with filename. However, according to online resources, the output should also have permissions details of the file. I used ...
svyslf's user avatar
  • 3
1 vote
0 answers
1k views

ls (list) not showing all the files

A few days ago I was trying to see a few files in a directory after trying the ls command, and noticed some of them were missing. After retrying the command all files showed up. However this same ...
vitoruser's user avatar
-1 votes
1 answer
129 views

What is the difference between -l and -lt

I tried the command "ls -l" and "ls -lt" in the same directory, But it shows me the same output. Do they have any difference?
Mani Kazemi's user avatar
3 votes
1 answer
363 views

Real time file sizes?

In order to take a look at the sizes of my VM disk images, I tried ls -lh (as it was suggested here). And here is what it returned: leo@ubuntu:~$ sudo ls -lh /var/lib/libvirt/images total 65G -rw-----...
Leo's user avatar
  • 133
-1 votes
1 answer
566 views

why `ls -d .` does not list all dirs, as `ls -d */` does? [duplicate]

Like it says in the heading, I don't get why the "correct" usage of ls -d should add */ in order for ls to find the directories in my current dir, where adding the trivial . isn't helpful
CIsForCookies's user avatar
3 votes
1 answer
279 views

broke my 'ls' command (and few more)

This is how my ls command looks like now in htop: Also, when I try to run ls (or gimp or libreoffice) I get running stegsolve app that I can't reinstall (even found stegsolve binaries). $ cat /etc/os-...
user216's user avatar
  • 100
1 vote
2 answers
10k views

ls command doesn't show any files in home directory

tommy@LAPTOP-6AUB639F:~$ pwd /home/tommy tommy@LAPTOP-6AUB639F:~$ ls tommy@LAPTOP-6AUB639F:~$
Tommy's user avatar
  • 11
1 vote
1 answer
157 views

Where is the tab completion "compspec" for commands like cat and ls defined?

Some pretext: I'm installing Jenkins locally, and following the installation, I'm asked to produce a password from a text file in this folder: /var/lib/jenkins/secrets/ However, after entering cat /...
DVukajlo's user avatar
0 votes
3 answers
124 views

How to isolate file permission and file name from results of ls -l?

I want see only the file name and the corresponding file permission. How to do that? ls -l gives -rw-rw-r-- 1 jb jb 102 Apr 28 12:48 hello2.txt -rw-rw-r-- 1 jb jb 102 Apr 28 12:53 hello.txt I ...
Jay B's user avatar
  • 13
0 votes
1 answer
349 views

how to select the specific string from 'ls' command console output?

I am newbie on linux os. My target is selecting files which have the specific string values in filenames on console mode This is my sample filename, filename : apnic-2016-02-01 condition : The first ...
Luna's user avatar
  • 1
5 votes
4 answers
2k views

How to recursively list only hidden files from a terminal

I would like to do something like ls -RA .?* >> LSRA.list but with this command and some other variants I tried, I always get also all non-hidden files in the directory where I am. Namely, if ...
user126154's user avatar
0 votes
0 answers
245 views

Ubuntu terminal ls lists folders but not files

I'm pretty new to Ubuntu so I'm thinking I might've installed it incorrectly or something since this never happened on my old laptop, but here's what's happening: I'm using the ubuntu terminal from ...
Helen's user avatar
  • 1
0 votes
1 answer
107 views

Trying to create a file to meet three conditions

I need to make a file that lists the first 5 lines of the /sbin directory, with having all 5 lines numbered AND all lines capitalized. Here is one string of commands that I tried: tr [a-z] [A-Z] < ...
RetroActive's user avatar
0 votes
1 answer
79 views

Difference between la vs ls -a command? [duplicate]

There is a slightly difference between when comparing those commands.
Arjun's user avatar
  • 1
1 vote
4 answers
1k views

`ls -l` output duration instead of date/time eg "5 mins"/"6 hours"/"7 days" etc?

If I last modified a file 5 minutes ago, is it possible to make ls-l output something like "5 mins" instead of the actual date/time?
B.Tanner's user avatar
  • 2,566

1
2 3 4 5
8