Questions tagged [ls]

Command to list information about files.

Filter by
Sorted by
Tagged with
0 votes
0 answers
19 views

What is the /usr/bin/dir binary on linux? [migrated]

I noticed I have a /usr/bin/dir which mostly behaves like /usr/bin/ls. I assumed first it was a convenience for people coming from DOS/Windows. I assumed this would just be a softlink to ls, but my ...
Evert's user avatar
  • 127
0 votes
1 answer
111 views

rsync directory is smaller at destination

I am having a difficult time using rsync from my computer to a remote server. I have a folder with a few sub directories and a lot of small files. On my computer the total size of my directory (using ...
S.Beale's user avatar
1 vote
1 answer
49 views

How come "ls -U" on a directory that contains many files takes some time, while doing "ls -U | head" returns an answer immediately?

When you want to get a sample of file names from a directory that contains many files, it is advised to do "ls -U | head", because otherwise doing "ls" alone can take quite some ...
iddober's user avatar
  • 113
0 votes
1 answer
517 views

How can I search for symlinks that point to other symlinks? [closed]

I have morass of chained symlinks like this scattered around: A (symlink) -> B (symlink) -> C (file) Some may even involve longer chains, I'm not sure yet. When manually examining a single file ...
Displayname71's user avatar
0 votes
1 answer
494 views

ls command that shows AM/PM

I'm using a CentOS 7 OS, configured based on AM/PM. Is there a linux command line (like ls --full-time) that shows full time information including AM/PM? Below example does not show AM/PM: # ls --full-...
Bernard K.'s user avatar
0 votes
1 answer
215 views

ls command hangs after I pause the destination folder

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=...
MidTierDeveloper's user avatar
0 votes
1 answer
685 views

Why does dovecot cur folder remain very large after emptying it?

My CentOS system, used for PHPList, accumulates incoming mail in this path: /var/qmail/mailnames/example.com/noreply/Maildir/cur There used to be hundreds of thousands of emails in this mailbox, they ...
Doochz's user avatar
  • 141
1 vote
1 answer
1k views

Is a newline in a filename still problematic when using ls

As mentioned here: https://stackoverflow.com/a/5886002/2534715 http://mywiki.wooledge.org/ParsingLs (last section) newlines \n in filenames are an issue, when pipe-lining the output of ls to another ...
Michael Scheffenacker's user avatar
0 votes
1 answer
892 views

ls *.csv --ignore="*pattern*" returns files which contain "pattern"

Why does ls --ignore not ignoring the pattern? Looking at the below example: mkdir books cd books touch books_abby.csv touch books_karen.csv touch books_david.csv touch books_tom.csv This creates ...
Greg's user avatar
  • 1,677
6 votes
3 answers
10k views

How to Fix Directory with all Question Marks as Permissions

I'm using CentOS 7 and trying to list a directory's contents but can't. When I try to list the contents, I get the following output: [entpnerd@myhost ~]$ ls -ali /data/sharedlogs/otherhost/ ls: ...
entpnerd's user avatar
  • 165
1 vote
1 answer
2k views

ls -lt not working in SFTP

I log into sftp: sftp user@server Then I run: ls -lt I expect files to be sorted by date. sftp> ls -lt *.csv -rw------- 0 76547986 200 5073032 Mar 14 08:42 file1.csv -rw------- 0 ...
cheesesticksricepuck's user avatar
4 votes
3 answers
1k views

du -sh * show significant more used space that ls -lah

I am having trouble with running out of diskspace of one of my clients servers. The output of the commands ls -lah in /var/lib/mysql shows: drwx------ 2 mysql mysql 16K Dec 30 2015 database_xyz ...
Orphans's user avatar
  • 1,414
0 votes
2 answers
25 views

How would I list owners and permissions for all directories named X recursively?

Basically I would like to do a 'ls -l' recursively showing only those directories named web. How would I accomplish that?
Frank Barcenas's user avatar
0 votes
1 answer
323 views

Why does this file with dots and backslashes only show up with ls -lah and not ls?

I am removing a file which has been identified as infected. This file has dots and windows-style backslashes in the name. (Linux directories are separated with slashes like this "/" whereas this file ...
Jack Amoratis's user avatar
21 votes
2 answers
4k views

Very strange file size (more than 600 PB) on a small filesystem

I had a file on an XFS filesystem which size was about 200 GB. It was a QCOW2 image containing a virtual disk of a KVM-driven virtual machine. Something went wrong (maybe it was some glitch of qemu-...
Volodymyr Melnyk's user avatar
-1 votes
2 answers
258 views

Why does ls -1 not show all results? [closed]

I am trying to get a list of only directory names in order to store it in a variable for a foreach for processing later on. However, just testing the ls first I am getting weird results. For ...
Jonathan's user avatar
  • 151
0 votes
1 answer
1k views

Unable to use grep regex to search for filename containing period

Ubuntu 14.x. Using grep to search for all files linuxtest-client2. This includes multiple file extensions (csr, crt, key). When I grep for the middle portion of the filename, "2.", it also returns ...
lobi's user avatar
  • 1,093
-4 votes
1 answer
1k views

How to turn on ls -l headers? [closed]

How do I turn on the labels for ls -l? -rw------- 1 root root 0 Jan 2 2014 php_logging.log The first is permissions but root root confuses me. One is the username of the owner ...
user268506's user avatar
0 votes
1 answer
224 views

cygwin find -ls behaviour like ls [closed]

I use cygwin find with -ls (find . -ls) option to have a list of files with full path. Due to UTF-16 (windows XP in this case) converted to en_UTF-8 under cygwin, special charactere like accent are ...
NeronLeVelu's user avatar
6 votes
1 answer
10k views

`ls` causes Segmentation Fault on a specific directory

I used $HOME/.local as prefix to install some applications without root access. There is one directory inside $HOME/.local that I can't execute ls command: [tuananh@server lib]$ ls Segmentation fault ...
Tuan Anh Hoang-Vu's user avatar
-3 votes
2 answers
2k views

Remove all files in directory except last 20

I have question why is my cmd for "removing all files in directory except last 20" not working within cron but in command prompt yes. * * * * * ls -1tr /home/testusr/test | head -n -20 | xargs -d '\...
George_223907's user avatar
1 vote
2 answers
2k views

how to pipe results from LS to CD in ubuntu

I'd like to ls for the latest created directory in a given directory (we create a new folder for each release) and then cd to that directory. I'd like to create an alias for this so I don't have to ...
Ramy's user avatar
  • 127
0 votes
1 answer
257 views

ls -l shows constantly updating log files with few minutes old time stamps (modified time)

I gave the command ls -lt to see which log files are constantly being written into, since if they are being written into, the modified time will almost be very close to date command's output. But ...
Gautam Somani's user avatar
1 vote
0 answers
243 views

Clarifying what modifies atime and the impact the find command might have

So on a regular basis I clear out files from my server which have an atime +160 with a command such as: (technically to delete old files but avoid any file that might have been accessed recently) ...
Damainman's user avatar
  • 1,055
0 votes
0 answers
428 views

du, df and ls report wrong free / used space [duplicate]

We have an Ubuntu 12.04 server running on a VMware ESXi host, with multiple partitions, running Zimbra 8 (mta/ldap only). One of partitions is a 30GB partition mounted as /opt/zimbra/data. I had a ...
jeshurun's user avatar
  • 254
0 votes
5 answers
1k views

How can I make ls and xargs combined omit path

I have a folder called lib. In that folder are some files. I want to obtain all the names of the files that end in .jar, and concatenate them into a line, separated by spaces. I don't want the path ...
Steve McLeod's user avatar
0 votes
2 answers
5k views

Input/output error reading USB backup drive on CentOS 6.4

I'm suddenly seeing some strange behaviour on our USB backup drive that doesn't make sense to me: (2013-10-21 14:58:23 [root@newdc /]$ cd /mnt/backup/ (2013-10-21 14:59:03 [root@newdc backup]$ ls -la ...
Kev's user avatar
  • 984
4 votes
1 answer
2k views

sudo fine, sudo ls not working (command not found)

On Ubuntu 13.04 running in EC2, all commands through sudo work fine except ls. Here are some example commands to illustrate the issue: ubuntu at host in ~ $ sudo ls sudo: command: command not found ...
Mike S's user avatar
  • 430
-3 votes
1 answer
3k views

Centos 5.4 - ls command not showing files on ftp server

I have installed ftp and vsftpd on my CentOS 5.4 through yum install ftp and yum install vsftpd. I have also created one ftp user with adduser ftpuser command. And here comes my problem. [root@...
Bay Emmar's user avatar
1 vote
1 answer
429 views

Correctly predicting the amount of disk usage with find/ls/stat and df?

I'm trying to programatically calculate the number of files that can fit on a drive. The drive uses LUKS/ext4 and has a block size of 4096. Below is a df printout of the drive. Filesystem ...
Fmstrat's user avatar
  • 237
0 votes
2 answers
93 views

How can I get ls to print output as it goes along?

It seems that under most situations ls will read the whole directory before producing any output - typically because it needs to sort or columnise the output. Normally this is fine but when reading a ...
cpcallen's user avatar
  • 144
-2 votes
1 answer
3k views

ls: cannot access file : No such file or directory. [closed]

In the shell script, I will have to access the binary logs stored in /usr/local/mysql/data. but when I do this, STARTLOG=000002 ENDLOG=000222 file=`ls -d /usr/local/mysql/data/mysql-bin.{$STARTLOG..$...
Rudra's user avatar
  • 199
14 votes
4 answers
49k views

changing colors of files/dirs in linux ls

I use putty with a black background and was wondering if there was or is a way to change the colors of the dirs which are dark blue. i noticed DIR_COLORS.xterm and DIR_COLORS do they play this role?
Mike Janson's user avatar
3 votes
1 answer
350 views

After emptying a directory with 60,000 small files, ls -l still shows large directory size?

Here is the ls -l after I did rm -f inside the cur and new directories. I expected the directory "sizes" to shrink back to the default "4096". [root@example Maildir]# pwd /var/qmail/mailnames/...
Doochz's user avatar
  • 141
-4 votes
1 answer
361 views

linux + change/edit file without effecting on file date [closed]

I want to edit some file in my linux for example ls -ltr /etc/some_file -rw-r--r-- 1 root root 188 Jul 1 2010 sysstat . echo "Server101_IP=187.0.98.4" >> /etc/some_file . I expect ...
yael's user avatar
  • 2,463
0 votes
2 answers
2k views

linux\solaris + print specific date format from file

subject - print file date on solaris as format: yymmdd ( yy - year , mm - month , dd - day ) on Linux machine I type the following command in order to get: file date as the following: ls -l --time-...
yael's user avatar
  • 2,463
2 votes
3 answers
6k views

How to find largest files in a dir - ignoring directory sizes

I want to do something like this du -a | sort -rn | head But I want to extract files only, ignoring directories. To be clear, I want to traverse through all sub-directories but I don't want to find ...
denormalizer's user avatar
2 votes
2 answers
2k views

How to redirect ls to the cd command

I want to do ls | grep something and cd to the one thing that is listed. I tried with | and searched, but nothing found. Is it using xargs?
Vaska's user avatar
  • 57
4 votes
1 answer
374 views

Glob Not Match?

How to list files that don't match a glob? E.g., let's say I have a directory that contains hundreds of files, 97% of which have the filename extension .png. I know I can list the PNG files with: ...
ma11hew28's user avatar
  • 799
4 votes
1 answer
1k views

Cannot open files modified with Cygwin on Windows, clue in ls -l output

I can no longer open the tabs.html and tabs.js files indicated in the output below (2nd and 3rd out of four). Using cygwin I applied a patch to them. I believe the clue is in the ls -l output. ...
Dexygen's user avatar
  • 307
1 vote
2 answers
159 views

linux or solaris match files with uniq syntax

how to match all files that start with the string OS_PATCH and ended with .gz remark - the solution must to fit Linux and Solaris OS this task could be by find command or maybe with ls with ...
yael's user avatar
  • 2,463
-1 votes
2 answers
450 views

remove files starting with dash

I have (by mistake) created several files starting with a dash in my home directory. I can not select them nor delete them. # ls -lht -rw-r--r-- 1 root root 325 Mar 22 16:33 -s-vmstat-overall -rw-...
shantanuo's user avatar
  • 3,619
-1 votes
3 answers
174 views

List files and directories in linux [closed]

I am not very familiar with Linux. I have got root access of a server. When I run the command "ls" then it displays nothing. No error no information nothing. When I run "ls -l" it displays "total 0" ...
Ali's user avatar
  • 251
33 votes
8 answers
85k views

How do I exclude directories when listing files?

How do I exclude directories when listing files in the current directory? ls . ^ will include directories in the listing.
Stephen Watkins's user avatar
2 votes
1 answer
2k views

'ls' taking a long time to list 20 subdirectories

I have a directory (my_dir) which has 20 sub directories. Every time I run 'ls' or try to autocomplete a file name in this directory my IO usage goes to 100% and it takes very long time (10 mins) to ...
Kan's user avatar
  • 29
28 votes
3 answers
25k views

FreeBSD: How to know real file size on zfs with compression on?

I'm using zfs on my FreeBSD 9.0 x64 and pretty happy with it, but I find it hard to count directory real, not compressed, size. Surely I can walk over the directory and count every file size with ls,...
Alexander's user avatar
  • 824
2 votes
2 answers
310 views

Is there a way to ls -l with like a -f option (like tail -f)?

Suppose I am extracting a huge file or slowly building up a huge file. Is there a way to have ls -lh "on" much like tail -f, so that I can constantly see the size of the file grow until I decide to ...
hobbes3's user avatar
  • 635
1 vote
0 answers
455 views

Why does a file on an NFS mount seem to cache randomly, but no longer be cached when running `ls`?

Here's the mount configuration of an NFS mount, we'll call it server2, gotten from running cat /etc/mtab: <ip1>:/mnt/fs101 /mnt/fs101 nfs rw,relatime,rsize=1024,wsize=1024,timeo=14,intr,cto,...
scott's user avatar
  • 123
1 vote
3 answers
2k views

cd or ls not found?

All commands have been working until a few days ago on our Ubuntu server. When running ls or cd it returns bash: /bin/ls: No such file or directory. How can this be fixed?
Wombats's user avatar
  • 19
5 votes
1 answer
327 views

Who is the "author" of a file (Gnu "ls" manual)

In the manual for Gnu "ls," I see this: --author with -l, print the author of each file Does anybody know what the “author” of a file means in this context? This is (maybe?) not the file'...
BRPocock's user avatar
  • 198