Linux® Scratch Paper

Sometimes in algebra when I’d be working out a problem, I’d find myself grabbing a small piece of paper and working out a side problem.   Like ‘gee, what IS 9×19’?  I need that to solve the problem, but my teacher hated it when I made what she called messy marks on my test.  So, I had to use scratch paper.

I even find myself using scratch paper today, like when I’m on my phone and someone says, ‘write down this number!’.  Normally I’d save that in my phone, but my phone doesn’t actually let me both listen to the number and save it in the phone.

Linux® needs scratch paper sometimes too!  Sometimes a process needs to write to a file to say, ‘I did this’ or ‘I did that’.  It doesn’t really do that.  It writes state to a file so that if it has to stop it can pick up where it left off.   state means that ‘Hey, this is what I was going now, let me know if I need it later.’

This can get complicated.  Every process would need its own directory to write its own files, so imagine keeping track of all of them.

Linux® likes to keep things simple and straightforward.  Unix is the same way, and Linux® picked up this trick from them.  Instead of each process having its own directory, we have one central directory that everyone has write permission to.  It’s called the /tmp/ directory.  tmp stands for temporary, so it’s meant for files that aren’t supposed to stick around.  In fact, every time you reboot your computer, the /tmp/ directory is emptied.

/tmp/ can have lots of files in it or it can be empty.  In fact, when I look at /tmp/ on Alpha, I see:

Alpha:~ computerlamp$ ls /tmp/
Alpha:~ computerlamp$

That means in my case, the directory is empty.  What does it look like on your system?

Leave a Reply

Your email address will not be published. Required fields are marked *