Results 1 to 5 of 5

Thread: File list of every file on the HDD

  1. #1
    Join Date
    Feb 2009
    Beans
    75
    Distro
    Ubuntu 20.04 Focal Fossa

    File list of every file on the HDD

    I have looked around but I didn't find a working solution.

    I am using Ubuntu 19.04.

    I want to list all files together with their location(path) and their size - nothing else.

    find . lists all the files but can I add the filesize?
    Is there another command which I should consider?

    Thank you

  2. #2
    Join Date
    Dec 2014
    Beans
    1,605

    Re: File list of every file on the HDD

    The option '-printf "formatstring"' of find enables you to print out all kinds of information about the found files.
    Code:
    find / -printf '%p %s\n'
    The '%p' in the format description is the complete path and name, '%s' is size in bytes. You might want to add the option '-xdev' to stop find from going into other filesystems like /proc, /sys, /dev or mounted drives.

    Holger

  3. #3
    Join Date
    Feb 2009
    Beans
    75
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: File list of every file on the HDD

    Thank you Holger. It is solved.

  4. #4
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    21,331
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: File list of every file on the HDD

    There is also the old ls -lR method, that was included in every CDROM with F/LOSS software from the 1990s. If you find any Linux ISO/disc from that time, you'll always find a file in the ISO9660 root named LS-LR or something close to that.

    Removing columns from text files is something any good text editor should accomplish trivially. vim does it.
    Or you can use awk, sed, cut, perl, python, ruby, or any other minimally capable programming language.

    Sometimes it is handy to sort by size, rather than location. ls can do this without piping through sort.
    ls -lRS

    Anyway, there are many solutions possible. Holger_Gehrke's is probably the best, based on the problem description.

  5. #5
    Join Date
    Jul 2007
    Location
    Magic City of the Plains
    Beans
    Hidden!
    Distro
    Xubuntu 20.04 Focal Fossa

    Re: File list of every file on the HDD

    Quote Originally Posted by UBUminJ View Post
    Thank you Holger. It is solved.
    Please use Thread Tools at the top of the page to mark it so. Thanks.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •