Setting Up Static IP on Ubuntu Server 20.04 LTS

Ubuntu Server 20.04 LTS uses the tricky Netplan for network configuration by default. Network configuration is a bit more tricky, but still good. The default Netplan network configuration file on Ubuntu 20.04 LTS server is /etc/netplan/00-installer-config.yaml. First, find the network interface name which you want to configure a static IP address with the following command: As …

How to optimize images for the web using GIMP

Optimizing images for the Web means reducing its file size which in turn will make it load faster on websites. Grab some specialty coffee and follow these simple instructions. Reducing the image size with GIMP To reduce the image size: Open image in GIMP. Click on Image in the toolbar, then select Scale Image. In the image size, …

Linux command line history tips

Many times I found myself typing history into the terminal and then copy/paste the command I was looking for. But, then I found the below tricks to help repeat that command faster and more efficiently. Use Control+R I found this to be the most beneficial for me. It will do a reverse search really fast! …

MySQL how to insert a row into a table

Inserting data into MySQL tables is easy, but I tend to forget little details once in a while. I was having the best espresso coffee and trying to remember this one. Below is how you insert a new row into a MySQL table. Assume you created the following table: And then you want to insert …

How to restart a service running in docker compose

I’m playing with docker-compose for a test Flask app. My docker-compose.yml looks like this: I noticed any change I made in my files within my templates folder did not take effect when I reloaded the browser locally at localhost:5000 So, I found that I can just restart the ‘www’ service defined on my docker-compose.yml file …

Connect to a remote MySQL database using Linux terminal

This is simple. After you setup a user with proper access rights run the below commands. # mysql -u yourUser -p -h <yourHostname or IP> A little explanation: -u tells mysql what your username -p tells mysql you have a password and will prompt you to enter it after you press enter -h tells mysql …

Restart sound service in Ubuntu

The other day my sound stopped working on Ubuntu 18.04 desktop. I have no clue why. The sound stopped working overnight for some reason. After some research I found the below command to restart the sound service on Ubuntu: pulseaudio -k && sudo alsa force-reload All works now! Give it a try and let me …

Minicom error “Device /dev/ttyS0 is locked”

Sometimes if the connection to a device via Minicom is lost, the next time you start Minicom you could see an error: Device /dev/ttyS0 is locked. The name /dev/ttyS0 may be different, depending on your COM port. To avoid this issue you should always shut down Minicom using CTRL+A keys and then the Q key. …

How to run Ansible when Python not installed on Ubuntu EC2

I started an Ubuntu EC2 the other day hoping to run Ansible on it and was surprised that Python was not installed. A requirement for Ansible to run on target machines is to have a modern version of Python. You can just run sudo apt install python but this is not ideal if you need …

Breaking Up Long Lines in Your Dockerfile

I try to limit my line characters to 79-80 per line. For example check this 122 character multi-command line: RUN wget -O afile.tar.gz http://example.com/afile.tar.gz && tar -xvf afile.tar.gz -C /usr/src/myapp && rm afile.tar.gz You will need to scroll horizontally using your text editor to see the super long crazy line. This is not efficient and …