Why DF and du show different results?

Why DF and du show different results?

du is used to estimate file space usage—space used under a particular directory or files on a file system. So after deleting the file, the results of df and du are different until the disk space is released.

How do I show file size in ls?

Answer: Use the –block-size Option If you strictly want ls command to show the file sizes in MB or KB you can use the ‘–block-size=SIZE’ option. It scale file sizes by SIZE before printing them; e.g., –block-size=M prints sizes in units of 1,048,576 bytes.

What is the difference between file size in ls-l and du-SH?

For files, ls -l file shows (among other things) the size of file in bytes, while du -k file shows the space occupied by file on disk (in units of 1 kB = 1024 bytes). Since disk space is allocated in blocks, the size indicated by du -k is always slightly larger than the space indicated by ls -kl (which is the same as ls -l, but in 1 kB units).

What’s the difference between ls-l and du-K?

Since disk space is allocated in blocks, the size indicated by du -k is always slightly larger than the space indicated by ls -kl (which is the same as ls -l, but in 1 kB units). For directories, ls -ld dir shows (among other things) the size of the list of filenames (together with a number of attributes) of the files and subdirectories in dir.

How does du-s find the total value of a file?

du -s traverses the file tree, adding up the number of blocks allocated to each directory, symlink, and file as reported by the stat () system call. This is how du arrives at its total value.

What’s the difference between a du and a DF?

Notice du and df report on only the blocks allocated for data actually written. The ls command reports slightly different results depending on the type of file. See the section in this document, “The ls command ” . NOTE: Both df and du default to 512-byte units.