File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Linux / UNIX and the fly likes unix command Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "unix command" Watch "unix command" New topic
Author

unix command

Jackie Wang
Ranch Hand

Joined: Apr 18, 2002
Posts: 315
can anyone suggest what Unix commands i can use to maintain
a log file directory and prevent it from running out of disk space.

Are there any advantages and disadvantages of that?
Guy Allard
Ranch Hand

Joined: Nov 24, 2000
Posts: 776
You should read your man page for 'find', since usage varies across *nix flavors. In particular look at parameters ctime, mtime, and atime.

But something like:



To remove files older than 30 time units (days, maybe hours, see the man page).

Once you understand what the proper command is, you will probably want to schedule it via cron.

Guy
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

For Linux and some other systems, perhaps even better would be the "logrotate" system. It does that plus other useful things related to logfiles.


Customer surveys are for companies who didn't pay proper attention to begin with.
krishna kanaga
Greenhorn

Joined: Nov 26, 2009
Posts: 3
cat opens readme.txt
grep gets the word "unix" in there
wc -l lists how many lines have the word "unix"

Basically, it tells you how many times "unix" was written. But, if unix is written twice on a line, it will count it once because of the -l parameter on wc.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14114
    
  16

Krishna, welcome to JavaRanch.

Please note that you are replying to a topic from 2006, three years ago. The original poster is probably not still waiting for an answer. Please don't wake the zombies.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: unix command