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
@@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
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
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.
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.
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
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.
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.
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.
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.
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!
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
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.
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
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
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
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.
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
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
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 :)
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.
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
👍
Even shorter: man $(find /usr/share/man/man1 -type f | shuf -n1)
@@rharrington8669 even shorter replace $(...) with ... surrounded by backticks... saves one character
@@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
@@AtomToast man what do i know? i literally didnt even care if it will be working on all shells
Absolutely fantastic video, awesome high level overview of grep, awk, sed etc. This is great
Glad you enjoyed it!
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
Got to admit, DT is getting good in this click baity thumbnail stuff...I see Austin powers! That's gotta be interesting 😂
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
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.
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.
Could a .tar file be in that directory?
@@Er-rq7hm Well if there was a .tar.gz it would become a .tar.
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
You can use `basename` instead of `awk` and `sed`.
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.
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.
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.
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.
Thank you, sir.
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!
Great teaching/challenge here. Made me learn more about it and I learned about the existence of basename -s :)
Nicely done! This gives us the powerful process of using the command line in a systematic way to shortcut the learning curve of Linux.
Great video Derek, love it.
i'll definitely try this, thanks for sharing
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!
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)
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
Thanks! :D
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.
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
What a fantastic idea! Very cool!
Thanks! Much appreciated. :D
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`
Thank you
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
Sunny Purewal evil mode +emacs org mode
Or
Vim wikis
Or
Vim org mode plugin
wouldn't the command run faster if you put the head command after the shuf?
Possibly. We should have timed it on the video. Ah! Oh well, next time maybe. :D
shuf -n1
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
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.
You could also use something like this instead:
man -l $(find /usr/share/man/man1/ -type f | shuf -n 1)
Just read the manpage!
And they say learning and fun are opposites!!!! How wrong can they be. Thanks Derek
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
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
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 :)
Hey, DT, what about 'cut' instead of 'awk' here or there's some problems with 'cut'?
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.
Why does learning cool command line stuff with DT never feel like a chore?
What is the advantage of using xargs over 'man $(command)'?
The advantage for me to use 'xargs' was to highlight another command in the video. :D
Great way to understand the nature of bloat as well.
Hey DT make a video about touchpad gesture support on linux
Awesome idea! Brain upload commencing.
Why the number of outcome generated by `man -k .` and find command on man1 directory are different?
xargs is unneccesary adding man in the beginning and surrounding the whole thing with backticks is way easier
i really enjoyed this video thanks dt
Appreciate that!
As a noob-ish, idiot-savant type of Linux user, that thumbnail made me laugh quite audibly
I take it that we can save the bash script as an alias?
Amazing video.
Let's do a #100daysOfManPages hashtag on Twitter
Very nice.
10 seconds in and I've already upvoted
Can you make a video about LFS?
DT what's the best source for learning bash?
Cool stuff
Nobody uses xfce4-terminal xD(I switched from gnome-terminal idkw)
the most manly way to learn linux
Everybody gangsta till bash man page appears....
About regexp 's/.gz$//' or 's/\.gz//' might be better. Indeed, your script may lost pigz.
Yeah. His regex could turn something like libgzip into something like liip.
nice thumbnail
lol I wish I started using my computer more wisely 20 years ago. I miss information
8:23 be a man, but don't do the "man on man"
Who run the man? Worlds.
Second
Confirmed.
DT mansplaining, Thumbs down and unsubbed 🙃
This video is so sexist
FiRsT
Confirmed.
You need some rest man... You look fucking tired...
Why there is no feman pages? I am a woman, and I feel discriminated against.