首页 > 系统相关 >linux 操作系统下的compress命令介绍和使用案例

linux 操作系统下的compress命令介绍和使用案例

时间:2024-09-15 10:54:34浏览次数:3  
标签:... txt 操作系统 compress m1 linux meng root

linux 操作系统下的compress命令介绍和使用案例

compress命令是Linux系统中用于文件压缩的一个工具,主要使用Lempel-Ziv-Welch (LZW)算法进行数据压缩。压缩后,文件的扩展名将变为“.Z”。虽然compress命令在历史上有其重要性,但在现代Linux系统中,它已经被更高效的压缩工具如gzip和bzip2所取代

使用方法

基本语法

bash 
compress [选项] [文件名]

安装部署:

root@meng:~# which compress

root@meng:~# compress

Command 'compress' not found, but can be installed with:

apt install ncompress

root@meng:~# apt install ncompress

Reading package lists... Done

Building dependency tree... Done

Reading state information... Done

The following NEW packages will be installed:

ncompress

0 upgraded, 1 newly installed, 0 to remove and 224 not upgraded.

Need to get 22.0 kB of archives.

After this operation, 58.4 kB of additional disk space will be used.

Get:1 http://mirrors.tuna.tsinghua.edu.cn/ubuntu jammy/universe amd64 ncompress amd64 4.2.4.6-5 [22.0 kB]

Fetched 22.0 kB in 1s (23.0 kB/s)

Selecting previously unselected package ncompress.

(Reading database ... 75125 files and directories currently installed.)

Preparing to unpack .../ncompress_4.2.4.6-5_amd64.deb ...

Unpacking ncompress (4.2.4.6-5) ...

Setting up ncompress (4.2.4.6-5) ...

Processing triggers for man-db (2.10.2-1) ...

Scanning processes...

Scanning linux images...

Running kernel seems to be up-to-date.

No services need to be restarted.

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.

root@meng:~# compress --help

Unknown flag: '-'; Usage: compress [-dfhvcVr] [-b maxbits] [--] [file ...]

-d If given, decompression is done instead.

-c Write output on stdout, don't remove original.

-b Parameter limits the max number of bits/code.

-f Forces output file to be generated, even if one already.

exists, and even if no space is saved by compressing.

If -f is not used, the user will be prompted if stdin is.

a tty, otherwise, the output file will not be overwritten.

-h This help output.

-v Write compression statistics.

-V Output version and compile options.

-r Recursive. If a filename is a directory, descend

into it and compress everything in it.

命令案例:

root@meng:~# more m1.txt

hello men

g

hello meng

g

Hello World

This is a test

HelloWorld

Hello World

This is a test

root@meng:~# compress -v m1.txt

m1.txt: -- replaced with m1.txt.Z Compression: 21.10%

root@meng:~# ls

f1.txt.bz2 f2.txt.bz2 m1.txt.Z m2.txt meng.txt meng.txt.bz2 rec00001f1.txt s1.txt s2.txt snap tmp

root@meng:~# uncompress -v m1.txt.Z

m1.txt.Z: 21.1% -- replaced with m1.txt

root@meng:~# ls

f1.txt.bz2 f2.txt.bz2 m1.txt m2.txt meng.txt meng.txt.bz2 rec00001f1.txt s1.txt s2.txt snap tmp

root@meng:~#

标签:...,txt,操作系统,compress,m1,linux,meng,root
From: https://blog.csdn.net/lisanmengmeng/article/details/141950179

相关文章

  • linux 操作系统下cp命令介绍及案例应用
    linux操作系统下cp命令介绍及案例应用cp命令是Linux操作系统中用于复制文件和目录的基本命令。它的功能强大,适用于各种文件管理任务cp命令概述基本语法:bashcp[options]<source><destination>功能:复制单个文件或多个文件到指定位置。递归复制目录及其内容。选项可......
  • Linux内存管理方式
    Linux内存管理涉及到多个方面,包括物理内存的分配和回收、虚拟内存的管理、页面置换、内存保护等。以下是Linux内存管理的主要方式和机制:1.虚拟内存(VirtualMemory)虚拟地址空间:每个进程拥有自己的虚拟地址空间,虚拟地址空间与物理内存是分开的。进程在运行时使用虚拟地......
  • 1Panel:一个现代化、开源的 Linux 服务器运维管理面板
    前言之前有小伙伴问:Linux服务器运维管理除了宝塔,还有其他值得推荐的管理软件吗?,今天大姚给大家分享一个现代化、开源的Linux服务器运维管理面板:1Panel。项目介绍1Panel是新一代的Linux服务器运维管理面板,旨在通过现代化的Web界面帮助用户轻松管理Linux服务器。该项目是开......
  • 1Panel:一个现代化、开源的 Linux 服务器运维管理面板
    前言之前有小伙伴问:Linux服务器运维管理除了宝塔,还有其他值得推荐的管理软件吗?,今天大姚给大家分享一个现代化、开源的Linux服务器运维管理面板:1Panel。项目介绍1Panel是新一代的Linux服务器运维管理面板,旨在通过现代化的Web界面帮助用户轻松管理Linux服务器。该项目......
  • 3.linux进程管理
    目录一.进程管理1.进程概念2.进程生命周期和状态3.进程管理process3.1ps-静态查看进程3.2 top-动态查看进程3.3.使用信号控制进程3.4nice-优先级二.作业控制jobs三.虚拟文件系统proc四.线程(可看可不看)1.状态2.调度算法3.通信方式4.线程和进程的区别5.线......
  • USB总线-Linux内核USB3.0 Hub驱动分析(十四)
    1.概述USBHub提供了连接USB主机和USB设备的电气接口。USBHub拥有一个上行口,至少一个下行口,上行口连接上一级的Hub的下行口或者USB主机,连接主机的为RootHub,下行口连接下一级Hub的上行口或者USB设备。经过Hub的扩展,一个USB主机可以和多个USB设备通信。USBHub有如下特性:良好的......
  • Linux相关命令的使用
    一、压缩和归档的命令1.1压缩和解压缩操作对象是单个文件压缩方式:gzip--->.gzbzip--->.bz2xz--->.xz上是三种压缩方式:压缩率依次递减,压缩速率依次递减。gzipfile//将文件file按gzip格式进行压缩//压缩之后原文件就不存在了,只留下名为file.gz的压缩后......
  • Linux相关命令及shell命令
    一、链接文件1.1软链接(符号链接)ls-l能看到类型为链接文件的都是软连接软连接类似于windows的快捷方式创建软连接的方式:ln-s被链接的文件文件名要生成的文件名注意:1.我们一般创建软连接时最好使用绝对路径否则一旦相对位置发生变化链接就会失效。2.如果被链......
  • (Linux)嵌入式打卡第十一天
    指针数组简介概念:指针数组的本质是一个数组,只不过数组里面的每一个元素都是指针;定义格式:数组类型*数组名[成员个数];eg://定义一个数组,数组里面的每一个元素都是int*类型int*arr[5];指针数组使用#include<stdio.h>intmain(int......
  • Linux下载软件及卸载
    Linux发展史汤姆森·肯---UNIX之父斯托曼发起GNU计划莱纳斯linux之父现在主流的基于Linux的系统的发行版本centos、Ubuntu、Deepin(国产)、RedHat、...查看Ubuntu版本:cat/etc/issue查看内核版本:uname-a嵌入式层次结构一、用户空间命令脚本(命令的集合)app----......