- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Looking for commands
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2006 11:51 AM
02-11-2006 11:51 AM
1). How would u trim log files.
2). How do u find files which are most new?
3). How do u find files which are using the most space?
thanks alot.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2006 12:11 PM
02-11-2006 12:11 PM
Solution1. The best way to empty a log file is simply:
# cat /dev/null > logfile
2. To find files that are newer (more recently modified than some time):
# find /yourpath -xdev -type f -mtime +30
...this finds files in /yourpath that havn't been modified in the last 30-days
# touch -amt 02110000 /tmp/myref
# find /yourpath -xdev -type f -newer /tmp/myref
...this form finds files that are newer than the reference file /tmp/myref
3. To find files greater than a particular size:
# find /yourpatch -xdev -type f -size +100000c
...returns files whose size exceeds 100,000 characters.
# du -xak /yourpath | sort -k1nr
...return all files and directories in /yourpath and list them in descending block (1K size) order.
The manpages for 'find' and for 'du' should be read with these examples in mind.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2006 07:06 PM
02-11-2006 07:06 PM
Re: Looking for commands
Q1). How would u trim log files.
Ans : # >/var/adm/syslog/syslog.log will trim syslog.log file
Q2). How do u find files which are most new?
Ans : # find . -type f -ctime -1 -exec ll {} \;
Q3). How do u find files which are using the most space?
# ls -lR | sort +4 -5nr | more
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2006 07:36 PM
02-11-2006 07:36 PM
Re: Looking for commands
I have several ways I handle this.
On some servers, I manually trim using sam.
On most servers, I weekly back up the log files and do this command on the ones I wish cut down:
> logfilename
This second method is totally done via cron.
/var/adm/btmp and /var/adm/wtmp take up a lot of space, as do mail.log and syslog.log. The first two are critical for security. If you don't keep them, you will have problems on a Security audit.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2006 07:53 PM
02-11-2006 07:53 PM
Re: Looking for commands
more comfortable tools are "logrotate" and "logadm".
Don't know if they are available as binaries for HPUX, you might need to get Linux source and compile on your own.
Esp. logadm has a ton of options to do nice things in logfile administration. I.e. restart the process which is writing the file.
Zeroing out a logfile as described above is easy and comfortable, but if you have a monitoring process on that logfile (i.e "tail -f") you may loose messages, because you will have to restart this monitoring process in addition. "logadm" is a very comfortable way to do this.
Volker
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2006 05:35 AM
02-12-2006 05:35 AM
Re: Looking for commands
Try this..
1 #cat /dev/null /
2 #find / -type f -mtime +24 -print
3 #find / -type f -size +100000c
3 #du -sk /
Cheers
indrajit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-12-2006 05:39 PM
02-12-2006 05:39 PM
Re: Looking for commands
Simply as,
> Logfile
will do it. Else use sam to trim logs.
2). How do u find files which are most new?
# find / -xdev -type f -mtime -1
which will give today's update file. Change with +
3). How do u find files which are using the most space?
# du -ks
will give it.
--
Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2006 01:05 AM
02-13-2006 01:05 AM
Re: Looking for commands
Routine Tasks-> System Log Files-> select files to trim.
The one thing that you need to keep in mind is that if the file is on use that you are trying to trim a backup is created with an extension SAMTRM of at the end of the file name. You'll need to delete this file if you are looking to gain space.
I don;t know how familar you are with the different "trim" commands mentioned above, but most will create a new file with no records. Make sure that is what you want.
Richard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2006 01:37 AM
02-13-2006 01:37 AM
Re: Looking for commands
http://hpux.ee.ualberta.ca/hppd/hpux/Sysadmin/logrotate-2.5/
Others have answered your questions - so I won't repeat them.
Rgds...Geoff