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 ...
16 votes
2 answers
5k views

What does the "@" sign mean in ls -l output?

I have this output on MacOSX: $ ls -l total 40 -rwxr-xr-x@ 1 levente staff 52 30 Sep 15:38 pl -rwxr-xr-x 1 levente staff 675 14 Feb 17:07 plplay -rwxr-xr-x@ 1 levente staff 662 26 Jan 14:13 ...
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 ...
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.
37 votes
4 answers
30k views

What is the difference between du -h and ls -lh?

I am having a difficult time grasping what is the correct way to read the size of the files since each command gives you varying results. I also came across a post at http://forums.devshed.com/linux-...
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 ...
128 votes
2 answers
48k views

Colors in bash after piping through less?

When I have dircolors defined life is full of... color. When I pipe ls through less to scroll around I lose the colors. Any suggestions?
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 ...
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 ...
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-...
7 votes
2 answers
13k views

df showing wrong disk size

Df -h is showing a wrong empty space on my server, for one of the disks: /dev/sda2 450G 393G 34G 93% / Cpanel shows that it has only 34GB free, but there is a lot more. A few minutes ...
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 ...
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 ...
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=...
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 ...
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 ...
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: ...
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 ...
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,...
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 ...
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 ...
11 votes
3 answers
5k views

What is the alternative to ls --time-style=full-iso in BSD?

command in Linux $ ls -lt --time-style=full-iso output ... -rw-r--r-- 1 mduda mduda 1855 2009-08-26 13:07:55.000000000 +0200 screen-configurations.xml drwxr-xr-x 2 mduda mduda 4096 2009-08-26 ...
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 ...
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?
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 ...
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/...
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-...
-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 ...
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?
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 ...
-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 ...
-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@...
20 votes
4 answers
53k views

Absolute path with ls?

How can I make the ls command show a file's full path instead of just its filename? With all its options, there must be a way, right?
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 ...
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 ...
9 votes
3 answers
7k views

ls gives me "illegal option"

I recently installed zsh and now whenever I ls or ls -l or ls anything I get "illegal option". Not sure where to start looking to fix this.
-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 '\...
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 ...
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 ...
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 ...
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 ...
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) ...
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 ...
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 ...
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-...
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 ...
-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..$...
-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 ...
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?
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: ...