wood burning stoves 2.0*
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 Murach's Java Servlets and JSP this week in the Servlets 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: 15952
    
  19

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: 14074
    
  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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: unix command
 
Similar Threads
installing Unix
Unix + Java
Unix
Connecting to Unix via Windows
linux/unix & Windows