Search
Suppose I want to limit what characters are allowed in filenames. For example, I want file creation to fail if there is a \n in the name. Is there a way to enforce this? If it matters, I prefer 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...
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...
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...
An exclamation mark followed by space in the beginning of a pipeline will negate the final exit code of the pipeline. Here's an example in Bash. Echoing $? will print out the exit code of the prev...
It is possible - while being unlikely - that /proc/config.gz does not match the actual kernel configuration. Normally, /proc/config.gz should reflect the kernel configuration truthfully. But wheth...
@Canina's answer contains a good solution if you only want to reach a small number of hosts. But requiring a port (local though, not on the jumphost, so many users don't compete for resources) for ...
As we start on building a new community here together, we're bound to find some sticking points. Those might be bugs, new features you need, things you need support with... whatever they are, the C...
You might be enlightened by reading the man page for file(1). A brief quotation: This manual page documents version 5.35 of the file command. file tests each argument in an attempt to classify...
A shell script! You don't need a shebang line, just invoke it as /bin/sh script.sh, but if you want to add one (e.g. perhaps you anticipate doing this more than once) Then you can copy the command...
You can't expect an attacker to abide by any particular rulebook. In fact, if they did, then the defenders' job would be so much easier. That's why attackers don't do it. Remember the adage: a de...
Categories should be used for broad categories of posts. For example, see how Writing separates the main Q&A from writing challenges, or how Cooking separates its Q&A from recipes, or how M...
On a Debian Buster system I use, the password for connecting to a VPN is stored in the GNOME Keyring. Therefore, whenever I want to connect to the VPN in question, I get prompted to unlock my keyri...
How does the list of packages differ from that in a fresh install? The easiest way, if you have the data for it, would probably be to parse the APT logs (particularly /var/log/apt/history.log*...
I've got a Raspberry Pi running Raspbian, which I'd like to reinstall from scratch. However over time I've made many changes to the configuration (installed new packages, changed the name of the de...
I'm quite certain that rsync is not able to deduce that /path/to/src/folder_a/file_w on one side of the transfer is identical to /path/to/src/folder_c/file_w on the other side of the transfer. The...
On a default Arch install, faillock makes it so that if you enter the sudo password wrong too many times, even the correct password will be rejected until the timer is up. At the same time, you ca...
Especially in a pedagogical context, the issue with something like cat /dev/random | head -c 20 versus the more straightforward head -c 20 /dev/random is that it communicates that extra ceremony is...
Note that if you want to debug the currently installed version of NetworkManager, you don't have to compile NetworkManager yourself. Instead, make GDB download symbol files via debuginfod. You can ...
Linux does have the concept of a RAM DRIVE (multiple concepts actually, including ramfs and tmpfs being common). You should look at https://en.wikipedia.org/wiki/Zram - ZRAM claims to be exactly ...