Instructions for using zforce command on Linux
The gzip command is a popular tool used to compress / decompress files in Linux.TipsMake.com presents the basics of this tool in the article: Some basic Terminal commands in Linux Mint 11. This utility creates .gz files. But sometimes (such as during file transfers) this .gz file extension may be removed. But not too worried! There is a tool that forces the .gz extension back to these compressed files.
The tool mentioned is zforce and in this tutorial, we will discuss how to use this command line utility. But before starting, please note that all the examples here are tested on Ubuntu 18.04 LTS.
Linux zforce command
As mentioned at the beginning, the zforce command allows the user to force the extension '.gz' back on all gzip files. The following is its syntax:
zforce [ name . ]
And here's how this tool's homepage explains it: "Zforce forces the .gz extension back on all gzip files so that gzip doesn't compress them twice."
This can be useful for files whose names are truncated when transferring files. On systems, the file name is limited to 14 characters, so the original name is truncated to make room for the .gz suffix .
For example, 12345678901234 was renamed 12345678901.gz. But a short file name, such as foo.tgz will be preserved.
For example, we have a .gz file named 'files'. As can be seen, the .gz extension is missing in the file name. So what to do is simply use the following command:
zforce files
And this is the ouput that this command creates:
files -- replaced with files.gz
As you can see, the command indicates that 'files' have been replaced with 'files.gz'. And when you check the .gz file in the current directory, you will see a file named files.gz.
Now, if there is a folder filled with .gz files whose names have been truncated, there is no need to enter each file name. Do the same as the example below:
You can see that all 3 files in the example have the .gz extension. Rest assured that if any file already contains the .gz extension in the name, then this operation will remain the same.
If you use a lot of gzip and encounter the .gz extension being truncated from the file name, you now know how to handle it.
Good luck!
See more:
- 14 interesting Linux commands in Terminal
- Basic Linux commands everyone needs to know
- 7 commands to manipulate the most basic files and folders everyone must know
You should read it
- How to use the which command in Linux
- 14 interesting Linux commands in Terminal
- Basic Linux commands everyone needs to know
- How to use the stat command on Linux
- 20+ essential Linux security commands
- 11 df commands in Linux (with example)
- How to use the last command in Linux
- How to use ss command on Linux
- The Cat command in Linux
- 11 uses of ps command in Linux
- How to limit access to su command in Linux
- Instructions for using pstree command on Linux
Maybe you are interested
How to clean junk files when drive C on the computer is full
Gemini can now recognize PDF files appearing on smartphone screens
9 ways to fix the error of not being able to save files as JPEG or PNG in Photoshop
How to use the file search command on Windows, find saved files
How to split sheet into multiple separate Excel files
How to merge PDF files, merge and join multiple PDF files into a single file