compress(1): Add EXAMPLES section

Add 5 examples showing basic usage.

Approved by:	manpages (gbe@)
Differential Revision:		https://reviews.freebsd.org/D26865
This commit is contained in:
fernape 2020-10-20 13:05:25 +00:00
parent 34d4d165af
commit c456dcac39

View File

@ -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 not reduce its size
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 ,