Questions tagged [ls]

Command to list information about files.

Filter by
Sorted by
Tagged with
1 vote
1 answer
32 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 ...
user avatar
  • 113
0 votes
1 answer
86 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 ...
user avatar
0 votes
1 answer
169 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-...
user avatar
0 votes
1 answer
159 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=...
user avatar
0 votes
1 answer
423 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 ...
user avatar
  • 141
1 vote
1 answer
649 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 ...
user avatar
0 votes
1 answer
570 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 ...
user avatar
  • 1,517
5 votes
3 answers
7k 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: ...
user avatar
  • 155
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 ...
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 ...
user avatar
  • 1,395
0 votes
2 answers
23 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?
user avatar
0 votes
1 answer
266 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 ...
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-...
user avatar
-1 votes
2 answers
174 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 ...
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 ...
user avatar
  • 1,021
-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 ...
user avatar
0 votes
1 answer
204 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 ...
user avatar
6 votes
1 answer
9k 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 ...
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 '\...
user avatar
1 vote
2 answers
1k 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 ...
user avatar
  • 117
0 votes
1 answer
240 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 ...
user avatar
1 vote
0 answers
175 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) ...
user avatar
  • 995
0 votes
0 answers
427 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 ...
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 ...
user avatar
0 votes
2 answers
4k 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 ...
user avatar
  • 964
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 ...
user avatar
  • 420
-3 votes
1 answer
2k 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@...
user avatar
1 vote
1 answer
361 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 ...
user avatar
  • 227
0 votes
2 answers
79 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 ...
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..$...
user avatar
  • 189
13 votes
4 answers
47k 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?
user avatar
3 votes
1 answer
340 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/...
user avatar
  • 141
-4 votes
1 answer
298 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 ...
user avatar
  • 2,343
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-...
user avatar
  • 2,343
2 votes
3 answers
5k 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 ...
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?
user avatar
  • 57
4 votes
1 answer
242 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: ...
user avatar
  • 779
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. ...
user avatar
  • 297
1 vote
2 answers
153 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 ...
user avatar
  • 2,343
-1 votes
2 answers
446 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-...
user avatar
  • 3,457
-1 votes
3 answers
171 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" ...
user avatar
  • 251
31 votes
7 answers
77k 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.
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 ...
user avatar
  • 29
23 votes
3 answers
21k 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,...
user avatar
  • 724
2 votes
2 answers
308 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 ...
user avatar
  • 545
1 vote
0 answers
390 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,...
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?
user avatar
  • 19
5 votes
1 answer
319 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'...
user avatar
  • 198
2 votes
4 answers
4k views

Cannot remove or list directory (ls or rm) Linux - Debian

I have a log file directory at /var/log/apache2/vhosts on a Debian dedicated server. Every day I split the main access_log into respective vhostname.com_access_log files in /var/log/apache2/vhosts In ...
user avatar
5 votes
4 answers
1k views

Why might `ls --color=always` be slow for a small directory?

For a certain directory DIR on my system, the ls --color=always takes about 8 seconds, although it contains less than 10 files and subdirectories. Without the color argument it takes no time. Why ...
user avatar
  • 2,358