Blog / Linux

How to delete files older than x hours in Ubuntu

November 5, 2016

One of my apps, YouTube Audio Downloader, has been gaining quite a bit of traffic lately. It's a website that lets you convert YouTube videos to MP3/M4A audio. The conversion happens completely on my server and a download link is provided to the user when finished. The files need to be stored temporarily on my server so the users can download them.

Initially, I just had a daily cron job that runs at ...

Setting up an FTP server on Ubuntu using vsftpd and connecting to it using Python's ftplib module

October 13, 2016

I know what you're thinking, "Who in the world still uses FTP these days?". If you were born after year 2000, you may not even have heard of FTP before.

FTP (File Transfer Protocol) was a popular way to share files back in the AOL days. People will set up these FTP servers where you can upload and download files. I remember spending so much time in chat rooms during my teenage years asking ...

Using Docker and Docker Compose for local Django development (replacing virtualenv)

April 30, 2015

Before Docker came along, virtualenv was pretty much the tool of choice for Python developers as it allows you to separate package dependencies for different applications you're working on without having to create separate virtual machines for each one. It worked very well for me.

However, there are still some annoying things the developers will have to deal with. Such things include having to install additional applications and services required by the project such ...

Ubuntu: How to delete old kernels to free up space in the boot partition

January 15, 2015

This is at least the second time this has happened to me so I figured I'd make a note here for future reference.

Basically I was running the Software Update and it complained that there is "Not enough free disk space":

The upgrade needs a total of 81.7 M free space on disk '/boot'. Please free at least an additional 15.5 M of disk space on '/boot'. Empty your trash and remove ...

Ubuntu users: How to upgrade the BIOS of your Dell XPS 13 Ultrabook

November 22, 2014

For a machine being sold with Ubuntu pre-installed, I find it surprising that Dell doesn't have a utility to make BIOS updates easy on Ubuntu.

Dell's BIOS update utility only runs on Windows or DOS.  So for us Ubuntu users, we'll need a way to run DOS on our machines and execute their update utility there.  Luckily, there's FreeDOS.

If you're having stability or performance issues, updating the BIOS is ...

Docker Cleanup Commands

October 4, 2014

I've been working quite a bit with Docker these last few weeks and one thing that I found really annoying was all these unused containers and images taking up precious disk space.

I wish Docker has a 'docker clean' command that would delete stopped containers and untagged images. Perhaps sometime in the near future as the project is very active. But for the time being, these commands should do the job.

Kill all running ...

How to delete Python .pyc and .pyo files on Ubuntu 14.04

September 2, 2014

I just realized today that Ubuntu has a command called pyclean already installed by default that will recursively delete all .pyc and .pyo files.

For example, to recursively delete .pyc and .pyo files from the current working directory, you can do:

pyclean .

If you’re not on Ubuntu, you can run this command instead:

find . -name “*.pyc” -delete