10、Unix系统管理脚本实用指南
2026/6/1 15:02:47 网站建设 项目流程

Unix系统管理脚本实用指南

1. 最大化文件压缩

1.1 背景

在Unix系统中,有多种文件压缩方法,如compressgzipbzip2。但用户通常只熟悉一种压缩程序,而未意识到使用其他程序可能获得更好的压缩效果。不同的文件可能适合不同的压缩算法,需要通过实验来确定。

1.2bestcompress脚本

bestcompress脚本可以使用所有可用的压缩工具对文件进行压缩,然后选择压缩后最小的文件作为最佳结果。

#!/bin/sh # bestcompress - Given a file, tries compressing it with all the available # compression tools and keeps the compressed file that's smallest, reporting # the result to the user. If '-a' isn't specified, bestcompress skips # compressed files in the input stream. Z="compress" gz="gzip" bz="bzip2" Zout="/tmp/bestcompress.$$.Z" gzout="/tmp/bestcompress.$$.gz" bzout="/tmp/bestcompre

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询