Questions tagged [ls]

Command to list information about files.

Command to list information about files.

manpage.

69 questions
2
votes
2 answers

PuTTY pscp directory listing - can you specify a different file date/time format?

I'm using pscp.exe from PuTTY with the -ls option to get a directory listing via STDOUT to a perl script. The output I get is this: Listing directory /path/to/my/directory drwxr-sr-x 2 234 11 4096 Feb 4 11:11 . drwxrwxrwx 21…
BG100
  • 169
  • 1
  • 14
2
votes
5 answers

ls returns nothing only in certain directories

I have a raid drive mounted here: /data/ And certain directories like this one: /data/somedir/somesubdir/ when I run ls w/ or w/o any flags, terminal doesn't return anything. It does not return an empty directory listing. It simply goes to the…
Jake Wilson
  • 8,814
  • 29
  • 97
  • 125
1
vote
1 answer

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 command, because the newline will split one…
1
vote
1 answer

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 76547986 200 5073032 Mar 15 08:41…
1
vote
2 answers

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 remember how to get to the latest directory every…
Ramy
  • 117
  • 1
  • 8
1
vote
0 answers

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) find /tmp/art -atime +160 -exec rm -f {}…
Damainman
  • 1,045
  • 5
  • 16
  • 26
1
vote
1 answer

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 1K-blocks Used Available Use%…
Fmstrat
  • 237
  • 4
  • 15
1
vote
2 answers

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 Regular Expressions or any other idea for example…
yael
  • 2,433
  • 5
  • 31
  • 43
1
vote
0 answers

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: :/mnt/fs101 /mnt/fs101 nfs…
scott
  • 123
  • 2
  • 7
1
vote
3 answers

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
  • 19
  • 2
1
vote
2 answers

Why does ls -lh and ls -ldh give me varying file size?

Why is that there is a difference in the file sizes as denoted in the screenshot i.e. the total file size under ls -lh is 44k whilst the size of the folder is only 4k? Am I reading it incorrectly?
PeanutsMonkey
  • 1,892
  • 9
  • 27
  • 28
1
vote
2 answers

echo with each parameter on its own line

I would like an output similar to ls -1d, but I don't want to check if each file exists. I would prefer to just list the files. I could use echo, but echo only puts a space between files. How can I put a return between the files/parameters?
700 Software
  • 2,233
  • 10
  • 49
  • 77
1
vote
7 answers

In Unix is it possible to list directory entries after a starting point?

For example, if my directory contains files a, b, c, c1, c2, c3, c4, d, e, f, g Is there a command something like the following pseudo code ls -filename>"c2" that would only list files c3, c4, d, e, f EDIT: Modified question to address a more…
Noah
  • 259
  • 6
  • 12
1
vote
1 answer

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 time. However, why doesn't "ls -U" by it self does not start returning…
iddober
  • 113
  • 3
0
votes
1 answer

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=password //machine 1's ip/SrcFolder/. This works fine…