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:

Instructions for using zforce command on Linux Picture 1

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:

  1. 14 interesting Linux commands in Terminal
  2. Basic Linux commands everyone needs to know
  3. 7 commands to manipulate the most basic files and folders everyone must know
4 ★ | 1 Vote

May be interested

  • How to install Composr CMS on Ubuntu 18.04 LTSPhoto of How to install Composr CMS on Ubuntu 18.04 LTS
    composr is a free and open source cms with advanced interactive functions. it is written in php language and uses mariadb to store data.
  • How to install Spotify on LinuxPhoto of How to install Spotify on Linux
    spotify has actually supported linux for a long time. although most distributions do not include this application in the repository for license reasons, it is not really difficult to install this official player on a linux pc.
  • How to fix sources.list file on Kali LinuxPhoto of How to fix sources.list file on Kali Linux
    the sources.list file issue often appears after updating kali linux. today's article will show you how to edit sources.list file on kali linux.
  • How to install Kali Linux on your computerPhoto of How to install Kali Linux on your computer
    installing kali linux on your computer is an easy process. first, you will need compatible hardware for computers. kali is supported on i386, amd64 and arm platforms (both armel and armhf).
  • Learn about Micro applications in LinuxPhoto of Learn about Micro applications in Linux
    for linux users, vi - text editing application is one of the indispensable support tools. unlike nano - a text editing application in terminal format, vi has a variety of useful and functional shortcut keys, with 2 main modes of operation: insert and command.
  • How to run Windows applications on Linux with WinePhoto of How to run Windows applications on Linux with Wine
    there are a number of applications from windows that are needed but there are no alternatives on linux. fortunately, there is a software project that allows you to run windows applications on linux. this software is called wine. it creates a compatibility layer for windows programs to interact with the linux operating system.