Generate Random Manpages To Learn Linux

แชร์
ฝัง
  • เผยแพร่เมื่อ 16 ต.ค. 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

    • @DistroTube
      @DistroTube  4 ปีที่แล้ว +2

      Glad you enjoyed it!

  • @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 😂

  • @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

  • @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.

  • @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

  • @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.

  • @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.

  • @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!

  • @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

  • @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.

  • @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

  • @joaorsbatista
    @joaorsbatista 4 ปีที่แล้ว +1

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

  • @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.

  • @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

  • @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)

  • @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.

  • @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

  • @librequestpodcast
    @librequestpodcast 4 ปีที่แล้ว +2

    What a fantastic idea! Very cool!

    • @DistroTube
      @DistroTube  4 ปีที่แล้ว +2

      Thanks! Much appreciated. :D

  • @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

  • @derpaderpaderpader
    @derpaderpaderpader 4 ปีที่แล้ว +1

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

  • @kalekold
    @kalekold 4 ปีที่แล้ว +1

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

  • @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.

  • @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

  • @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

  • @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

  • @manou1409
    @manou1409 4 ปีที่แล้ว +1

    Let's do a #100daysOfManPages hashtag on Twitter

  • @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

  • @MorsMeld
    @MorsMeld 4 ปีที่แล้ว +1

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

  • @fish830911
    @fish830911 4 ปีที่แล้ว

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

  • @n0kodoko143
    @n0kodoko143 4 ปีที่แล้ว +1

    Awesome idea! Brain upload commencing.

  • @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

  • @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!

  • @trailblazingfive
    @trailblazingfive 4 ปีที่แล้ว

    DT what's the best source for learning bash?

  • @torspedia
    @torspedia 4 ปีที่แล้ว

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

  • @_yuri
    @_yuri 4 ปีที่แล้ว +1

    i really enjoyed this video thanks dt

    • @DistroTube
      @DistroTube  4 ปีที่แล้ว +1

      Appreciate that!

  • @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`

    • @baovu3488
      @baovu3488 4 ปีที่แล้ว

      Thank you

  • @stumbling
    @stumbling 4 ปีที่แล้ว +5

    shuf -n1

  • @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

  • @parthhanda6828
    @parthhanda6828 4 ปีที่แล้ว

    Amazing video.

  • @CaribouDataScience
    @CaribouDataScience 5 หลายเดือนก่อน

    Very nice.

  • @Shvmadogg
    @Shvmadogg 4 ปีที่แล้ว

    Can you make a video about LFS?

  • @urugulu1656
    @urugulu1656 4 ปีที่แล้ว

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

  • @leo-rq2ei
    @leo-rq2ei 4 ปีที่แล้ว

    Cool stuff

  • @pichass9337
    @pichass9337 4 ปีที่แล้ว +1

    nice thumbnail

  • @myhandlehasbeenmishandled
    @myhandlehasbeenmishandled 4 ปีที่แล้ว +4

    10 seconds in and I've already upvoted

  • @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.

  • @Alon_Balon
    @Alon_Balon 4 ปีที่แล้ว +1

    the most manly way to learn linux

  • @twb0109
    @twb0109 4 ปีที่แล้ว

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

  • @gaweyn
    @gaweyn 4 ปีที่แล้ว +1

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

  • @ezio934
    @ezio934 4 ปีที่แล้ว

    Everybody gangsta till bash man page appears....

  • @cecilcostanza9221
    @cecilcostanza9221 3 ปีที่แล้ว

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

  • @christbaumer
    @christbaumer 4 ปีที่แล้ว

    Who run the man? Worlds.

  • @BleibelEmil
    @BleibelEmil 4 ปีที่แล้ว +1

    Second

  • @usrname1105
    @usrname1105 4 ปีที่แล้ว +1

    FiRsT

  • @_R8x_
    @_R8x_ 4 ปีที่แล้ว +1

    DT mansplaining, Thumbs down and unsubbed 🙃

  • @xtrailz
    @xtrailz 4 ปีที่แล้ว +1

    This video is so sexist

  • @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.