49 ms·
Over the past year, I’ve made a deliberate effort to improve my “personal computing”, which for me is about how I use the shell. I start by trying to notice whe
by pdmccormick 3y ago
Over the past year, I’ve made a deliberate effort to improve my “personal computing”, which for me is about how I use the shell. I start by trying to notice when I’m doing the same task multiple times and getting tripped up on the specific syntax or sequence of commands (i.e. what’s the Git command again to split certain files out of a previous commit into a separate one?) I will then create an alias, a shell script or maybe a larger program to start addressing it, solving my initial use case first, and gradually revisiting things over time to make improvements.
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.
- adasdasdas 3y agoI thought everyone does this haha
- keyle 3y agoEveryone 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.
- cosmojg 3y agoWelcome to Unix! :)
- pdmccormick 3y agoThanks, 25 years in and I'm still learning new things. But I don't think I was specifically shouting out the Unix philosophy. My comment was more in response to the OP article, that rather than "trying" to optimize in the sense that you already know what you need to optimize for and towards, instead thinking of self-improvement as being a by-product of being able to think new thoughts, thus the upfront emphasis on the acquisition of new language (with a big nod to the Sapir-Whorf hypothesis). This could be through collecting good terminology, best practise and patterns, and learning the philosophies of systems such as Unix and languages like Go and Python. However, with aliases and scripts, it becomes something you can actually "speak" in an effective sense, which ultimately can lead to improvements over earlier capabilities that go beyond what you could have envisioned as possible from the start. 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.
- stephen_cagle 3y agoThat's an interesting idea. Did you write a script to identify commands that you use repeatedly? I wonder how that could best be done?
- pdmccormick 3y agoI have not tried that yet, no. For me the goal isn't just about shortening often repeated commands, as though the limitation were purely about character input speed, it's more of a contemplative practise of learning how to notice and respond to that internal prompt that says "I wish I could say that more succinctly" or "There has to be a better way to do this". And then either telling my mind work on those questions, or being open and receptive to coming across something relevant on the topic, or seizing a moment of inspiration to write a time-saving script or come up with a meaningful (to me) alias.
- crosa 3y agoThere you go https://github.com/cristianoliveira/dotfiles/blob/cd1921ebda3d2b14cfe1b5aa6960aed5b934aa89/zsh/aliases/custom.zsh#L20 https://github.com/cristianoliveira/dotfiles/blob/cd1921ebda...
- deleted 3y ago[deleted]
- 63 3y agoMust be nice being able to work in the same shell every day, and one you have complete control over no less. For those of us ssh-ing into uncountable remote servers all day with unprivileged accounts, it's not really a practical option unfortunately.
- bheadmaster 3y agoIf your utilities are written as self-contained exported Bash functions, you could concatenate them all in a single file (say, `utils.sh`), with a single line at the end: 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 :)
- Noumenon72 3y agoDoes this work for aliases?
- deleted 3y ago[deleted]
- deleted 3y ago[deleted]
- pdmccormick 3y agoBy "personal computing" I guess I do mean machines that I have full root on, so usually either a laptop/desktop or a local headless server. 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.
- j7ake 3y agoWould love a system that analyses my shell command usage and recommend when I should link commands I often use in series and turn them into one line. 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.
- williamdclt 3y agoI don't like being this guy, but maybe throwing your history at a GPT, asking it exactly that, would work fairly well?
- ChrisMarshallNY 3y agoFor me, personally, I’ve never been particularly interested in self-metering. 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. [0] https://www.urbandictionary.com/define.php?term=CRS https://www.urbandictionary.com/define.php?term=CRS