3 ms·
Scripnix: Useful Python3 and bash shell scripts for macOS/BSD and *NIX
- martinky24 5y agoLast commit 2017!
- unixhero 5y agoMaybe it is done
- chasil 5y agoA lot of these scripts have areas of nuance and subtlety that are likely not addressed. 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.
- chungy 5y agoZFS doesn't (yet) support reflink copies.
- chasil 5y agoZut alors! I thought it did.
- Self-Perfection 5y agoSince coreutils 9.0 you don't need to explicitly enable CoW in cp, this behaviour is default now. https://www.mail-archive.com/info-gnu@gnu.org/msg02953.html https://www.mail-archive.com/info-gnu@gnu.org/msg02953.html
- raziel2p 5y agono offense but how is this getting so many upvotes?
- sigmonsays 5y agoit'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...
- ImTheMaddest 5y agoGreat way to take the fun out of using the Linux CLI.
- navanchauhan 5y agoRelevant: https://github.com/alexanderepstein/Bash-Snippets https://github.com/alexanderepstein/Bash-Snippets
- cryptonector 5y agoFor those of us who nest tmux sessions: # 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.