Sponsored Content
Full Discussion: 'h' flag in du
Top Forums UNIX for Dummies Questions & Answers 'h' flag in du Post 302675233 by sudon't on Sunday 22nd of July 2012 12:15:32 PM
Old 07-22-2012
'h' flag in du

Hey, all!
Why is the "human readable" flag changing the behavior of du? And while I'm at it, can you make du only look at files, not directories. I often find myself wanting to find the largest file(s) in a dir or vol. Using 'find' itself, it seems you have to at least be able to guess the size of the files you're looking for, so you can specify what sized files 'find' should ignore. Or, is there an app for that? : )

Code:
-bash $ du -a /Volumes/GARMIN | sort -n -r | head -n 10
7483232	/Volumes/GARMIN
5791224	/Volumes/GARMIN/.System
3154048	/Volumes/GARMIN/.System/gmapprom.img
914128	/Volumes/GARMIN/.System/JCV
914112	/Volumes/GARMIN/.System/JCV/D3191020A.JCV
847256	/Volumes/GARMIN/Voice
779856	/Volumes/GARMIN/.System/SID
779848	/Volumes/GARMIN/.System/SID/D2656040A.sid
481400	/Volumes/GARMIN/.Trashes
481392	/Volumes/GARMIN/.Trashes/501

-bash $ du -a -h /Volumes/GARMIN | sort -n -r | head -n 10
1004K	/Volumes/GARMIN/Voice/Catala__.vpm
1000K	/Volumes/GARMIN/Voice/Russkiy__.vpm
1000K	/Volumes/GARMIN/Voice/Cesky__.vpm
992K	/Volumes/GARMIN/Voice/Slovenscina__.vpm
980K	/Volumes/GARMIN/Voice/Ellinika__.vpm
976K	/Volumes/GARMIN/Voice/Magyar__.vpm
976K	/Volumes/GARMIN/Voice/Arabic__.vpm
968K	/Volumes/GARMIN/Voice/Deutsch__.vpm
964K	/Volumes/GARMIN/Voice/Srpski__.vpm
924K	/Volumes/GARMIN/.Spotlight-V100/Store-V1/Stores/5938D254-6028-451A-9B7E-03556D7B82A0/0.indexPostings

---------- Post updated at 11:15 AM ---------- Previous update was at 10:55 AM ----------

Oh wait, I think I get it - 'sort' sees 1004k as larger than 3GB because it's a bigger number, right? *sigh*

Last edited by sudon't; 07-22-2012 at 01:23 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

the flag -c in sh command

I need your help please. In a production system, i've seen many running process as follow: sh -c ./pathname/shellname what exactly the flag option -c is used for? ive tried to look at the man page, but it doesnt say much. ill appreciate yor help. Thanks (4 Replies)
Discussion started by: alexcol
4 Replies

2. Shell Programming and Scripting

find and size flag

Hello everyone, I would like to filter and search for files in my curr dir where the blocks used by those files are over a certain number (i.e. 30), when I try this command find . -name "c*" -size +30 -exec ls -ls {} \; I get a list of files, the first column is the block size, right? ... (1 Reply)
Discussion started by: gio001
1 Replies

3. AIX

Checking for flag in a subscript?

I want to incorportae a subscript in a job script which is used for loading purposes. What i require is that before a job runs it should check for a flag ,if flag is not present then create it and the loading should start. Once loading finishes it should delete the flag. So if any other load... (1 Reply)
Discussion started by: bathla
1 Replies

4. Shell Programming and Scripting

checking for a flag in a subscript?

I want to incorportae a subscript in a job script which is used for loading purposes. What i require is that before a job runs it should check for a flag ,if flag is not present then create it and the loading should start. Once loading finishes it should delete the flag. So if any other load... (2 Replies)
Discussion started by: bathla
2 Replies

5. Red Hat

-ansi flag support for g++

I have been compiling a cpp program using following command: g++ -c -ansi a.cpp with g++ version 4.1.2. I want to know the significance of the -ansi flag and which other higher g++ version supports this flag by default Dhiraj (1 Reply)
Discussion started by: dhiraj kurhade
1 Replies

6. Shell Programming and Scripting

Date Time of FLAG

Hi, I am first sorry to ask for that, but I am in trouble so I hope you will be agreed to help me on this. I am solaris (ksh). I have a lots of file but I only need to get the date and time of the flag files. Here is the "ls -lrt" view : ls -lrt | grep Flag_Saturne_R*Return ... (3 Replies)
Discussion started by: Aswex
3 Replies

7. AIX

du flag -x

Hi, I would like to know if there's any option to use with the du command so that I can list only the files/directories on the current filesystem... I usually use du -gs *But I'd like to see only the directories in the filesystem I am on, and not the mount point directory of other fss... ... (6 Replies)
Discussion started by: Casey
6 Replies

8. Shell Programming and Scripting

Add the flag

#!/bin/bash while : do ./abc.sh PB sleep 60 ./abc.sh RA sleep 60 ./abc.sh GS sleep 68400 done Instead of making the script sleep for sometime, it doesn't work all the time as time may shift over a period. How to make a script wake up every 30 seconds and check the current time, if... (2 Replies)
Discussion started by: sandy1028
2 Replies

9. AIX

Flag issue

Hi all, We dont have access to aix source code and i have a doubt. The flag SC_NO_RESERVE, is it got to do anything with the failover? If the flag is set the paths are going to failed state. If flag is not set everything comes up fine after failover. Thanks in advance for helping ... (2 Replies)
Discussion started by: gnakul
2 Replies

10. UNIX for Dummies Questions & Answers

Get the id with specify flag

.... means multi line ddd,bug fgdrg dfdfsdfdfsd fsdfdfdfd fdfdsfdsfsd ....... flag2 ...... aaa,bug sfsfsfsfs dfdfsdfdfsd fsdfdfdfd fdfdsfdsfsd ...... flag1 ...... ddd,bug fgdrg dfdfsdfdfsd (9 Replies)
Discussion started by: yanglei_fage
9 Replies
MOUNT_AFP(8)						    BSD System Manager's Manual 					      MOUNT_AFP(8)

NAME
mount_afp -- mount an afp (AppleShare) filesystem SYNOPSIS
mount_afp [-i] [-s] [-k] [-o options] afp_url node DESCRIPTION
The mount_afp command mounts the AFP volume denoted by the afp_url afp://[user[;AUTH=uamname][:password]@]host[:port]/volumename at the mount point indicated by node. This command is normally executed by mount(8) when the -t afp option is used. If the -i option is not used, all the required information to establish a login to the remote server must be available in the afp URL, including username & password if needed. The arguments and options are: -i Interactive mode, you are prompted for the password if you did not supply one in the url. -s Soft mount (default). Network errors, e.g. timeouts, will be retried for a much shorter amount of time. If the network errors per- sist, then the mount will be force unmounted. -k Hard mount. Network errors, e.g. timeouts, will be retried for an extended amount of time. If the network errors persist, then the mount will be force unmounted. -o Options passed to mount(2) are specified with the -o option followed by a comma separated string of options. See the mount(8) man page for possible options and their meanings. Additional options supported by the AFP Client are as follows: nobrowse Indicate to the Carbon subsystem that this volume is not to be displayed to the user. automounted Set flags on the mountpoint to indicate that the volume has been mounted by the automounter. afp_url There are two forms of afp URL, one for TCP/IP and one for AppleTalk: afp://[user[;AUTH=uamname][:password]@]host[:port]/volume afp:/at/[user[;AUTH=uamname][:password]@]servername[:zonename]/volume Denotes the afp server and sharepoint to mount. It may also contain the username & password required to log into the server. uamname is the protocol name of the authentication method. If port is not specified, then port 548 is used. node Path to mount point, which must be a directory that the user has write permissions for. EXAMPLES
The following example illustrates how to mount the afp volume server.company.com/volumename/ at the mount point /Volumes/mntpnt: mkdir /Volumes/mntpnt mount_afp afp://username:userpass@server.company.com/volumename/ /Volumes/mntpnt This example shows the proper url to use to mount the volume guestVolume from the afp server myserver as guest (if no uam and no username, then use guest uam): mkdir /Volumes/guest mount_afp "afp://myserver/guestVolume" /Volumes/guest This example shows the proper url to use to mount the volume myVolume from the afp server myserver using Kerberos authentication: mkdir /Volumes/myVolume mount_afp "afp://;AUTH=Client%20Krb%20v2@myserver/myVolume" /Volumes/myVolume SEE ALSO
mount(2), unmount(2), mount(8) HISTORY
The mount_afp command first appeared Mac OS X version 10.0. Kerberos authentication was added in Mac OS X version 10.2 RETURN VALUES
0 mount_afp successfully mounted the volume directory. [ENODEV (19)] The server volume could not be mounted by mount_afp because the server was not found or because the sharepoint does not exist, or because node does not have proper access. [EACCES (13)] The volume could not be mounted by mount_afp because the user did not provide proper authentication credentials. [ENOTDIR (20)] The volume could not be mounted by mount_afp because the mountpoint was not a directory. Mac OS X May 8, 2002 Mac OS X
All times are GMT -4. The time now is 06:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy