- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How do I delete ...*.log + clear many logs out ?...
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
Discussions
Discussions
Discussions
Forums
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
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
тАО06-15-2001 12:11 PM
тАО06-15-2001 12:11 PM
And I was trying to clear them out by doing
> *.log and this didnt clear out all the logs.
It make a file called *.log but I am scared to delete this file cuss when I do a simple
cp *.log it copies all the files. So I am thinking when I do an rm *.log it will delete all the log files. So how do I delete just the
*.log. Plus how do I clear out many logs at the same time with one command?
Thanks
Richard
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-15-2001 12:28 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-15-2001 12:30 PM
тАО06-15-2001 12:30 PM
Re: How do I delete ...*.log + clear many logs out ??
To remove just the file named "*.log" do this:
# rm -i \*.log
Note the interactive remove (-i). This gives you the chance to confirm what you're going to do. The backslash (\) in front of the star (*) prevents the shell from treating the asterisk as a wildcard character.
To remove all files ending in ".log" you could do this:
# cd
# find . -name "*.log" -exec rm -i {} \;
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-15-2001 12:31 PM
тАО06-15-2001 12:31 PM
Re: How do I delete ...*.log + clear many logs out ??
To erase multiple files, enter --
ls *.log | xargs -n1 cp /dev/null
This will copy /dev/null to each file that ends with .log
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-15-2001 12:33 PM
тАО06-15-2001 12:33 PM
Re: How do I delete ...*.log + clear many logs out ??
#!/bin/sh
for f in *.log
do
>$f
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-16-2001 06:17 AM
тАО06-16-2001 06:17 AM
Re: How do I delete ...*.log + clear many logs out ??
John's solution is safer because if there are any active log files they will be removed with rm command but u can't recover the space.
for deleting *.log file use:
# rm "\*.log"
Cheers...
Satish.