https://github.com/skx/sysadmin-util
Later they were replaced by a busy-box style collection of utilities written in golang (mostly to ease installation):
91–100 of 225 posts
https://github.com/skx/sysadmin-util
Later they were replaced by a busy-box style collection of utilities written in golang (mostly to ease installation):
Where is Msdos utility "ncd"? It was like "cd" but guessed from few character hint where you wanted to go. If the choice was not immediately obvious if offered a menu or a tree. I shortened it to "n". -- There was some linux utility but setting it up was annoyingly tedious, with lots of useless and cryptic options.
Didn't know about "ncd", ended up re-inventing it. The following script, named 'F', takes regexp(3) pattern in $1 and works reasonably well in the 'all text is hypertex' environment of (p9p) Acme. If it finds one match, it opens it via plumb(1). Otherwise lists results; one right-click opens the clicked result again via plumb(1). Yes, the find -type f focuses on files; nonetheless it's easy enough to right-click-sele…
"rc - implementation of the AT&T Plan 9 shell".
Do I have to install that?
A lot of these seem easily achieved in a POSIX shell manner, but most annoyingly to me > sponge: soak up standard input and write to a file I do that all the time... cat > file.txt Update: reading the comments on here, apparently sponge sucks up all content before opening the destination file which allows editing an input file in place. Minor advantage there.
Nice collection of quite useful tools. Some of these can be easily replicated by using a more modern shell (bash, zsh) like mispipe, others are just shortcuts (e.g. ifne, chronic). But what immediately stood out to me is `vidir`. I really like the idea of editing file names with an editor. Using loops and regex in a shell for mass renaming can be a mess. It should be way easier with `vim`. This tool made me install m…
On most POSIX systems you can use fc(1) to edit a command in your $EDITOR. In vi(1) and friends you can then use "%!ls" to replace the contents of the buffer with directory listing and edit the commands you want. https://pubs.opengroup.org/onlinepubs/9699919799/utilities/f... https://pubs.opengroup.org/onlinepubs/9699919799/utilities/v...
A lot of these seem easily achieved in a POSIX shell manner, but most annoyingly to me > sponge: soak up standard input and write to a file I do that all the time... cat > file.txt Update: reading the comments on here, apparently sponge sucks up all content before opening the destination file which allows editing an input file in place. Minor advantage there.
The purpose of sponge is that you can do this: grep foo file.txt | sponge file.txt If you do this with redirections then file.txt will be truncated before it's been processed, leaving you with an empty file instead of what you wanted. Sponge collects its input first and then writes everything out at the end, so you can output to a file that was used as an input. (Parent updated while I was writing. Oh well)
Commands that process file in place (sed -i) write to a temporary file in the same filesystem and then rename to the target file, which works if you want to process files that don't fit into memory.
Earlier quoted context omitted.
I use Emacs shell-mode for most of my terminals, which allows navigating and editing the buffer just like any other file. I'll often make several copies of a command, then use a macro to alter each one; after checking that they look right, pressing Enter will send them all to the shell.
I always tried to use the shell with emacs (eshell, multi-term) but it didn't render correctly curses and all the fancy stuffs like emojis. Out of curiosity, how do you manage that?
> sponge Why not use > file? > mispipe In bash there's PIPESTATUS for that.
This, I learned the hard way, and I am not the only one. So in order for you not to make that mistake: the first thing that happens is that "file" is truncated, that happens before any command is run, so
sed s/foo/bar/ file > file
will always result in an empty "file", because it will be truncated before "sed" is run. I lost a couple of hours of work like that, once, and then I learned.From the manpage of sponge
sponge reads standard input and writes it out to the specified file. Unlike a shell redirect, sponge soaks up all its input before opening the output file. This allows constricting pipelines that read from and write to the same file.
So, the command sed s/foo/bar/ file | sponge file
will do what you expectEarlier quoted context omitted.
What kind of platforms are you thinking of? People have got Rust running on the Raspberry Pi. https://old.reddit.com/r/rust/comments/cdcads/
MIPS and SPARC to name a few. Almost all routers are on MIPS and most of them are running some form of Linux or BSD. AFAIK, rust is still marked as "guaranteed to build" on these platforms, but assume only Linux. BSDs, not so much.
Earlier quoted context omitted.
Didn't know about "ncd", ended up re-inventing it. The following script, named 'F', takes regexp(3) pattern in $1 and works reasonably well in the 'all text is hypertex' environment of (p9p) Acme. If it finds one match, it opens it via plumb(1). Otherwise lists results; one right-click opens the clicked result again via plumb(1). Yes, the find -type f focuses on files; nonetheless it's easy enough to right-click-sele…
Que? What is rc? "rc - implementation of the AT&T Plan 9 shell". Do I have to install that?
#! /bin/bash
d=$(find / -name "$1" 2>/dev/null | head -1)
echo Jumping to $d, Control-D to return
cd $d
bash
Actually it is now perfect. If the guess is wrong, you can return and add letters to you search string.There's a few programs I wish were standard on all Unix systems by now: * tree - print directory structure * bat - cat, but actually designed for reading files. Syntax highlighting, line numbers, automatic paging. * rg - better grep * direnv - local environment variables