Gregg, thanks for submitting a bug report.

`ls -l` won't show hidden files or subdirectories. I was unable to
download the link you sent, but I grabbed the download link from
torproject.org:

wget 
https://dist.torproject.org/torbrowser/14.0.7/tor-browser-linux-x86_64-14.0.7.tar.xz
tar xf tor-browser-linux-x86_64-14.0.7.tar.xz

tree -a tor-browser | tail -n 1
30 directories, 225 files

find tor-browser -type f | wc -l
225

# Using fd-find (https://github.com/sharkdp/fd)
fd -H -tf '' tor-browser/ | wc -l
225

# How about ls?
ls -l tor-browser | wc -l
3

# Weird... try again with --recursive
ls -l --recursive tor-browser | wc -l
305

# Now it's overcounting. This is actually because ls does some pretty-printing 
(which prints extra lines):
ls -lR | head -n10
.:
total 119332
drwx------ 3 benjamin benjamin       100 Mar 12 10:06 tor-browser
-rw-r--r-- 1 benjamin benjamin 122193072 Mar  3 17:00 
tor-browser-linux-x86_64-14.0.7.tar.xz
./tor-browser:
total 42920
drwx------ 10 benjamin benjamin      960 Mar  3 04:37 Browser
-rwx------  1 benjamin benjamin     1729 Mar  3 04:37 start-tor-browser.desktop
-rw-r--r--  1 benjamin benjamin 43943480 Mar 12 10:06 
tor-browser-linux-x86_64-14.0.7.tar.xz


---

Generally, `ls` is not the most reliable way to count files. I'd
recommend to stick to `find`, as it seems to work better with other
tools like `wc`.

** Changed in: linux (Ubuntu)
       Status: Confirmed => Invalid

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2100730

Title:
  ls Undercounts Files/Directories on btrfs Kubuntu 24.04

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2100730/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to