Taming your Temporary Files

I don’t know about you, but there have been many times when I wanted to download something only temporarily with the intent to delete it later, like saving an image to upload elsewhere or saving email attachments that I didn’t need to keep to open in an external program. There have also been times when I wanted to test something out and had to temporarily create files with the intent to delete them later, whether it’s creating a test program, extracting a compressed archive, or even creating a named pipe (FIFO). I used to use my disk for that, using a ~/tmp directory, but it would slowly fill up when I neglected to delete these temporary files, thinking that they “might be useful later”; even to this day, I still have about 12GB of supposedly “temporary” files.

The largest files and folders in my tmp folder. Sorry, but I’m not going to show you my files!

How do you prevent these temporary files from filling up your disk? The obvious answer is to just delete them, and good for you if that works for you, but it evidently doesn’t work for me. You could stop downloading things or generating temporary files, but that’s unreasonable. One solution that I came up with when I used to run on Windows was to create a fixed-size container and put my temporary files there. I now had a maximum size for my temporary files so they wouldn’t overrun my disk. It worked for a while, but I made the mistake of making the container too small (only 256 MB), so in time, I was putting my larger temporary files in a tmp directory outside my container. I was also still not really deleting my temporary files, so in time, the container filled up.

So space-boxing the files is a good thing, but how do you make sure that your temporary files stay temporary and actually get deleted?

Let’s do this in Linux! →

Advertisements

Fixing filesystem check or mount fail

Beginners on Linux will probably encounter a file system check or mount fail at least once throughout their experience. I know I did. Multiple times. But it’s hard to get around hard shut downs when your computer just freezes! Now some people might just press i to ignore every time. Others blindly follow guides, unaware of the effects on their computer.

I for one want to know what the commands I type actually do. So without much further ado, with reference to Simon Richter’s reply on an Ask Ubuntu thread, here’s how you can resolve the issue permanently (complete with explanations of each command):

Step 1: Boot up Computer

Press that power button. 😉

Step 2: Enter Manual Recovery Mode

In the GNU GRUB boot loader, press m to enter manual recovery mode.

Step 3: Remount the System

Remount your system to read-only mode. This will prevent the kernel from writing any permanent changes that could harm your system.

  • mount is the command.
  • -o allows you to specify mount options.
    • ro is the read-only option.
    • remount is the option to remount an already mounted system.
  • / is the mount point for the entire system.
mount -o ro,remount /

Step 4: Repair the System

Run the file system consistency check and interactive repair. You do not need to understand all the underlying semantics of fsck but understand that fsck possesses a set of standards for file systems and ensures all the files on your system follow that standard.

  • fsck is the repair command.
  • -f is the flag to also check clean files.
fsck -f

Step 5: Write the Changes

Write the changes to your system by using a sync.

sync

Step 6: Reboot Computer.

Reboot the system and all changes should be implemented.

reboot

Next time you turn on your computer, everything should be running smoothly!

Good riddance to PulseAudio! (or “Settling on a Linux sound server”)

I have a love-hate relationship with PulseAudio: it has a lot of great features, but sometimes it’s more resource-hungry than I would like, and it also crashes more often than I’d like. Actually, the only reason why I got PulseAudio was because Skype 4.3.0.37 required Pulse and dropped ALSA support; I would have stayed with plain ALSA had it not been for Skype (on that note, I really hate Skype, for more reasons than one).

PulseAudio logo

PulseAudio

Continue reading