3 ms·
Writing bash scripts and backing them up to github saves me tons of time.
by rc_bhg 10y ago
Writing bash scripts and backing them up to github saves me tons of time.
- ryanmaynard 10y agoSimilarly, adding a setup.sh for clean installs doesn't hurt.
- chatmasta 10y agoI make a habit of writing any sequence of two or more commands as a shell file, no matter how simple. This way if I need to reference it later I don't need to grep through my history on every box.
- yjftsjthsd-h 10y agoIn the opposite vein, it can be helpful to stick something like ` #useful` or ` # description ` on the end of a command you expect to need again, so you can easily grab from history with C-r
- vram22 10y agoExcellent idea, going to use it :) For benefit of others - this approach would work with the 'set -o vi' option too (discussed by me and others elsewhere in this thread) - just that you would have to type a / (slash) to search instead of C-r (Ctrl-r), because the mode is vi, not emacs. And since you start (obviously) at the bottom of the history (i.e. latest command first), the usual sense of the vi / command (which means search forward or down in the edited file) is reversed here to mean search backward in the history of commands. And ? is the opposite of / . N and n work, too, to repeat the previous search command in the opposite / same direction.
- reddit_clone 10y agoYep. Super useful. I figured it out only recently! I ssh into many servers with IP addresses and weird hostnames. Now I add #server-description at the end of the command and I can get back to it instantly.
- lozf 10y agoI prefer to use a short memorable name as an alias in `~/.ssh/config`, so with keys set up properly ànd a suitable alias in .zshrc I can connect with 4-6 keystrokes, and take full advantage of zsh's auto-completion across hosts (way better than in bash).
- chatmasta 10y agoI still have no easy solution to the "same box" changing IP's because you booted up a new test cluster. I guess that's the point of DNS.
- dflock 10y agoYou might like this, then: https://github.com/erichs/composure https://github.com/erichs/composure
- dflock 10y agoYou should check this thing out, then: https://github.com/erichs/composure https://github.com/erichs/composure