In a Bash script, you can defer running a command by using trap
like this:
trap "rm -f /tmp/mytempfile" EXIT
# ... continue your script without a care in the world
In a Bash script, you can defer running a command by using trap
like this:
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.
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.
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.
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:
You can create infinite symlink loops.
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"
If you run out of memory in Linux, you can create a file to hold additional memory using these commands:
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:
Copyright 2022 ยท All rights reserved