Generate Random Manpages To Learn Linux

Поделиться
HTML-код
  • Опубликовано: 19 сен 2024

Комментарии • 101

  • @AtomToast
    @AtomToast 4 года назад +53

    You can actually skip all that string manipulation with awk and sed and just give man the path to the man page directly.
    Example would be:
    man $(find /usr/share/man/man1 -type f | shuf | head -1)
    Works just fine

    • @RonnieNissan
      @RonnieNissan 4 года назад

      👍

    • @rharrington8669
      @rharrington8669 4 года назад +15

      Even shorter: man $(find /usr/share/man/man1 -type f | shuf -n1)

    • @urugulu1656
      @urugulu1656 4 года назад +5

      @@rharrington8669 even shorter replace $(...) with ... surrounded by backticks... saves one character

    • @AtomToast
      @AtomToast 4 года назад

      @@urugulu1656 since when is that a thing? Also I wouldn't have expected this but it actually works in POSIX dash? It looked like a bashism at first glance

    • @urugulu1656
      @urugulu1656 4 года назад

      @@AtomToast man what do i know? i literally didnt even care if it will be working on all shells

  • @_hypedad
    @_hypedad 4 года назад +13

    Absolutely fantastic video, awesome high level overview of grep, awk, sed etc. This is great

  • @daviddupoise6443
    @daviddupoise6443 4 года назад +3

    Reading a 'man' page a day is a great idea. Goes well with that first cup of coffee I must say.
    "There is much to be learned" - Carl Sagan

  • @acousticsamurairenditions6897
    @acousticsamurairenditions6897 4 года назад +17

    Got to admit, DT is getting good in this click baity thumbnail stuff...I see Austin powers! That's gotta be interesting 😂

  • @einsteinwallah2
    @einsteinwallah2 4 года назад

    absolutely great video ... serves its purpose well but at the same time it is not a video which just tells you steps without explaining why those steps ... and in the process teaches smattering of scripting ... absolutely great ... if ever there is hall of fame for linux instructional videos this should be in that ... and already high quality comments are here which is a bonus ... thanks for video and comment writers

  • @gimcrack555
    @gimcrack555 4 года назад +11

    I did exactly this. But I used a small script where every time I open my terminal a random Linux command comes up with a description. So add this in your .bashrc
    I called it Cowsay - man flashcards. Just install cowsay to use this small learning script.
    cowsay -f $(ls /usr/share/cowsay/cows | shuf -n 1 | cut -d. -f1) $(whatis $(ls /bin) 2>/dev/null | shuf -n 1)
    I also add many funny cowsay ascii artwork at /usr/share/cowsay/cows just to make it more of a enjoyable learning experience with flashcards of the manpages.

  • @polyrtm5545
    @polyrtm5545 4 года назад +12

    When you use sed with .gz, the . is a special character that means anything, which could mess up with stuff like libgzip (if that exists), which would become liip.

    • @Er-rq7hm
      @Er-rq7hm 4 года назад

      Could a .tar file be in that directory?

    • @polyrtm5545
      @polyrtm5545 4 года назад

      @@Er-rq7hm Well if there was a .tar.gz it would become a .tar.

  • @sambranisa6500
    @sambranisa6500 4 года назад +4

    You should use head before sed and awk, also you shouldnt combine sed and awk :D you should choose one and stick to it during oneliner. :D It would make your command faster. Otherwise amazing video :) thumbs up

  • @kalekold
    @kalekold 4 года назад +1

    You can use `basename` instead of `awk` and `sed`.

  • @AnzanHoshinRoshi
    @AnzanHoshinRoshi 4 года назад

    Thank you, Derek. Although I don't remember much about their details now I read man pages for the first two years or so that I began with Linux. And everytime I use a new program I at least scan the man page.

  • @N0zer0
    @N0zer0 4 года назад +1

    You don't need choices in that final script. You can do shuf before dmenu so if you choose the first item you get a random man page otherwise you can search them.

    • @DistroTube
      @DistroTube  4 года назад

      Great idea! Simplifies things a bit. My original thought was to embed another case statement within the 'Random' case statement, so that when it returns the name of the manpage, if you don't want to read that manpage (you've read it already), then it had the option to rerun the random manpage generator. But I didn't follow through with that idea on video.

  • @kellingc
    @kellingc 4 года назад +1

    Really cool information. A commaand I'd add is apraprose, which gives you commands based the subject you pass as the parameter. Also, the environment variables like MANPATH.

  • @KevinBReynolds
    @KevinBReynolds 4 года назад +1

    Very cool DT. Educational it is. I have saved this to my favorites and will come back to it and learn some more. Thank you very much!

  • @joaorsbatista
    @joaorsbatista 4 года назад +1

    Great teaching/challenge here. Made me learn more about it and I learned about the existence of basename -s :)

  • @chronus8037
    @chronus8037 4 года назад

    Nicely done! This gives us the powerful process of using the command line in a systematic way to shortcut the learning curve of Linux.

  • @konradpowilajtis7003
    @konradpowilajtis7003 4 года назад +1

    Great video Derek, love it.
    i'll definitely try this, thanks for sharing

  • @lagwulf1637
    @lagwulf1637 4 года назад

    Hey DT, thanks for this great, inspiring video. I came across "chem" - a groff preprocessor for producing chemical structure diagrams. Most ppl might not be very interested but as a high school teacher in chemistry and physics I will have a closer look. The syntax of the chemfig-latex-package is quite idiosyncratic (not to say annoying...), so perhaps there is a easier way to do it this minimalistic way. Again: great idea! Let me add an interesting way of handling keyboard answers to shell-scripts. In my book on shell-scripting by the German authors Kania and Wolf they present a great way to press a single key WITHOUT pressing return afterwards.
    They put terminal in a raw mode first and then using dd!! Like this:
    char = ' '
    stty raw -echo
    while [ "$char" !="q" ]
    do
    char =$(dd bs =1 count =1 2>/dev/null)
    done
    stty -raw echo
    Interesting way of 1.) setting tty to a raw mode and 2.) copying stdin to sdr(err)out with dd.
    Nice weeekend everybody!

    • @aonodensetsu
      @aonodensetsu 2 года назад

      read can do that as well, there's a flag that will auto-end after N bytes of input (the flag is -N, for obvious naming purposes)

  • @joegravel2488
    @joegravel2488 4 года назад +1

    thanks
    DistroTube
    great video it show me then i got a long way to go(i am just a noob just start on linux not long ago) thank for sharring your experriance

  • @johnstewart3180
    @johnstewart3180 4 года назад +1

    Why do you use such small text, it is very hard to see on mobile devices and top of that being restricted to max 480p(due to Covid19 lockdown). I would like to request if you could use much bigger text or zoom on specific part during editing.

  • @BrucesWorldofStuff
    @BrucesWorldofStuff 4 года назад +1

    What a interesting idea! Very cool!
    I have strung a few thing together but, wow that was just cool!
    While I know that the Man Pages were made to help work the program, sometimes I wonder what language they are speaking. The one for SpectrWm has my head swimming. I know I looked at your, Linux Dabbler, and OTB latest video and files and still don't get it. No I have not given up, me and that .config is going to get along one way or another... Lol
    Thanks DT for the video!
    LLAP

  • @librequestpodcast
    @librequestpodcast 4 года назад +2

    What a fantastic idea! Very cool!

    • @DistroTube
      @DistroTube  4 года назад +2

      Thanks! Much appreciated. :D

  • @Sandeep-jb2jp
    @Sandeep-jb2jp 4 года назад +2

    instead of `man shuf` try `tldr shuf`
    Infact use `tldr` instead of `man`. for a quick usage lookup
    Install tldr in mac with `brew install tldr`

  • @ImOutaTime
    @ImOutaTime 4 года назад +1

    Hey there I am a big fan. I was just wondering what is your tool of choice for making notes. I am finding writing notes more and more important in my day to day work. I have seen mention of inkdrop app and Joplin. Is there any you would recommend. I don't mind paying if it's a good service

    • @asdfkjhlk34
      @asdfkjhlk34 4 года назад

      Sunny Purewal evil mode +emacs org mode
      Or
      Vim wikis
      Or
      Vim org mode plugin

  • @SSouper
    @SSouper 4 года назад +4

    wouldn't the command run faster if you put the head command after the shuf?

    • @DistroTube
      @DistroTube  4 года назад +2

      Possibly. We should have timed it on the video. Ah! Oh well, next time maybe. :D

  • @stumbling
    @stumbling 4 года назад +5

    shuf -n1

  • @balmar3
    @balmar3 4 года назад +1

    Re: removing the .gz around 6:00, bash parameter expansion can also be super useful, e.g. ${i%.*} gives you the filename stored in variable i but without the extension. www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html

  • @cornjulio4033
    @cornjulio4033 4 года назад

    That's very nice. Yet again, I can't use it via putty (error "cannot open display") . Cannot switch to full-on linux. But I could not live without a close Linux box.

  • @marwynthemage
    @marwynthemage 4 года назад

    You could also use something like this instead:
    man -l $(find /usr/share/man/man1/ -type f | shuf -n 1)
    Just read the manpage!

  • @peterdauwe7895
    @peterdauwe7895 4 года назад +1

    And they say learning and fun are opposites!!!! How wrong can they be. Thanks Derek

  • @leo-rq2ei
    @leo-rq2ei 4 года назад

    Curious, im getting this with termite
    (termite:263210): GLib-WARNING **: 11:05:53.078: GChildWatchSource: Exit status of a child process was requested but ECHILD was received by waitpid(). See the documentation of g_child_watch_source_new() for possible causes

  • @SusanAmberBruce
    @SusanAmberBruce 4 года назад

    I have raspbian lite on a pi-zero-w and I wondered how to get X window capability for stuff like dmenu? I don't want to install the full desktop as that kind of defeats the object hereof learning Linux

  • @jena_thornwyrd
    @jena_thornwyrd 4 года назад

    Thank you Derek, that was a very cool vid, I tried to solve the problems
    along the way by pausing the vid and finding solutions by myself, that
    was very educational :)
    For the random:
    man -k . | awk '{print $1}' | shuf -n 1
    work too :)

  • @pirateboot6981
    @pirateboot6981 4 года назад +2

    Hey, DT, what about 'cut' instead of 'awk' here or there's some problems with 'cut'?

    • @DistroTube
      @DistroTube  4 года назад +2

      I could have achieved the same result in a thousand different ways. So you could use 'cut'. I'm not sure that the best option wouldn't be to just use awk because it can 'cut' for us and it could also do that 'sed' command for us, but I wanted to show a basic usage of 'sed' also in this video so that's why I went that direction.

  • @MorsMeld
    @MorsMeld 4 года назад +1

    Why does learning cool command line stuff with DT never feel like a chore?

  • @damienw4958
    @damienw4958 4 года назад +2

    What is the advantage of using xargs over 'man $(command)'?

    • @DistroTube
      @DistroTube  4 года назад +4

      The advantage for me to use 'xargs' was to highlight another command in the video. :D

  • @0xCAFEF00D
    @0xCAFEF00D 4 года назад

    Great way to understand the nature of bloat as well.

  • @fabricio5p
    @fabricio5p 4 года назад

    Hey DT make a video about touchpad gesture support on linux

  • @n0kodoko143
    @n0kodoko143 4 года назад +1

    Awesome idea! Brain upload commencing.

  • @fish830911
    @fish830911 4 года назад

    Why the number of outcome generated by `man -k .` and find command on man1 directory are different?

  • @urugulu1656
    @urugulu1656 4 года назад

    xargs is unneccesary adding man in the beginning and surrounding the whole thing with backticks is way easier

  • @_yuri
    @_yuri 4 года назад +1

    i really enjoyed this video thanks dt

  • @derpaderpaderpader
    @derpaderpaderpader 4 года назад +1

    As a noob-ish, idiot-savant type of Linux user, that thumbnail made me laugh quite audibly

  • @torspedia
    @torspedia 4 года назад

    I take it that we can save the bash script as an alias?

  • @parthhanda6828
    @parthhanda6828 4 года назад

    Amazing video.

  • @manou1409
    @manou1409 4 года назад +1

    Let's do a #100daysOfManPages hashtag on Twitter

  • @CaribouDataScience
    @CaribouDataScience 4 месяца назад

    Very nice.

  • @myhandlehasbeenmishandled
    @myhandlehasbeenmishandled 4 года назад +4

    10 seconds in and I've already upvoted

  • @Shvmadogg
    @Shvmadogg 4 года назад

    Can you make a video about LFS?

  • @trailblazingfive
    @trailblazingfive 4 года назад

    DT what's the best source for learning bash?

  • @leo-rq2ei
    @leo-rq2ei 4 года назад

    Cool stuff

  • @twb0109
    @twb0109 4 года назад

    Nobody uses xfce4-terminal xD(I switched from gnome-terminal idkw)

  • @Alon_Balon
    @Alon_Balon 4 года назад +1

    the most manly way to learn linux

  • @ezio934
    @ezio934 4 года назад

    Everybody gangsta till bash man page appears....

  • @yoshihirokoya2783
    @yoshihirokoya2783 4 года назад +4

    About regexp 's/.gz$//' or 's/\.gz//' might be better. Indeed, your script may lost pigz.

    • @polyrtm5545
      @polyrtm5545 4 года назад +1

      Yeah. His regex could turn something like libgzip into something like liip.

  • @pichass9337
    @pichass9337 4 года назад +1

    nice thumbnail

  • @cecilcostanza9221
    @cecilcostanza9221 3 года назад

    lol I wish I started using my computer more wisely 20 years ago. I miss information

  • @gaweyn
    @gaweyn 4 года назад +1

    8:23 be a man, but don't do the "man on man"

  • @christbaumer
    @christbaumer 4 года назад

    Who run the man? Worlds.

  • @BleibelEmil
    @BleibelEmil 4 года назад +1

    Second

  • @_R8x_
    @_R8x_ 4 года назад +1

    DT mansplaining, Thumbs down and unsubbed 🙃

  • @xtrailz
    @xtrailz 4 года назад +1

    This video is so sexist

  • @usrname1105
    @usrname1105 4 года назад +1

    FiRsT

  • @0xREX
    @0xREX 4 года назад

    You need some rest man... You look fucking tired...

  • @kennymccormic7578
    @kennymccormic7578 4 года назад

    Why there is no feman pages? I am a woman, and I feel discriminated against.