How to create a file of arbitrary size

Sometimes you might need to test certain functionality of a file system, e.g. if quotas are reported correctly. For this purpose you might want to upload a file on the server in specified size. You can easily create such a file using the command below:

dd if=/dev/zero of=filename bs=1024 count=1048576
  • if – input file
  • of – output file or the file to be created
  • bs – block size in bytes
  • count – number of blocks of size bs
  • /dev/zero is a special file that provides as many null characters as are read from it

Further reading – http://en.wikipedia.org/wiki//dev/zero

Bookmark and Share

  • No Related Post
bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark bookmark
tabs-top  banner ad


Leave a Reply