File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "unix command" Watch "unix command" New topic

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.

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

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

An IDE is no substitute for an Intelligent Developer.
krishna kanaga

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: 15082

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 8 API documentation
I agree. Here's the link:
subject: unix command
It's not a secret anymore!