Windows compact /c equivalent in Linux
Compresses individual files using gzip or xz to reduce their stored size.
compact /c
gzip file.log
gzip file.log
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.
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.
For the broader concept behind this mapping, read Linux filesystem for Windows users.
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 option | Use |
|---|---|
gzip file.log | Compress to file.log.gz |
gzip -k file.log | Keep the original file |
xz -9 file.log | Use 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.
| Distribution | Package manager / base | Equivalent command | Difference 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
Keep learning