Search
Suppose I have some hypothetical CLI program. It is important that only one instance of this program runs at any given time. When multiple instances run concurrently, bad things happen. Normally, ...
This can be done using the flock utility. The most useful mode for preventing multiple invocations of a same process is likely to be -en (exclusive lock, no wait). You need a file or directory (ye...
Sometimes I work with Git repos that have some changes fetched but not yet merged to the local branch. Occasionally I make commits without noticing this, which necessitates rebase/conflict resoluti...
Online, I often see someone tell people to run a command like /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" (example from https://brew.sh/). The g...
Do not embed {} in the shell code. If your {} gets expanded (by xargs) to ./rogue name $(reboot).txt then bash -c 'my-func "{}"' _ will become bash -c 'my-func "./rogue name $(reboot).txt"' _ a...
This other answer tries to truncate each line to make it fit the width of the terminal. It's hard to do this reliably because e.g. a tab character counts as one, but it looks like several spaces; o...
(Assuming your file names are portable, according to POSIX (https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_282). If not, please read this for writing a more robust...
TASK I am coding up ebooks to a specific standard, and have a script that converts a string into the correct titlecase for this publisher. When working with some public domain source files, one of...
I'm going to assume that you're using OpenSSH, since that is probably the most common SSH implementation on present-day *nix systems. The easiest is probably to use ssh-keygen -R to delete all kno...
for file in in chapter-*.xhtml do sed -ir "12s/\b([A-Z])([A-Z]+)/\1\L\2/g;" "$file" done This -ir tells GNU-sed so alter the file in place (-i) and use regexp-extended (-r). For line 12...
My VISUAL setup interferes with my cron jobs. crontab -l works all right, I see my previous jobs. crontab -e, crontab -e -u user-here - opens GVIM on an empty file checked cron.allow or .deny,...
My assumption has been that shell-scripting is for scripts only, not interactive usage. Whereas shell is everything else, like interactive usage. I wish we could edit these descriptions to clarify...
I have an old Mac Mini (Late 2009 model) kicking around, and as Apple stopped providing patches for it (and as I'm not going to put an unpatched system on the Internet), I was looking for a Linux d...
To increase the activity of the site (one of the main concerns related to making Codidact grow), I suggested merging Linux Systems with Power Users on Meta. Do you agree or disagree with merging?
From man ssh_config: This file is used by the SSH client. Because of the potential for abuse, this file must have strict permissions: read/write for the user, and not writable by others.
I am using Linux Mint 20.3, with Cinnamon as a window manager. I have a folder named .pytest_cache on my Desktop: $ ls -1A | grep '^\.' .pytest_cache I know that if I open a Nemo window, navi...
There are a couple of ways of handling this (on PC's in general. I do use Linux, but not Arch, and this will work). The first way is to statically assign an IP address. While you SHOULD be able...
Authentication events such as logging in are ultimately handled by PAM, the Linux Pluggable Authentication Modules project. PAM is very flexible and different Linux distributions will ship with dif...
After a force shutdown on Ubuntu 22.04, installed on a Lenovo Legion 5, the OS seems to have lost its ability to recognize the built-in touchpad or to connect to the internet. For the backstory......
By digging further into the details of xdg-open, I stumbled upon this page in the Arch wiki. There it states that xdg-open will delegate the task of opening a file to the handler of the Desktop En...
When I enter the login password incorrectly 3 times, my computer locks me out from attempting a login for 10 minutes. How can I increase the number of attempts?
As the keyboard layout wiki suggests, loadkeys only sets the keyboard layout for the current session. In order to persist these changes, the KEYMAP variable must be set in /etc/vconsole.conf. Thi...
I'd forget about messing around with console commands and X configuration files, and just change the keyboard layout in the GNOME Settings panel: You can access this by hitting the Windows key a...
How do I make my computer request a new IP from DHCP? I am using Arch with NetworkManager.
Hello everyone, I am encountering an issue when running pytest in my virtual environment. Although I have installed the required modules in my virtual environment using pip, I am still getting a M...