also using ctrl+r and filter through older commands (ctrl+r to cycle) is also necessary for good mental health.
for example
alias ll="lsd --icon never -l"
alias lla="lsd --icon never -l -a" # all
alias llr="lsd --icon never -l -r -a" # reversed
alias lls="lsd --icon never -l -r -a -S" #by size
alias llt="lsd --icon never -l --tree" #tree
alias lld="lsd --icon never -l -d -a --tree" #directories tree
alias m='micro'
alias ss="git status"
alias diff="git diff --color | cat"
alias log="git log --graph --pretty=oneline --abbrev-commit"
alias lz="lazygit"
alias dc="docker-compose"
# rust
alias cr='RUST_BACKTRACE=1 cargo run'
alias clippy='cargo clippy'
... many others
Soon enough, when you start piping these, you end up with your own bash language, cca. of that time you thought it was a good idea to augment C with macros (sic!)The few times I do come up with my own stuff, it's a 2+ line function (or full shell script) that can't be duplicated in a single command and can't be done as an alias.
My conceptualization of "personal computing" is something more akin to a home or a garden. It's a place where I should feel comfortable and relaxed. Familiar. It's a refuge of sorts, a place where I will inevitably spend an inordinate amount of time, and actually have a lot of real life experiences reflected (through the form of personal writing). Whether working, reading or writing, I tend to think of these machine contexts really as extensions of and foils for my mind. A discoverable mind palace, if you will.
For me it's 50/50. The good thing is, when you memorize the commands, and not customize your "base stations" extensively, the difference melts away.
My brain works in "contexts". I remember my native keyboard layout and US one, and I operate in one of these contexts. Same for the spoken/written language. When I switch completely, the mental load disappears, however it's not completely free in terms of brainpower.
So, removing a context is highly beneficial. When I connect to a remote system, I don't care about the commands, aliases, even the place I'm in. Look to the hostname, remember the task I need to do and let my brain loose on the subject.
There are no roadblocks, errors or anything to think about while working. As a result the whole fleet is my home base. I change machines like I change directories. Completely effortless, invisible in fact.
Also, extensive aliasing is limiting. When I know the flags to a command, I can compose and flex on the fly, which I do a lot, as the circumstances and needs arise.
Forcing yourself to memorize flags, means you're just equally uncomfortable on any machine: that is, you haven't optimized any particular machine, especially the 1-2-3 machines you use 90% of the time with your aliases.
Not to mention in 2023 on doesn't have to memorize anything to have aliases on "any machine". Have your aliases on a file (or GitHub) and just download it and source it to whether you are.
or getting them subtly wrong in some production shell script...
You could even have your script automatically add the line to source itself to the profile, so you source it once and then it happens automatically!
alias lsa=“grep ^alias $HOME/.zshrc | sort”Doesn't help that '-a' basically means 'all the flags', meaning you have to know them all to figure out what on earth it's doing. Or just hope it is enough.
The trick with tar that people seem to have issues with is the ordering with "f" - since it takes an argument, if you're using the combined short form it has to be last with the filename immediately following.
Being very obviously not Bash is a feature, not a bug, imo. It's usually pretty easy to turn Bash commands into Fish commands with the help of ChatGPT if you get stuck.
The only plugin I use is for fzf integration because I can't live without it.
But I'd always alias some uncommon tasks and usages. Especially my quirky git ones:
# get default branch
alias gdefault='git remote show origin|grep -E HEAD|cut -d" " -f5'
# cd to git root
alias groot='cd "$(git rev-parse --show-toplevel)"'
# Revert last unpushed commit to the state before commiting
alias uncommit="git reset HEAD~1 --soft"
# Show all commits between head and main as one-liner
alias gl1="git log --reverse --oneline HEAD...\`gdefault\`"I press a space before commands with sensitive information so they don’t stay in my history or throwaway commands that I’m 99% sure I won’t use again.
Complicated ones I create a function for it, but I no longer carry aliases on my shell configuration, and I prefer the legibility of my commands/history.
This is a priceless feature, which, as I keep finding out, too many people do not know about, and they waste time faffing about pressing up and down, trying to find that one command their entered ten minutes ago. :)
ss is actually a 'socket stats' and will list all active connections while resolving their reverse dns name, be careful
i wish this was hypothetical
[0]: https://rhodesmill.org/brandon/2009/commands-with-comma/
You said:
> you lose a command
I showed you how you do not lose a command. That is all.
> I showed you how you do not lose a command. That is all.
I know. I understand your point, but yours is a very pedantic (sorry, was unable to find a gentler word) take on the issue.
In the heat of debugging some prod problems, the need to remember which commands are overridden by aliases and the effort required to remember full paths is an extra mental load. This is why it's better to not use aliases or be super careful, or at least prefix them with a common character is useful.
There's something called scaling cost. It's not only valid for infrastructure or software architecture. The customization you do, or the procedures you follow need to be able to scale too. I recently had to abandon Tiddly Wiki for Obsidian, because the work required to maintain that corpus of information became accidentally quadratic, and started to eat into my productivity and time. Aliases and terminal customization are also affected by this phenomena.
I've got some bad news for you...
Recently I've found a similar improvement going from "plain old" ctrl+r for history to a set of zsh extensions plus fzf - my current set of extensions is zsh-autocomplete, zsh-autosuggestions, zsh-syntax-highlighting, zsh-history-substring-search, zsh-histdb, and fzf-histdb.
For tab-completion I actually prefer the builtin zsh completer set to use the menu mode - this is one of the big improvements you get with zsh over bash / etc to my mind. I have in .zshrc
zstyle ':completion:*' menu select=2 select=long interactive
You can set it to use your ls colors with something like zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}"I disagree, experienced *nix users probably remember a TON of commands outright, after going through multiple distros/*nixes over the years.
Personally I have maybe ~30 aliases that are actually used. There's almost no point in inventing aliases that will go unused or be rapidly forgotten etc.
git has it's own alias config which I prefer to use instead. some examples: st=status, co=checkout, ci=commit, cp = cherry-pick, mod=add -u.
so that means I do 'g st' instead of 'ss', yeah, a couple extra keypresses but I'm okay with that.
I took a handful of math courses in school, and what I didn't realize till later was that learning how to rigourously prove things mathematically had dramatically reshaped my mind. I am left wondering what it must be like for the minds of those who have traversed that tower far higher than I ever have or will.
exec /bin/bash
Then you could do something like: ssh hostname@address -tt bash -s < /path/to/utils.sh
And have all your utilities available on the remote machine :)Out of curiousity, these servers that you're dealing with, do you have to use them for long/focused work like writing or software development, or are these more like sysadmin interactions? Have you noticed any repeated commands or sequences you find yourself running over and over? Is there any opportunity for you to write local scripts that then SSH into the targets and run those commands on your behalf? Or locally use sshfs and manipulate files like they were local.
It’s more than just frequency analysis because it helps to remember what commands happened before or after. It also needs to be smart about when two commands are actually “the same thing” but with different flags or input filenames.
Maybe something like an N-gram model.
It does have its place, though. Each morning, I do a 5K walk, and am constantly glancing at my Apple Watch, to ensure I maintain a pace of <10 min/K. If I find myself slowing, I put on a bit of mainsail, but I don’t insist on beating my personal best.
As for my software development, I just enjoy the work, and have dealt with CRS[0], since I was about 17. It’s always been a basic challenge, and isn’t something I can control.
It’s made me very good at finding information quickly and relevantly. I’m really good at googling answers; even embarrassingly basic ones.
My work speaks for itself. I definitely perform at a pretty high level. There are many folks that are better than me, but many, many more that can’t do as well.
Through this process I’ve created a whole idiom of commands for myself. I have no pretense that they would be useful to anyone else, and I don’t sweat them beyond their ability to make my life easier. From these incremental efforts, I find I have access to a new kind of language in my mind. Especially with Git, I find myself seeing it as an extension of my mental process, integral to how I even think about solving problems, not just a VCS I use to push code around.
By noticing how I was working, I didn’t seek to optimize where I was at, I sought to graduate to levels where what previously needed optimization just doesn’t exist.