Scripnix: Useful Python3 and bash shell scripts for macOS/BSD and *NIX(github.com)
github.com
Scripnix: Useful Python3 and bash shell scripts for macOS/BSD and *NIX
https://github.com/yukondude/Scripnix
11 comments
Since coreutils 9.0 you don't need to explicitly enable CoW in cp, this behaviour is default now.
https://www.mail-archive.com/[email protected]/msg02953.html
https://www.mail-archive.com/[email protected]/msg02953.html
For those of us who nest tmux sessions:
Using `pane_pid` to make this more compact is tricky because I want to find processes that might be stopped and not running in the foreground.
# Map a PID to a tmux session and window
# in which to find that process (typically
# $EDITOR):
#
function p2mux {
local fmt='#{session_name} #{window_index} #{pane_tty} #{window_name}'
find /tmp/tmux-$UID -type s -print0 |
xargs -0i tmux -S '{}' list-panes -a -F "$fmt" 2>/dev/null |
grep -w "$(ps -p "$1" -o tty= || echo pts/NO_SUCH_TTY)"
}
Yes, I nest tmux sessions. I've one session per-project, each running in a window of the same name in a top-level session. I've a different prefix for the top-level (^T) and the nested sessions (^A, because old habits from the days of screen(1) die hard). Every $EDITOR instance goes in a window named after the basename of the file being edited. `p2mux` is very useful in this setup.Using `pane_pid` to make this more compact is tricky because I want to find processes that might be stopped and not running in the foreground.
no offense but how is this getting so many upvotes?
it's newb bait.
I dont think any seasoned sys admin or dev would use these, let alone polish it up so much.
Most of these can just be solved by keeping commands in a bash history file and recalling them...
I dont think any seasoned sys admin or dev would use these, let alone polish it up so much.
Most of these can just be solved by keeping commands in a bash history file and recalling them...
Great way to take the fun out of using the Linux CLI.
The backup script that essentially runs cp "$x" "$x.$(date +%y%m%d)" would greatly benefit from the --reflink option to GNU cp, but only when running on a COW filesystem (ZFS or BtrFS). This particularly strikes me.