256 Kilobytes

How a File Can be Zero Bytes

Articles in Operating Systems | By August R. Garcia

Published 11 months agoWed, 17 Apr 2019 17:16:07 -0700 | Last update 11 months agoWed, 17 Apr 2019 20:24:46 -0700

When an empty file is created, how is it possible that its size can be listed as zero bytes?

390 views, 0 RAMs, and 0 comments

When an empty file is created, how is it possible that its size can be listed as zero bytes? Even an empty file named “a.txt” needs some amount of data to store:

  • The letters in its file name;
  • It’s creation time; and
  • Various other pieces of metadata.

Despite this, it is possible for a zero-sized files to exist. Creating two text files, one with text and one without, and then running ls -lha yields the following reply on Ubuntu:

  • -rw-rw-r-- 1 256-kilobytes 256-kilobytes    0 Apr 15 12:18 empty-file.md
  • -rw-rw-r-- 1 256-kilobytes 256-kilobytes 1.5K Apr 17 17:02 file-with-text.md

Which verifies that the empty file is, in fact, considered to be a zero byte file. This indicates that the previously mentioned metadata is not in fact stored in these files. Rather, the metadata is stored as an entry in the operating system’s file system.

Can you fill your hard drive entirely with empty files?

Sure. Run this command from the terminal, but make it an infinite loop:

for i in `seq 1 10`; do nice_dogs=`shuf -n 5 /usr/share/dict/words | tr '\n' '-'` && touch $nice_dogs$RANDOM; done
Download more RAM. 🐏 ⨉ 0 Posted by August R. Garcia 11 months ago

Edit History

• [2019-04-17 17:16 PDT] August R. Garcia (11 months ago)
• [2019-04-17 17:16 PDT] August R. Garcia (11 months ago)
🕓 Posted at 17 April, 2019 17:16 PM PDT

Read more:
Files
Profile Photo - August R. Garcia August R. Garcia LARPing as a Sysadmi... Portland, OR
🗎 213 🗨 1116 🐏 337
Site Owner

Grahew Mattham

August Garcia is some guy who used to sell Viagra on the Internet. He made this website to LARP as a sysadmin while posting about garbage like user-agent spoofing, spintax, the only good keyboard, virtual assitants from Pakistan, links with the rel="nofollow" attributeproxiessin, the developer console, literally every link building method, and other junk.

Available at arg@256kilobytes.com, via Twitter, or arg.256kilobytes.com. Open to business inquiries based on availability.


Account created 1 year ago.
213 posts, 1116 comments, and 337 RAMs.

Last active 2 days ago:
Commented in thread 5 best Tunescool videos of all time!

Post a New Comment

To leave a comment, login to your account or create an account.

Do you like having a good time?

Read Quality Articles

Read some quality articles. If you can manage to not get banned for like five minutes, you can even post your own articles.

View Articles →

Argue with People on the Internet

Use your account to explain why people are wrong on the Internet forum.

View Forum →

Vandalize the Wiki

Or don't. I'm not your dad.

View Wiki →

Ask and/or Answer Questions

If someone asks a terrible question, post a LMGTFY link.

View Answers →

Make Some Money

Hire freelancers and/or advertise your goods and/or services. Hire people directly. We're not a middleman or your dad. Manage your own business transactions.

Register an Account
You can also login to an existing account or recover your password. All use of this site is subject to terms outlined in the terms of service and privacy policy.