Generate Random Manpages To Learn Linux

Sdílet
Vložit
  • čas přidán 27. 08. 2024

Komentáře • 101

  • @AtomToast
    @AtomToast Před 4 lety +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 Před 4 lety

      👍

    • @rharrington8669
      @rharrington8669 Před 4 lety +15

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

    • @urugulu1656
      @urugulu1656 Před 4 lety +5

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

    • @AtomToast
      @AtomToast Před 4 lety

      @@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 Před 4 lety

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

  • @_hypedad
    @_hypedad Před 4 lety +13

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

  • @daviddupoise6443
    @daviddupoise6443 Před 4 lety +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

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

  • @polyrtm5545
    @polyrtm5545 Před 4 lety +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 Před 4 lety

      Could a .tar file be in that directory?

    • @polyrtm5545
      @polyrtm5545 Před 4 lety

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

  • @gimcrack555
    @gimcrack555 Před 4 lety +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.

  • @einsteinwallah2
    @einsteinwallah2 Před 4 lety

    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

  • @kalekold
    @kalekold Před 4 lety +1

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

  • @sambranisa6500
    @sambranisa6500 Před 4 lety +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

  • @AnzanHoshinRoshi
    @AnzanHoshinRoshi Před 4 lety

    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 Před 4 lety +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  Před 4 lety

      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.

  • @KevinBReynolds
    @KevinBReynolds Před 4 lety +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 Před 4 lety +1

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

  • @chronus8037
    @chronus8037 Před 4 lety

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

  • @kellingc
    @kellingc Před 4 lety +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.

  • @konradpowilajtis7003
    @konradpowilajtis7003 Před 4 lety +1

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

  • @librequestpodcast
    @librequestpodcast Před 4 lety +2

    What a fantastic idea! Very cool!

  • @stumbling
    @stumbling Před 4 lety +5

    shuf -n1

  • @BrucesWorldofStuff
    @BrucesWorldofStuff Před 4 lety +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

  • @lagwulf1637
    @lagwulf1637 Před 4 lety

    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 Před 2 lety

      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 Před 4 lety +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

  • @balmar3
    @balmar3 Před 4 lety +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

  • @Sandeep-jb2jp
    @Sandeep-jb2jp Před 4 lety +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 Před 4 lety +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 Před 4 lety

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

  • @SSouper
    @SSouper Před 4 lety +4

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

    • @DistroTube
      @DistroTube  Před 4 lety +2

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

  • @johnstewart3180
    @johnstewart3180 Před 4 lety +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.

  • @peterdauwe7895
    @peterdauwe7895 Před 4 lety +1

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

  • @0xCAFEF00D
    @0xCAFEF00D Před 4 lety

    Great way to understand the nature of bloat as well.

  • @pirateboot6981
    @pirateboot6981 Před 4 lety +2

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

    • @DistroTube
      @DistroTube  Před 4 lety +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.

  • @marwynthemage
    @marwynthemage Před 4 lety

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

  • @SusanAmberBruce
    @SusanAmberBruce Před 4 lety

    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

  • @MorsMeld
    @MorsMeld Před 4 lety +1

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

  • @cornjulio4033
    @cornjulio4033 Před 4 lety

    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.

  • @manou1409
    @manou1409 Před 4 lety +1

    Let's do a #100daysOfManPages hashtag on Twitter

  • @leo-rq2ei
    @leo-rq2ei Před 4 lety

    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

  • @damienw4958
    @damienw4958 Před 4 lety +2

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

    • @DistroTube
      @DistroTube  Před 4 lety +4

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

  • @fish830911
    @fish830911 Před 4 lety

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

  • @fabricio5p
    @fabricio5p Před 4 lety

    Hey DT make a video about touchpad gesture support on linux

  • @jena_thornwyrd
    @jena_thornwyrd Před 4 lety

    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 :)

  • @n0kodoko143
    @n0kodoko143 Před 4 lety +1

    Awesome idea! Brain upload commencing.

  • @Alon_Balon
    @Alon_Balon Před 4 lety +1

    the most manly way to learn linux

  • @urugulu1656
    @urugulu1656 Před 4 lety

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

  • @torspedia
    @torspedia Před 4 lety

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

  • @derpaderpaderpader
    @derpaderpaderpader Před 4 lety +1

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

  • @_yuri
    @_yuri Před 4 lety +1

    i really enjoyed this video thanks dt

  • @myhandlehasbeenmishandled

    10 seconds in and I've already upvoted

  • @ezio934
    @ezio934 Před 4 lety

    Everybody gangsta till bash man page appears....

  • @CaribouDataScience
    @CaribouDataScience Před 3 měsíci

    Very nice.

  • @parthhanda6828
    @parthhanda6828 Před 4 lety

    Amazing video.

  • @Shvmadogg
    @Shvmadogg Před 4 lety

    Can you make a video about LFS?

  • @trailblazingfive
    @trailblazingfive Před 4 lety

    DT what's the best source for learning bash?

  • @yoshihirokoya2783
    @yoshihirokoya2783 Před 4 lety +4

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

    • @polyrtm5545
      @polyrtm5545 Před 4 lety +1

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

  • @pichass9337
    @pichass9337 Před 4 lety +1

    nice thumbnail

  • @leo-rq2ei
    @leo-rq2ei Před 4 lety

    Cool stuff

  • @twb0109
    @twb0109 Před 4 lety

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

  • @cecilcostanza9221
    @cecilcostanza9221 Před 2 lety

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

  • @gaweyn
    @gaweyn Před 4 lety +1

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

  • @christbaumer
    @christbaumer Před 4 lety

    Who run the man? Worlds.

  • @BleibelEmil
    @BleibelEmil Před 4 lety +1

    Second

  • @_R8x_
    @_R8x_ Před 4 lety +1

    DT mansplaining, Thumbs down and unsubbed 🙃

  • @0xREX
    @0xREX Před 4 lety

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

  • @usrname1105
    @usrname1105 Před 4 lety +1

    FiRsT

  • @xtrailz
    @xtrailz Před 4 lety +1

    This video is so sexist

  • @kennymccormic7578
    @kennymccormic7578 Před 4 lety

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