Windows fsutil file createnew equivalent in Linux
Creates an empty or preallocated file with a specific size.
fsutil file createnew
truncate -s 100M test.img
truncate -s 100M test.img
truncate -s 100M test.img
Overview
What this command does
On Windows, "fsutil file createnew" is used to create a file of a chosen size. On Linux, the closest practical mapping shown here is "truncate -s 100M test.img". Creates an empty or preallocated file with a specific size. This reference is grouped under File Management → File System.
Windows → Linux context
What changes when you use this on Linux?
Equivalent task, different tool
Windows fsutil file createnew maps to truncate -s 100M test.img 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
Sparse files can appear large while consuming little disk space. Use du -h and ls -lh together to compare allocated and apparent size.
For the broader concept behind this mapping, read Linux filesystem for Windows users.
Practical tasks
Common use cases
Create a file of a chosen size
Creates an empty or preallocated file with a specific size.
truncate -s 100M test.img
Create a sparse 100 MB file
fallocate -l 1G disk.img
Allocate a real 1 GB file
truncate -s 0 logfile.txt
Empty a file without deleting it
Ready to run
Copyable Linux commands
Review paths, device names, package names and permissions before running any command.
truncate -s 100M test.img
fallocate -l 1G disk.img
truncate -s 0 logfile.txt
Walkthrough
Examples with explanations
truncate -s 100M test.img # create a sparse 100 MB file
fallocate -l 1G disk.img # allocate 1 GB of disk space
truncate -s 0 logfile.txt # clear a file while keeping it
Reference
Common options and variations
| Command or option | Use |
|---|---|
truncate -s 100M test.img | Create a sparse 100 MB file |
fallocate -l 1G disk.img | Allocate a real 1 GB file |
truncate -s 0 logfile.txt | Empty a file without deleting it |
Distro differences
Debian/Ubuntu vs Fedora vs Arch
Debian/Ubuntu, Fedora and Arch all use "truncate -s 100M test.img" 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 | truncate -s 100M test.img |
Same command on this distribution. |
| Fedora | same command | truncate -s 100M test.img |
Same command on this distribution. |
| Arch | same command | truncate -s 100M test.img |
Same command on this distribution. |
Important
What to watch out for
Keep learning