07-12-2011
df reports file system disk space usage. Thus, given an argument, FILE, it will report the disk space usage of the filesystem containing FILE. Note that it is not reporting the disk space usage of the directory represented by FILE.
du on the other hand, given an argument FILE, reports the disk space usage of the directory represented by FILE. Presumably, it performs a recursive directory traversal of FILE adding the reported size of each file until the traversal is complete. In contrast with df, du may potentially report cumulative file sizes from files on multiple filesystems.
But, to answer your question more directly--it is best to use du. In many cases (depending on the number of files in the directory represented by FILE), du will take many times longer to execute than df due to the aforementioned directory traversal so expect to wait a little.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Can someone tell me how to read these damn sizes.
i mean, i prefer to see sizes in MB but that is not the case when you do an ls -l on directories. i have a had time converting these to MB
just for verification purposes, what would a directory size like this = 3499990308 represent in MB
or... (3 Replies)
Discussion started by: TRUEST
3 Replies
2. UNIX for Dummies Questions & Answers
Hi I need to take a list of files that are defined by an ls -ltr or grep for particular file names - and add up the byte size colum which is field 5 seperated by a space.
I tried to do this but I think I am way off:
for file in 'ls -ltr | grep 20070916 | nawk -F" " '{temp+=5} END {print... (1 Reply)
Discussion started by: llsmr777
1 Replies
3. Shell Programming and Scripting
Hi, Need help for a Script for checking and reporting database file sizes in a directory.
Request you to please give your valuable inputs.
Thanks a lot in advance.
Best Regards,
Marconi (1 Reply)
Discussion started by: marconi
1 Replies
4. Shell Programming and Scripting
Hello every one,
Iam newbie to this forum and shell programming &scripting.
i needed to compare each and every folder of two separate servers.
Actually I have copied some directory structure from one server to second server, to build on second server the files all should be copied... (3 Replies)
Discussion started by: mannam srinivas
3 Replies
5. Shell Programming and Scripting
I have the following script:
#!/usr/bin/ksh
export MDIR=/datafiles
NAME=$1
SERVER=$2
DIRECTORY=$3
DATABASE=$4
ID=$5
export dirlist=`/usr/bin/ssh -q $ID@$SERVER find $DIRECTORY -type d -print`
for dir in $dirlist
do
SIZE=`</dev/null /usr/bin/ssh -q $ID@$SERVER du -ks $dir`
echo... (6 Replies)
Discussion started by: la_womn
6 Replies
6. UNIX for Dummies Questions & Answers
Hello everyone,
can anybody help me in finding a way to obtain a list of all the directories and their sizes.
I would like to be able to run this and obtain an output like a tree structure with each branch saying how much space it is taking up .
Hope you can point me in the right direction.... (1 Reply)
Discussion started by: gio001
1 Replies
7. Shell Programming and Scripting
I have 2 big files in the size of gb. They are same with respect to content, both are “,” delimited. Now both of them are created by two different processes but has the same logic. The problem is they are differing only in few bytes for e.g one file is 202195751 bytes other is 202195773. So... (2 Replies)
Discussion started by: dsravan
2 Replies
8. UNIX for Dummies Questions & Answers
Hi everyone!
I need to compare two file sizes.
One of them (size) will be stored in a flat file and the other coming from a listed file.
I can now get the first file size using:
SIZE=`ls -l $DOCTYPE | awk '{print $5}'`
1. How can I store this value in a flat file?
2. How... (2 Replies)
Discussion started by: mrreds
2 Replies
9. Shell Programming and Scripting
Hi ,
I'm trying to list the files and output is written to a file. But when I execute the command , the output file is being listed. How to exclude it ?
/tmp
file1.txt
file2.txt
ls -ltr |grep -v '-' | awk print {$9, $5} > output.txt
cat output.txt
file1.txt
file2.txt
output.txt (8 Replies)
Discussion started by: etldeveloper
8 Replies
10. UNIX for Beginners Questions & Answers
Good Morning,
What's a good way to get partition/slice sizes down to the byte on Solaris 9? I've tried a few ways, but only see results like 8.21GB which rounds the number.
Thanks! (5 Replies)
Discussion started by: Stellaman1977
5 Replies
LEARN ABOUT CENTOS
grub2-bios-setup
GRUB-BIOS-SETUP(3) Library Functions Manual GRUB-BIOS-SETUP(3)
NAME
grub-bios-setup -- Set up images to boot from a device.
SYNOPSIS
grub-bios-setup [-a | --allow-floppy] [-b | --boot-image=FILE]
[-c | --core-image=FILE] [-d | --directory=DIR]
[-f | --force] [-m | --device-map=FILE]
[-s | --skip-fs-probe] [-v | --verbose] DEVICE
DESCRIPTION
You should not normally run this program directly. Use grub-install instead.
OPTIONS
--allow-floppy
Make the device also bootable as a floppy. This option is the default for /dev/fdX devices. Some BIOSes will not boot images cre-
ated with this option.
--boot-image=FILE
Use FILE as the boot image. The default value is boot.img.
--core-image=FILE
Use FILE as ther core image. The default value is core.img.
--directory=DIR
Use GRUB files in the directory DIR. The default value is /boot/grub.
--force
Install even if problems are detected.
--device-map=FILE
Use FILE as the device map. The default value is /boot/grub/device.map .
--skip-fs-probe
Do not probe DEVICE for filesystems.
--verbose
Print verbose messages.
SEE ALSO
info grub
Wed Feb 26 2014 GRUB-BIOS-SETUP(3)