Forrest logo
back to the fallocate tool

fallocate:tldr:dffe8

fallocate: Shrink an already allocated file by 200 MiB.
$ fallocate --collapse-range --length ${200M} ${filename}
try on your machine

The command fallocate is used to preallocate space to a file in Linux. It allows you to declare the size of the file in advance without actually writing any data to it.

In the given command:

fallocate – It is the command used to allocate space to a file.

--collapse-range – This option is used to remove a range of holes from a file and collapse the remaining data towards the beginning of the file. It essentially allows you to shrink the file size.

--length ${200M} – This option specifies the length or size of the file to be allocated. In this case, it is set to 200 MB.

${filename} – This is a placeholder for the actual filename you want to use. Replace it with the desired file name.

Overall, the command is allocating space for a file of size 200 MB (${200M}), collapsing any existing hole ranges, and assigning it the specified file name (${filename}).

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the fallocate tool