Live data from Hacker News

Ask HN: I want to learn to use the terminal, where do I start

news.ycombinator.com

51–57 of 57 posts

Re: Ask HN: I want to learn to use the terminal, where do I start

#51
Don't start in the obvious places, because you can get stuck there for a decade before figuring out what else is going on ( I did, you shouldn't ) ( quick dive ; quick dip )

1. do a quick read on how UNIX and Linux kernels were designed, particularly what "file handlers" and "sockets" are ( day 1 ; 30 minutes )

2. do a quick read on the difference between "command prompts" (1-dimensional) and "pseudo-teletype terminals" (2-dimensional) ( day 2 ; 15 minutes ) ... note that both are varieties of "shell" ; shells are opposed to kernels

3. do a quick read on what "display managers vs window managers" are ... and if possible ( now this is quite hard, as the docs are messy ) ... how the kernel, talks to the shell, which talks to a pseudo-teletype terminal, which is a display client to the display server, which talks to the display server, which talks to the window manager ( it may not be exactly like that, but this is a good assumption to make until you get a clearer view ) ( day 3 ; 2 hours )

4. then learn a shell scripting language

5. then do something like "espeak 'oh hi there'"

Alternatively, do this in reverse numerical order.

Re: Ask HN: I want to learn to use the terminal, where do I start

#52

Stop using one of the GUI applications. A good one to start with on mac is probably Finder. Type 'man man' to learn about man pages. Read the pages for 'cd', 'cp', 'rm', 'mv', 'find', 'cat'. Try each one. Move around the filesystem, move or rename some files. That's all a good part of what you'll be doing on the cli.

'ls' is probably the most fundamental command as it let's you list the files in a file system, then 'cd' (move in/out of directories). Then go from there.

for help on 'ls' use either:

ls --help

or

man ls

Re: Ask HN: I want to learn to use the terminal, where do I start

#53
post #18

Aside: zsh is standard on macs now, thanks to Apple's lawyers freaking out over bash license terms. If you want to change to industry standard bash (I did) then there are three ways to do it. Short: csh -s /bin/bash Others: system settings or terminal settings. [1] https://support.apple.com/en-gb/guide/terminal/trml113/mac [2] https://www.howtogeek.com/444596/how-to-change-the-default-s... You may want to update bash…

I was curious as to why someone would prefer bash over zsh i.e. what are the salient differences, and a brief search led me to this thorough answer: https://apple.stackexchange.com/questions/361870/what-are-th... …but I’m still not sure there’s a material difference that would impact me, and I’ve been programming professionally since the mid 90s. If I can ask a side question, why would one switch back to bash from zs…

I prefer bash because I'm more used to it and I feel like zsh gets in the way. One example would be tab completion. When there are multiple matches, zsh will cycle through all possible matches (like cmd.exe, but slightly less annoying). Do Not Want.

Re: Ask HN: I want to learn to use the terminal, where do I start

#54
Personally, I only really got into working at the shell once I started exploring all of the wonderful new programs that people have been writing to make it easy as pie to work with. I ended up collecting them all together into scripts I can `curl | bash` on any new Ubuntu machine: https://github.com/hiAndrewQuinn/shell-bling-ubuntu

Obviously these scripts won't work on Mac. But I do list the programs I install in it right in the README, including what I consider the "Holy Trinity": `rg` (really fast line searching), `fd` (really fast file finding), and `fzf` (best described with examples: see https://andrew-quinn.me/fzf). These all work on my wife's Mac identically to how they work on my own Linux box, and they make the experience of working at a shell much more pleasant.

Second rec: Install fish! https://mmazzarolo.com/blog/2023-11-16-my-fish-shell-setup-o... You can get back to Bash once you've gotten used to using the shell and find a reason to. Fish is much more pleasant, IMO, and I try to use it wherever I can these days.

And final rec: If you really want to learn the command line, you will be very well served by investing a few weeks into Vim - vanilla Vim, not the LazyVim Shell Bling Ubuntu installs. Athletes talk about mind-body connection; devs should be aware of terminal-editor connection. When you can confidently open up, make a small edit, and close a text file right in the same terminal you're doing other things in, your fluency will improve greatly, and `vim` is probably the most portable set of keyboard shortcuts you will ever learn for doing just that.

Re: Ask HN: I want to learn to use the terminal, where do I start

#55
Hey macterminalnewb,

It's great to see your interest in learning to use the terminal. It's a powerful tool that can significantly improve your efficiency once you get the hang of it. Here are a few resources that you might find useful:

1. Codecademy's Learn the Command Line Course: It's an interactive course that covers the basics of command-line interfaces (CLI). It's beginner-friendly and allows you to practice as you learn.

2. Learn Enough Command Line to Be Dangerous: This is a part of the 'Learn Enough to Be Dangerous' series by Michael Hartl. It's a great resource for beginners and covers the basics and beyond.

3. OverTheWire's Bandit Wargame: This is a fun and engaging way to learn terminal commands. It's a series of capture-the-flag style challenges where you use terminal commands to solve puzzles.

4. man pages: Don't forget about the built-in manual pages in the terminal. You can access them by typing 'man' followed by the command you want to learn about. They can be a bit hard to read at first, but they're incredibly detailed and useful once you get used to them.

5. Practice: The best way to get comfortable with the terminal is to use it regularly. Try to incorporate it into your daily workflow as much as possible. Even simple tasks like navigating directories or managing files can be good practice.

Remember, like any other skill, it takes time and practice to become proficient at using the terminal. Don't get discouraged if it feels overwhelming at first. Stick with it, and you'll get there.

Post reply on HN