From owner-svn-src-head@freebsd.org Tue Oct 20 13:05:25 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B6875430DED; Tue, 20 Oct 2020 13:05:25 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CFv4P4PT5z4JKN; Tue, 20 Oct 2020 13:05:25 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A3A3157AA; Tue, 20 Oct 2020 13:05:25 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 09KD5PgP090306; Tue, 20 Oct 2020 13:05:25 GMT (envelope-from fernape@FreeBSD.org) Received: (from fernape@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 09KD5PH6090305; Tue, 20 Oct 2020 13:05:25 GMT (envelope-from fernape@FreeBSD.org) Message-Id: <202010201305.09KD5PH6090305@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fernape set sender to fernape@FreeBSD.org using -f From: =?UTF-8?Q?Fernando_Apestegu=c3=ada?= Date: Tue, 20 Oct 2020 13:05:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366895 - head/usr.bin/compress X-SVN-Group: head X-SVN-Commit-Author: fernape X-SVN-Commit-Paths: head/usr.bin/compress X-SVN-Commit-Revision: 366895 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Oct 2020 13:05:25 -0000 Author: fernape (ports committer) Date: Tue Oct 20 13:05:25 2020 New Revision: 366895 URL: https://svnweb.freebsd.org/changeset/base/366895 Log: compress(1): Add EXAMPLES section Add 5 examples showing basic usage. Approved by: manpages (gbe@) Differential Revision: https://reviews.freebsd.org/D26865 Modified: head/usr.bin/compress/compress.1 Modified: head/usr.bin/compress/compress.1 ============================================================================== --- head/usr.bin/compress/compress.1 Tue Oct 20 11:49:19 2020 (r366894) +++ head/usr.bin/compress/compress.1 Tue Oct 20 13:05:25 2020 (r366895) @@ -32,7 +32,7 @@ .\" @(#)compress.1 8.2 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd May 17, 2002 +.Dd October 20, 2020 .Dt COMPRESS 1 .Os .Sh NAME @@ -186,6 +186,40 @@ utility exits 2 if attempting to compress a file would and the .Fl f option was not specified and if no other error occurs. +.Sh EXAMPLES +Create a file +.Pa test_file +with a single line of text: +.Bd -literal -offset indent +echo "This is a test" > test_file +.Ed +.Pp +Try to reduce the size of the file using a 10-bit code and show the exit status: +.Bd -literal -offset indent +$ compress -b 10 test_file +$ echo $? +2 +.Ed +.Pp +Try to compress the file and show compression percentage: +.Bd -literal -offset indent +$ compress -v test_file +test_file: file would grow; left unmodified +.Ed +.Pp +Same as above but forcing compression: +.Bd -literal -offset indent +$ compress -f -v test_file +test_file.Z: 79% expansion +.Ed +.Pp +Compress and uncompress the string +.Ql hello +on the fly: +.Bd -literal -offset indent +$ echo "hello" | compress | uncompress +hello +.Ed .Sh SEE ALSO .Xr gunzip 1 , .Xr gzexe 1 ,