← All commands
Topic hub File Management
Windows Linux File Management Expanded guide Archives & Compression

Windows compact /c equivalent in Linux

Compresses individual files using gzip or xz to reduce their stored size.

Windows compact /c
→
Linux equivalents
Debian/Ubuntu same command
gzip file.log
Fedora same command
gzip file.log
Arch same command
gzip file.log

Overview

What this command does

On Windows, "compact /c" is used to compress individual files. On Linux, the closest practical mapping shown here is "gzip file.log". Compresses individual files using gzip or xz to reduce their stored size. This reference is grouped under File Management → Archives & Compression.

Migration tip: Windows <code>compact</code> uses transparent NTFS compression. <code>gzip</code> and <code>xz</code> instead create compressed files such as <code>file.log.gz</code> or <code>file.log.xz</code>.

Windows → Linux context

What changes when you use this on Linux?

Equivalent task, different tool

Windows compact /c maps to gzip file.log for this task. Treat this as a workflow mapping rather than a character-for-character syntax translation.

Portable across the compared distros

The Debian/Ubuntu, Fedora and Arch rows use the same command in this mapping. Package availability or defaults can still vary, so check the installed tool version when an option behaves differently.

Command-specific caution

gzip and xz normally replace the source file. Use -k when you need to keep the original.

Practical tasks

Common use cases

Compress individual files

Compresses individual files using gzip or xz to reduce their stored size.

gzip file.log

Compress to file.log.gz

gzip -k file.log

Keep the original file

xz -9 file.log

Use stronger xz compression

Ready to run

Copyable Linux commands

Review paths, device names, package names and permissions before running any command.

gzip file.log
gzip -k file.log
xz -9 file.log

Walkthrough

Examples with explanations

gzip file.log # compress a file with gzip
gzip -k file.log # compress while keeping the original
xz -9 file.log # compress with maximum xz compression

Reference

Common options and variations

Command or optionUse
gzip file.logCompress to file.log.gz
gzip -k file.logKeep the original file
xz -9 file.logUse stronger xz compression

Distro differences

Debian/Ubuntu vs Fedora vs Arch

Debian/Ubuntu, Fedora and Arch all use "gzip file.log" for this mapping. The command syntax shown here is portable across the three rows, although installed versions and system defaults can still vary.

DistributionPackage manager / baseEquivalent commandDifference to notice
Debian/Ubuntu same command gzip file.log Same command on this distribution.
Fedora same command gzip file.log Same command on this distribution.
Arch same command gzip file.log Same command on this distribution.

Important

What to watch out for

gzip and xz normally replace the source file. Use -k when you need to keep the original.

Keep learning

Related File Management commands