Use the iostat Linux command to see if your hard drive is not keeping up with whatever you're doing.

Among the values it shows, %iowait represents "the percentage of the time that the CPU or CPUs were idle during which the system had an outstanding disk I/O request". If that value is consistently high (for me, around 40% for long periods of time), it might mean that the drive is just too slow.

Read more

You can close a GUI app in Linux with the xkill command. Run it in the terminal, and then click on the window that you wish to kill.

This should only be used when the app becomes unresponsive, which, as of 2023, is still painfully common.

Read more

You can generate different SSH keys for different Bitbucket accounts, for example, and configure them in ~/.ssh/config to use one or the other based on hostnames.

This config file will point a custom hostname to bitbucket.org (continuing the example), but specify a key different from the default.

Read more

Add these lines to the top of a Makefile to load environment variables from a file. The minus sign lets it fail silently if the file doesn't exist:

-include .env
export
Read more

In Linux, you can make IPv4 traffic have a higher priority than IPv6 by running the following command:

sudo sh -c "echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf"

Read more

If you run out of memory in Linux, you can create a file to hold additional memory using these commands:

/bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
/sbin/mkswap /var/swap.1
/sbin/swapon /var/swap.1
Read more

In Ubuntu (and probably other OSes) you can create an empty file, resize it to a couple GBs, create a filesystem on it, and then mount it at any location. You can treat this as a virtual drive to, for example, limit the size of a directory:

Read more
Subscribe to Linux
Mastodon Mastodon