Fix gzip/gunzip has other link unchanged
I was asked by on co-worker that he can not gzunzip a file ,he got error messages like:
gunzip filename.gz has 1 other link -- unchanged
Workaround
gunzip -f file.gz
Use option “-f” to force decompression.
Wait ,but why
Below snippet from gzip man page tells the reason
-- has xx other links: unchanged
The input file has links; it is left unchanged. See ln(1) for more information. Use the -f flag to force
compression of multiply-linked files
How to reproduce the error
Below commands reproduce this error , for gunzip should be the same
j@ubuntu:~/tmp$ touch file1
j@ubuntu:~/tmp$ ln file1 file2
j@ubuntu:~/tmp$ gzip file1
gzip: file1 has 1 other link -- unchanged
j@ubuntu:~/tmp$ gzip -f file1
j@ubuntu:~/tmp$ ls
file1.gz file2
j@ubuntu:~/tmp$