Sometimes I talk to friends who need to use the command line, but are intimidated by it. I never really feel like I have good advice (I’ve been using the command line for too long), and so I asked some people on Mastodon:

if you just stopped being scared of the command line in the last year or three — what helped you?

This list is still a bit shorter than I would like, but I’m posting it in the hopes that I can collect some more answers. There obviously isn’t one single thing that works for everyone – different people take different paths.

I think there are three parts to getting comfortable: reducing risks, motivation and resources. I’ll start with risks, then a couple of motivations and then list some resources.

I’d add ImageMagick for image manipulation and conversion to the list. I use it to optimize jpg’s which led me to learn more about bash scripting.

7 points

Can’t live without oh-my-zsh, powerlevel10k and zsh autocomplete/autosuggestions plugins. It’s the first thing I install whenever I’m on a new computer.

And if I’m constrained to Windows (for work) then posh-git and PSReadLine is the next best thing.

permalink
report
reply
4 points

I’ve had ohmyzsh installed for years. TBH, I still don’t know what it gives me over bash. In your experience, what is the “killer feature” of zsh?

permalink
report
parent
reply
3 points
*

Not OP, but I very recently switched from bash. Autocomplete with suggestions is a way better exeperience on zsh than bash. The way you can choose between options of the autocomplete/suggest interactively feels way better than bash. I set it up to be case-insensitive, so I can type cd dow and it will become cd Downloads. Gettig autocomplete for both kubectl and its alias k is seamless in zshrc but requires an extra line with a weird dunder function in bashrc.

This is just what I found in a few days of using it. There was no learning curve at all, everything just felt easier.

permalink
report
parent
reply
2 points
*

Fish: look what they need to mimic a fraction of our power

I’ve seen quite a few articles on why you should never install oh-my-…s over the years. I’ve also never bothered to remember anything past “install the plugins and prompt separately or you will suffer”, so someone please link if you know what I’m talking about.

permalink
report
parent
reply
2 points
*

and fzf for Ctrl+R drop-in replacement

permalink
report
parent
reply
1 point

Can’t live without oh-my-zsh, powerlevel10k and zsh autocomplete/autosuggestions plugins. It’s the first thing I install whenever I’m on a new computer.

I run this exact same setup, it’s pretty much a prereq on a fresh install. I wonder if we’ve all been exposed to the same blog articles

permalink
report
parent
reply
7 points
*

That’s a good article. From my observation, there are a few things:

  • Necessity. I’m active in communities with people who don’t use the terminal until it’s an absolute necessity. Like people running unraid, docker, or whatever containerized server. Eventually they need to type commands.
  • The prettiness. Yeah, I run oh-my-zsh. It’s nice having a setup pretty environment. Some people’s only experience might be opening up the powershell default display to run one command… And that is a bad experience.
  • Niche commands/programs. Take ffmpeg as an example. It’s probably the most powerful media tool that exists, but has no official gui. And it’s expansive enough that no GUI really covers what it can do. There are a bunch of other things like this.

Edit: And yeah, git. I’ve never used a graphical client. Seen a handful in use and don’t like it.

permalink
report
reply
1 point

You’ve never used a graphical git client?!

I’m comfortable on the command line but a decent git UI is a way better experience.

git diff is so basic using a GUI makes it far easier to compare changes.

Same for merge conflicts. I’m not sure you can even resolve them on the CLI?

Any form of rebase: I think I used the CLI to do an interactive rebase a few times in the early days but I’d never do so without a GUI now.

Managing branches: perhaps I’m a little too ott but I keep a lot of branches preserved locally, a GUI provides a decent tree structure for them whereas I assume on the command line I’d just get a long list.

Managing stashes: unless you just want to apply latest stash (which admittedly is almost always the case) then I’d much rather check what I’m applying through a GUI first.

There are some things I still use the CLI for though:

git remote add git remote set-url because I’m just too lazy to figure out how to do that in a GUI. It’s usually hidden away somewhere.

git push --force because every GUI makes it such an effort. C’mon! I know what I’m doing - it’s /probably/ not going to mess things up…

permalink
report
parent
reply
3 points
*

I use git on the CLI exclusively. I almost never rebase, but otherwise get by with about 5-10 commands. One that will totally change your experience is git add -p

I also have my diff/mergetool configured to use kaleidoscope, but still do everything else in the CLI.

permalink
report
parent
reply
2 points

-p –patch

Interactively choose hunks of patch between the index and the work tree and add them to the index. This gives the user a chance to review the difference before adding modified contents to the index.

This effectively runs add --interactive, but bypasses the initial command menu and directly jumps to the patch subcommand. See “Interactive mode” for details.

The documentation is entirely meaningless? What does it do?

permalink
report
parent
reply
2 points

git add -p is great to know, but IMO one shouldn’t rely on it too much, because one should strive committing early and often (which eliminates the need for that command). Also using git add -p has the risk of accidentally not adding some code that actually belongs to the change you are trying to commit. That has happened to me sometimes in the past and only later do I see that the changes I commited are broken because I excluded some code that I thought didn’t belong to that feature.

permalink
report
parent
reply
3 points

Same for merge conflicts. I’m not sure you can even resolve them on the CLI

How are they solved when using a GUI? When using cli, it simply tells auto-merging failed and you can open the conflicting files in a text editor and solve the conflicts, then add them and continue the merge.

Managing branches: perhaps I’m a little too ott but I keep a lot of branches preserved locally, a GUI provides a decent tree structure for them whereas I assume on the command line I’d just get a long list.

git log --graph --all --oneline

There’s also --pretty, but it uses a lot of screen space.

Managing stashes: unless you just want to apply latest stash (which admittedly is almost always the case) then I’d much rather check what I’m applying through a GUI first.

You can attach a message when stashing with -m.

And you can check them out by doing git checkout stash@{1} or similar.

permalink
report
parent
reply
2 points

To be fair, I like to use VSCode for resolving merge conflicts, because it is easy to see the deviations and apply/edit as needed. Still, I use the CLI for everything else, including commiting that merge. Plus the gh cli client when I’m using github as I can create a repo or push a repo with zero effort.

It is possible to resolve conflicts through any text editor, but not an amazing experience.

permalink
report
parent
reply
2 points

I also exclusively use the git CLI. I have tried to use a graphical client and could never figure out what it was doing and what was going on. I probably picked it up so easily because when I learned git, I was already used to using a CLI version control client. At the time, I was working at a company that heavily used Perforce and had a custom wrapper around the p4 cli that injected a bunch of custom configuration.

permalink
report
parent
reply
6 points

Do everything on your command line.

Why click and drag files when you can mv *.png

Why use an IDE when you can setup vim (or space vim on neo vim) to load all the plugins your IDE would need, but only for the particular tasks that would leverage all those plugins (saving you overhead when you’re not leveraging those plugins)

Why use word when you can use pdflatex to turn your .tex files into .PDFs, with vim setup to trigger pdflatex on every post buffer write event, while zathura renders the PDF automatically

Why manually start your code, when you can set it up to trigger automatically at start up or in response to other events

The answer, of course, is because it’s effort. The pay off is getting marginally better on a skill curve with an infinite ceiling. But the point being, anything your computer does, can be interacted with functions and variables / data structures, and can be automated with shell languages

permalink
report
reply
3 points
*

What did it for me is I stubbornly refused to use Git via VSCode and stuck with the terminal. I also stubbornly refused to change my default text editor for GIT to something other than VIM. One light bulb moment I had, funnily enough, was when I finally read the VIM docs and learned how to save and close rather than panicking when it popped up (this was early on… but not THAT early on … so still funny). That sparked my curiosity to truly learn VIM.

After that, I realized command line tools could be learned and advantageous and so it just went up from there.


Honestly, I’ve noticed a difference in the confidence level of peers using command line tools based on whether or not they learned GIT using command line or jumped straight to just clicking the buttons in VSCode.

permalink
report
reply
2 points

It’s not exactly clear to me who is supposed to be more comfortable.

Anyhow:

  • Avoid commands that require their own DSL. Most DSLs are ad hoc garbage, in particular when it comes to UX and UI design.
permalink
report
reply

Programming

!programming@programming.dev

Create post

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you’re posting long videos try to add in some form of tldr for those who don’t want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



Community stats

  • 1

    Monthly active users

  • 556

    Posts

  • 2.8K

    Comments