4 ms·
Everyone does this. Otherwise you'd go bat sh*t crazy trying to remember every intricate details of common tools. also using ctrl+r and filter through older co
by keyle 3y ago
Everyone does this. Otherwise you'd go bat sh*t crazy trying to remember every intricate details of common tools.
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!)
- deleted 3y ago[deleted]
- Izkata 3y agoI actually find it easier to memorize the flags than to memorize the commands I created myself, because they're a lot more descriptive than short commands like in your examples. 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.
- appplication 3y agoThe problem is some stuff I just don’t do often enough to remember. Like clean up my old git branches.
- dehrmann 3y agoI memorize the flags because it means I'm comfortable on any machine. Issue in production, and your aliases aren't there? No problem.
- pdmccormick 3y agoI'm curious, how much time would you say you spend on a set of personal machines, versus connecting to random hosts? 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.
- bayindirh 3y agoI'm not the OP, but I'm on the same boat with the OP. 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.
- coldtea 3y agoOne could see it as the opposite: 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.
- runjake 3y agoalias lsa=“grep ^alias $HOME/.zshrc | sort”
- supriyo-biswas 3y agoJust the “alias” command will list all your aliases, there’s no need to define a separate alias apart from convenience.
- ph4evers 3y agoExcept for tar. But there I use the mnemonic “xtrackt ze files”
- contravariant 3y agoThat may work, but I can never for the life of me remember what on earth each flag was for. 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.
- 3np 3y agoNeat. Now do rsync.
- actionfromafar 3y agotab trailing slash
- Izkata 3y agoFor tar, I have memorized: x, c, z, j, v, f 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.
- Einenlum 3y agoSince a few years I only use dtrx. https://github.com/dtrx-py/dtrx/ https://github.com/dtrx-py/dtrx/ I never have to learn this kind of stuff anymore.
- cosmojg 3y agoFish's autocomplete makes life a lot easier, too. It's delightfully well designed.
- keyle 3y agoI head great things about Fish but I never took the dive.
- hiAndrewQuinn 3y agoI recommend it! Fish, starship.rs and `fzf` with the Ctrl+R and Alt+C keybindings continue to be my personal 80/20 for feeling comfy at the shell. Installing nvim and reloading my ~/.config using `chezmoi` gets me like 95% of the way there. 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.
- petepete 3y agoMy Fish shell is pretty indistinguishable from my Zsh one but it has 5% of the config. You get amazing completion, themes, highlighting, etc out of the box. The only plugin I use is for fzf integration because I can't live without it.
- sertsa 3y agoHow did I not know about ctrl+r? Feeling slightly more optimized
- hiAndrewQuinn 3y agoWait until you try the `fzf` style Ctrl+R ;) total game changer for me.
- evilc00kie 3y agoCtrl+R is insane but sometimes I have a hard time remembering flags due to overusing it. Especially when crafting new pipelines/solving new problems. 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\`"
- pdmccormick 3y agoFunny, I was just learning about Git revision ranges the other day, to get to something like the last one! Thanks for sharing.
- anbotero 3y agoI used to do this, but with fish shell unless I have very similar commands, I just type part of the whole line to something I (personally) associate it with and that’s it, that’s the command. 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.
- heavenlyblue 3y agohistory | grep in regular bash
- pferde 3y agoOr ^Rpartofcommand to do an interactive history search. 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. :)
- sambazi 3y ago> alias ss="git status" ss is actually a 'socket stats' and will list all active connections while resolving their reverse dns name, be careful
- keyle 3y agothanks, I know :)
- lenkite 3y agoThis is why I prefer community standard aliases like Oh-my-zsh. All the conflicts get caught sooner by multiple people.
- Noumenon72 3y agoIs there any harm in that?
- bayindirh 3y agoIf you're not a sysadmin or debugging your netork, no. However if you're using it for any reason, you lose a command. This is why I start my local commands with a comma (,) [0]. [0]: https://rhodesmill.org/brandon/2009/commands-with-comma/ https://rhodesmill.org/brandon/2009/commands-with-comma/
- rpastuszak 3y agohehe same https://github.com/paprikka/dotfile-paella https://github.com/paprikka/dotfile-paella
- maccard 3y ago> Everyone does this. Otherwise you'd go bat sh*t crazy trying to remember every intricate details of common tools. I've got some bad news for you...
- Kiro 3y agoEveryone is definitely not doing this. I would say the vast majority doesn't even know how to set up an alias.
- tomatocracy 3y agoCtrl+R is nice, and was a big quality of life improvement when I first found out about it. 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.
- bbkane 3y agoThat sounds super similar my setup ( https://github.com/bbkane/dotfiles/tree/master/zsh https://github.com/bbkane/dotfiles/tree/master/zsh ). I'll check out a few of those I haven't yet.
- tomatocracy 3y agoSome interesting ones there and sounds like you have a similar philosophy to me - don't customize to the point that context-switching to bash is a pain. 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}"
- fouc 3y ago> Everyone does this 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.