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.

8 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
3 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
11 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
4 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
1 point
*

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

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
1 point

Thanks for naming these, I definitely need to look into them!

permalink
report
parent
reply
2 points
*

and fzf for Ctrl+R drop-in replacement

permalink
report
parent
reply
-1 points

No need, GUIs are better for most tasks.

permalink
report
reply
1 point
*

They basically aren’t?

If you’re doing one-off hobbyist stuff, maybe.

But literally anything in a professional setting should be in text that can be committed and searched in a source code repository. If you can’t commit it to git, it didn’t happen.

permalink
report
parent
reply
0 points

you could document the steps required in text and add Screenshots.

permalink
report
parent
reply
1 point

That’s fine until a UI changes, or the steps to reproduce it are incomplete (or a human doesn’t follow them exactly).

Text commands are unambiguous and precise.

permalink
report
parent
reply
1 point

Logging called, they want their . log files back

permalink
report
parent
reply
2 points

I’m not sure if you’re being funny, but of course committing the output of your program isn’t what I was saying.

permalink
report
parent
reply
2 points

It really depends. Maybe developing something like a game will require (almost) no CLI.

But do a little bit more server stuff, dev-ops, and you can literally not even do the job without cli.

Though in general, CLI is often better for the task, it often can easily be automated (via scripts etc.), which seems to be relevant for a lot of tasks programmers do…

permalink
report
parent
reply
2 points

Hard disagree

permalink
report
parent
reply
0 points

GUIs are easier to learn, but they are not always available. Many services only have a CLI client. If you are connecting to a remote server or, especially, a container to debug it, it may not have a window manager installed. If you know how to do something via the CLI, you can automate it with a shell script.

permalink
report
parent
reply
2 points

Maybe see if you can introduce them to a GitHub project or tool that you think they’ll find interesting or useful. I know there are a ton, but I’m not coming up with anything off the top of my head. But if you can give someone a reason to be in the CLI, then they may start to branch out a bit more. I started learning more about the CLI when I started seeing it as cool. Yes, I’m a nerd.

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

  • 3.5K

    Monthly active users

  • 1.6K

    Posts

  • 26K

    Comments