1826332 Members
3470 Online
109692 Solutions
New Discussion

Re: du command problem

 
manal_1
Occasional Contributor

du command problem

i have a hpux 11i server and
my problem is i can not doing du -sk command for the /opt file system on this server but i can do that (du -sk ) on /var for example on the same server . /opt increases and it reached to 89% and i didn't know what is the cause? so i need to do this command . note : if i made du -sk *| morethis message appered to me illegal option --p thank you alot
8 REPLIES 8
sujit kumar singh
Honored Contributor

Re: du command problem

Hi why should that say -p illegal option!!
can you please post the O/Ps of
#du -sk /var
#du -sk /opt
#bdf
regards
sujit
Mark McDonald_2
Trusted Contributor

Re: du command problem

you have a strangely named file in opt.

ls -lb should gibe you an idea.

Mark McDonald_2
Trusted Contributor

Re: du command problem

sorry - I meant give, not gibe.

If you have a file named "-p" then this will be put in place of the asterisk, and the command becomes:

# du -sk -p | more

Avinash20
Honored Contributor

Re: du command problem

I believe there is Typo error while giving the command

As confirmed above you might have entered

$ du -ks -p
du: illegal option -- p
usage: du [-a|-s] [-kbrx] [-t type] [name ...]
$

>> Please execute again and let us know the error which you are getting

# /usr/bin/du /opt
"Light travels faster than sound. That's why some people appear bright until you hear them speak."
Bill Hassell
Honored Contributor

Re: du command problem

> du -sk *| morethis message appered to me illegal option --p

Here is what happened: the "*" was expanded by the shell (as it always does) to place all the names of the files and directories in your current working directory. It is very important to understand how the shell rewrites your command line. Your current directory contains a file with the name "-p" which produced the error. Try this same command (without the | more) like this:

echo du -sk *

You will see what the du command will see -- a list of all the filenames in your current directory. Since du always descends into the subdirectories, you dop not need "*". Just use either of these commands:

du -sk /opt
or
cd /opt
du -sk

However, since you are looking for unexpected space usage, you should use this command:

du -kx /opt | sort -rn | head -20

This will show you the largest directories, which is better than showing a summary of all the directories in alphabetical order.

Unexpected growth in /opt usually means there may be some logfiles stored there -- not a good place. When you find logfiles, either configure the applications that created them to put them in /var/opt, or replace the logfile with a symbolic link to /var/opt/.


Bill Hassell, sysadmin
Dennis Handly
Acclaimed Contributor

Re: du command problem

If you do have a junk file in /opt/ you should remove it.
rm -i ./--p
You could also use: du -kxs -- *
manal_1
Occasional Contributor

Re: du command problem



thank you , my thread has been closed .

I found the directory clled -p ander fs /opt and when removed it i could apply du comand .


with my regards


Manal
Suraj K Sankari
Honored Contributor

Re: du command problem

Hi,
>>thank you , my thread has been closed

If you think your problem got solved then please assign points who give there precious time for your problem.

Suraj