Not that I don’t still love using linux daily, but it is getting a little old having to search for how to do anything even just install a simple program (recently, had a. Deb file to install unifi software that wouldn’t install and had to find a custom script to do it).
I feel like there’s no way I’d ever learn all the random commands I’ve been copying and pasting (and keeping in a text file for later) and can’t help but feel it’s kind of clunky. And I don’t feel like I really know anything of what Im doing. Even man pages baffle me. I’ve been into computing for 20 years but only used linux a little like 8 years ago, but now it’s been my main os on my desktops for probably 2 months. I know, maybe that’s just not long enough. I just don’t like the fact that if I couldn’t search, I’d be completely stuck on a lot of tasks.
A good start is to install
tldr
. You use it likeman
, but it gives you shorter explanations – or rather, a short list of illustrative examples.As for man pages themselves (which I often find overwhelming, too), if you’re not doing that already, you can pipe it into
grep
to extract just those lines that contain your search string:man ps | grep user # or for two lines of context above and below each match: man ps | grep user -C 2
Going further, check out Fish instead of Bash. I haven’t use Fish yet, but it’s said to be much better for learning Linux commands as a beginner. Later on, you may switch to Zsh. In any case, hitting Tab once or twice will often give you a list of possible completions to the command you are typing.
PS: I see no good reason why anyone should downvote this question.
Edit (June 23): As it so happens, just today I’ve stumbled into the O’Reilly book “Classic Shell Scripting” by Robbins and Beebe (ISBN 9780596005955). What can I say – its age notwithstanding, it’s apparently an extremely good book for understanding things and learning how to solve real problems. (It presupposes some familiarity with Unix-like systems and with the shell, so if one’s just starting out, the book “Learning the Unix Operating System” may be better.)
Man pages are displayed in
less
(which acts as the so-called “pager” here), so you can search them interactively like you search inless
. And you do that by pressing/
, then typing your search term and pressingEnter
. Then you can jump between results withn
andShift+n
. This is also how search works invim
, by the way.Perhaps another tip in this regard, to search in your command history with Bash (for re-running a command you’ve previously used), you can press
Ctrl+R
, then start typing your search term. PressingEnter
will run the displayed command. To skip older search results, pressCtrl+R
again. If you want to edit a command before running it, press→
orCtrl+F
instead ofEnter
.This UI is a bit fiddly in Bash, but worth figuring out.
As for Fish, it’s great for new users, because:
Ctrl+R
UI, displaying all the search results interactively and not behaving weirdly in certain situations.→
orCtrl+F
, or only use the next word from it viaAlt+F
. You can skip to older matches with↑
, which is then a proper search likeCtrl+R
in Bash, so not just prefix-matching. And yeah, overall just really useful, because it’ll both make it quicker to run frequently-used commands, and sometimes suggest a complex command which I didn’t even remember that I once ran.But:
Scripting is not a problem, because you can throw a shebang into the first line to use Bash syntax (
#!/bin/sh
or#!/bin/bash
). You should add a shebang to your scripts anyways.And running more complex commands isn’t too big of a deal either, because you can run
bash
in your terminal to launch Bash, then paste the command into there to run it, and then quit back to Fish withexit
orCtrl+D
. Typically you’ll know to runbash
, because Fish’s syntax highlighting turns red after you’ve pasted a complex command.You don’t need to pipe in to grep, use a
/
to search it.Man ps
/user enter
Then use
n
to find the next instance of the search