Forrest logo
tool overview
On this page you find all important commands for the CLI tool mkfile. If the command you are looking for is missing please ask our AI.


The mkfile command line tool is used to create a file with a specified size. It is primarily found on Unix-based operating systems.

  1. The mkfile command is used to create a new file with a given size.
  2. It is typically used for testing purposes or when a file of a specific size is needed.
  3. The command takes various options and arguments to define the size and name of the file to be created.
  4. One of the common options used with mkfile is the -n flag, which specifies the size of the file in bytes.
  5. The size can be specified by using numeric values followed by a multiplier like k (kilobytes) or m (megabytes).
  6. For example, mkfile -n 1m testfile creates a file named "testfile" with a size of 1 megabyte.
  7. Another useful option is -f, which forces the creation of the file even if it already exists.
  8. By default, mkfile creates a file containing all null bytes, but you can specify a different content using the -i option followed by a source file.
  9. mkfile also supports creating sparse files, which are files that have unused space represented by zeros.
  10. Overall, the mkfile command line tool is a quick way to create files of a specific size, offering flexibility and control over file creation on Unix-based systems.

List of commands for mkfile:

  • mkfile:tldr:829d9 mkfile: Create a file of a given size and unit (bytes, KB, MB, GB).
    $ mkfile -n ${size}${select} ${filename}
    try on your machine
    explain this command
  • mkfile:tldr:9999e mkfile: Create two files of 4 megabytes each.
    $ mkfile -n ${4m} ${first_filename} ${second_filename}
    try on your machine
    explain this command
  • mkfile:tldr:ea363 mkfile: Create an empty file of 15 kilobytes.
    $ mkfile -n ${15k} ${filename}
    try on your machine
    explain this command
tool overview