Write A Script To Search the Arch Wiki (OFFLINE!)

  Рет қаралды 16,578

DistroTube

DistroTube

2 жыл бұрын

Every few weeks, I get the sudden urge to do some bash scripting. Today, I'm going to create a simple bash script that uses dmenu to search an offline copy of the Arch Wiki. Follow along with me, and we should be able to knock this script out in under 30 minutes.
REFERENCED:
► archlinux.org/packages/commun...
► gitlab.com/dwt1/dmscripts
WANT TO SUPPORT THE CHANNEL?
💰 Patreon: / distrotube
💳 Paypal: kzfaq.info?even...
🛍️ Amazon: amzn.to/2RotFFi
👕 Teespring: teespring.com/stores/distrotube
DONATE CRYPTO:
💰 Bitcoin: 1Mp6ebz5bNcjNFW7XWHVht36SkiLoxPKoX
🐶 Dogecoin: D5fpRD1JRoBFPDXSBocRTp8W9uKzfwLFAu
📕 LBC: bMfA2c3zmcLxPCpyPcrykLvMhZ7A5mQuhJ
DT ON THE WEB:
🕸️ Website: distrotube.com/
📁 GitLab: gitlab.com/dwt1
🗨️ Mastodon: fosstodon.org/@distrotube
👫 Reddit: / distrotube
📽️ LBRY/Odysee: odysee.com/@DistroTube:2
FREE AND OPEN SOURCE SOFTWARE THAT I USE:
🌐 Brave Browser - brave.com/dis872
📽️ Open Broadcaster Software: obsproject.com/
🎬 Kdenlive: kdenlive.org
🎨 GIMP: www.gimp.org/
💻 VirtualBox: www.virtualbox.org/
🗒️ Doom Emacs: github.com/hlissner/doom-emacs
Your support is very much appreciated. Thanks, guys!

Пікірлер: 75
@eyssewieringa2084
@eyssewieringa2084 2 жыл бұрын
Nice video! So I'm using rofi as an alternative to dmenu. Could I just replace dmenu with rofi (with the proper flags of course) without it breaking?
@DistroTube
@DistroTube 2 жыл бұрын
Yep, 'dmscripts' is designed with a config file that sets a bunch of variables, one of them is DMENU="dmenu -i -l 20 -p". Change the DMENU variable to the appropriate 'rofi' command and you are all set.
@eyssewieringa2084
@eyssewieringa2084 2 жыл бұрын
@@DistroTube Oh that's amazing. Thanks!
@rasix86
@rasix86 2 жыл бұрын
It's even easier... create a symlink from rofi to dmenu and rofi will magically use dmenu mode when called via stdin (there even is an AUR package for this)
@Miguel_GM
@Miguel_GM 2 жыл бұрын
I love this bash scripts videos. When I watch them i like to chalenge myself and try to solve it before you do, and I always learn something new. Keep it up!
@DistroTube
@DistroTube 2 жыл бұрын
To be honest, I always learn something myself...which is why I like to do these! :D
@RichardBronosky
@RichardBronosky 2 жыл бұрын
I can't believe the wiki docs is available as a package. I LOVE Arch! Nothing else could have pulled me away from macOS. ☮️❤️🌈🧘🏽
@yousefkhaled2
@yousefkhaled2 2 жыл бұрын
i love those scripting videos cuz i try to solve problems before u do and i learn alot
@Ohmygodzilla
@Ohmygodzilla Жыл бұрын
This is pure pleasure to watch, thanks once again DT!
@random_monster
@random_monster 2 жыл бұрын
27:48 , Sort from "a" or "A". Starting from numbers look like some kind of temp or cache files. Put the lines which are start from numbers to the bottom it will improve the overall look and feel.
@muddyexport5639
@muddyexport5639 2 жыл бұрын
Thanks. I always look forward to the BASH projects. Good review and I always get an idea or learn something that I can employ down the road. I like the GNU tools version to "Git er done" with the available, free utilities.
@WaySensei
@WaySensei Жыл бұрын
I love this! Thanks for walking us through how to write a useful shell script!
@Cybugs4711
@Cybugs4711 2 жыл бұрын
Great channel. I always learn something new! In this one I'm more interested in the tool you use to show suggestions for console commands.
@keylowmike85
@keylowmike85 2 жыл бұрын
Nice work. Bash scripting is something that I need to brush up on.
@morgs123456able
@morgs123456able 2 жыл бұрын
Thank you for all your videos, they really helped me to get a better understanding of everything Linux. Greetings from Germany
@dougtilaran3496
@dougtilaran3496 2 жыл бұрын
When you want to dig DEEP. Dt and Erik are the best of the best
@MrTomro
@MrTomro 2 жыл бұрын
i love these bash scripting videos
@folksurvival
@folksurvival 2 жыл бұрын
The channel bugswriter has many good ones.
@tlast7089
@tlast7089 2 жыл бұрын
Nice video :) also find includes a printf command, you can print basenames with it
@apoorv9492
@apoorv9492 2 жыл бұрын
Hey DT, a quick tip at 8:20 you open another script and copy some lines that you use in all your scripts. Instead of that you can create a yasnippet snippet and just add a keybinding to add that snippet anywhere you want. You can also make a yasnippet snippet prompt you for certain things when you insert it, like in this case you change the description, dependencies and all.
@elfo1799
@elfo1799 2 жыл бұрын
Thank u and greetings from France !
@DistroTube
@DistroTube 2 жыл бұрын
Thanks for the thanks! :D
@AeriaVelocity
@AeriaVelocity 2 жыл бұрын
Thanks Derek, very cool
@DistroTube
@DistroTube 2 жыл бұрын
Glad you liked it!
@gammafelikx
@gammafelikx 2 жыл бұрын
Love the shirt. Nice video also.
@JakeLinux
@JakeLinux 2 жыл бұрын
Hey DT great minds and all, I did a video on this a while ago, just not with dmenu, and I used awman. Great vid.
@DistroTube
@DistroTube 2 жыл бұрын
Nice 👍
@dougtilaran3496
@dougtilaran3496 2 жыл бұрын
Super coolness. Sadly, the Arch wiki is the only one that is near excellence.Debians is OK...sorta...but you have to search the POS with Goofle to find anything. I miss Ian
@swanandmodak6666
@swanandmodak6666 2 жыл бұрын
I am afraid you havent read the Gentoo wiki
@elfo1799
@elfo1799 2 жыл бұрын
@@swanandmodak6666 pretty sure he did not.
@dougtilaran3496
@dougtilaran3496 2 жыл бұрын
@@swanandmodak6666 I'm afraid TO read it. I might like it...at almost 70 not sure I'd be alive when it was finally configurated
@farzadmf
@farzadmf 2 жыл бұрын
Nice video (as usual). I think we could have used `basename` instead of `cut` to get the file name from the full path
@DistroTube
@DistroTube 2 жыл бұрын
Great point!
@Linuxdirk
@Linuxdirk 2 жыл бұрын
Also bash string substitution instead of sed to replace the underscores.
@carecavoador
@carecavoador 2 жыл бұрын
Hey DT. It's not much, but I wanted you to know that I learn A LOT with your videos. Great stuff, man. Thank you so much for your time.
@alienforce7688
@alienforce7688 2 жыл бұрын
Please make more videos like this one 👍
@maskedredstonerproz
@maskedredstonerproz 2 жыл бұрын
is that Kate Bacon merch you're wearing DT?? nice
@giulianotaormina5692
@giulianotaormina5692 2 жыл бұрын
Nice idea! Very useful, specially if you have a bad time with your wi-fi, but, I have a question: does wikidocs actually is an array? I think it is only an string... but I'm not sure.
@valentin-catalin1859
@valentin-catalin1859 2 жыл бұрын
find * would also work to get rid off ./ Edge case being hidden files but are not present in this particular case.
@francoissevestre3893
@francoissevestre3893 2 жыл бұрын
Find give you a list, you make it an array and then again a list with printf. Nice idea tho, super usefull.
@evildragon1774
@evildragon1774 2 жыл бұрын
What kind of keyboard switch you use? Its sound very neat
@killistan
@killistan 2 жыл бұрын
Do any Arch based distro's actually move /usr/bin/bash to somewhere other than /usr/bin? I grant it that saner distros use /bin/bash instead, but most of these scripts you make are fairly Arch specific... why the /usr/bin/env indirection? (saner here means, the one's that do what I prefer. I certainly have my biases ;)
@sbr895
@sbr895 2 жыл бұрын
Hey DT. First thank you for this amazing script. It helps me to learn more about linux! Just I have one problem: I used to use dark reader extension for the web browsers but in this script this extension doesn't work and the the browser open up with a blinding white background. Is there a solution for this problem?
@gocomputing8529
@gocomputing8529 2 жыл бұрын
You could use the LANG variable so the user could use the script with no change. Of course, you would need to check if the variable is set and the language is available in the wiki. If not, you could use english as default
@littlek3000
@littlek3000 2 жыл бұрын
im confused, did something get updated, is the server down? i cant find arch-wiki-docs in pacman, i can in yay, but why not pacman?
@someonestolemyname
@someonestolemyname 2 жыл бұрын
How does 11:40 work? I thought you need brackets without quotes to make an array.
@gert9537
@gert9537 2 жыл бұрын
I downloaded the arch-wiki-doc like you did in the video (sudo pacman -S arch-wiki-docs) , and I did get the html but NOT the text directory ? how do I get that ?
@DistroTube
@DistroTube 2 жыл бұрын
Actually, I didn't open the "text" directory on camera. Looking at it now...I see two files. One is "index" and the other is "arch-wiki.txt.gz". I think the arch-wiki text archive was created by another program that I have installed called "arch-wiki-lite". It creates that archive and you can search it at the command line with : wiki-search string
@lkzMini
@lkzMini 2 жыл бұрын
Can i ask for any AUDIO specify video? maybe EQ? Noise reduction, etc? Im using easyeffects, Manjaro GNOME + LTS Kernel + Pipewire
@adrymateoramon7087
@adrymateoramon7087 Жыл бұрын
❤❤❤
@unicorn_tamer
@unicorn_tamer 2 жыл бұрын
Why use ```#!/usr/bin/env bash``` instead of ```#!/bin/sh``` ? Also great video! This script will probably be really useful to me in the future.
@DistroTube
@DistroTube 2 жыл бұрын
/bin/sh =/= bash. /bin/sh is a symlink to your system's default shell (which is bash for most people, but not all).
@user-he4ef9br7z
@user-he4ef9br7z 2 жыл бұрын
/bin/sh is supposed to point to a POSIX compliant shell. Bash is POSIX compliant but is not narrowly POSIX compliant, meaning it implements features that are not in the POSIX standard, like arrays. On most systems /bin/sh points to bash but however, some of us symlink /bin/sh to other shells like dash to gain a speed advantage. Dash is a narrowly POSIX compliant shell i.e. it does not have those extra features like arrays. So using /bin/sh in this script would make it break on some systems. Use /bin/sh in your scripts only if your script doesn't use non-POSIX features (colloquially known as bashisms). There is a program called checkbashisms on Debian and the AUR which lets you know the bashisms used in a script. If you link /bin/sh to dash scripts run around 4 times faster if they are POSIX compliant.
@jabuxas
@jabuxas 2 жыл бұрын
How could I do that in a distro that is not arch? I mean, I cloned the arch-wiki-docs github but how do I execute it to place the things into /usr/share/doc?
@DistroTube
@DistroTube 2 жыл бұрын
I have no idea.. I'd probably ask this question on the arch-wiki-docs GitHub. I'm sure other non-Arch users would be interested in how to get this installed on their distros.
@HontiBe
@HontiBe 2 жыл бұрын
If you also want to search the Arch Wiki, you can get the package from the Arch repository. If not, get what you like. Install/extract the files there, after that you can do basically the same. Good luck.)
@yuvanmichael
@yuvanmichael 2 жыл бұрын
Hey dt! While the script to search arch wiki is great. This might not be of any use since you can't run it on a command line. And archinstall is better. Why would existing arch users need this when they would usually have a web browser installed? Still, pretty cool program though.
@nathanmiddleton1478
@nathanmiddleton1478 2 жыл бұрын
idk who "we" are but "we" always called it a "hashbang" since "#" is a hash "!" is a bang! :) And I like this idea, didn't know you could download the wiki through pacman tbh just always used a firefox smart search and also have a simple bash script that will accomplish the same. My default for HTML files is actually text editor since local html files should typically open in an editor IMO. Wouldn't the BROWSER environment variable be the typcial thing to look for to be portable?
@DistroTube
@DistroTube 2 жыл бұрын
hashbang, crunchbang, shebang...po-TAE-toe...po TAH-toe. :D
@maskedredstonerproz
@maskedredstonerproz 2 жыл бұрын
I agree for that with HTML files, if you're on a normal operating system, but if you're on windows you can't have that, since opening them up for preview will be a pain in the butt
@knoopx
@knoopx 2 жыл бұрын
now port it to nushell :)
@Fareke2
@Fareke2 2 жыл бұрын
Probably you want web browser in dependecies comment.
@emacsking4310
@emacsking4310 2 жыл бұрын
Hey DT. Would you like some help managing DTOS? I have alot of time on my hands and would love to help manage DTOS so you wouldn't have to worry about Gitlab issues, pull requests, etc as much (I am not a troll either :D). No pressure if you don't want something like that, I understand completely.
@DistroTube
@DistroTube 2 жыл бұрын
I'll take any help I can get! :D
@brandleesee
@brandleesee 2 жыл бұрын
I would have called it dm-rtmf but it might be construed as offensive! @DT thank you for these instructional videos. My only concern is that these may not attract the wished volume of views thereby become unprofitable to continue such productions. I write so as an appeal to carry on with these type of videos as long as you can. Thank you once again.
@alt2458
@alt2458 2 жыл бұрын
Are you been serious now? And then you complain about "bloat" but you download the full wiki in several languages and multiple formats, just to do this script.
@user-he4ef9br7z
@user-he4ef9br7z 2 жыл бұрын
Storing things locally is anti-bloat. Now you can look up stuff even when you don't have internet. I have the entire CTAN Texlive documentation stored locally. Same concept behind manpages.
@alt2458
@alt2458 2 жыл бұрын
@@user-he4ef9br7z Anti-Bloat? Dunno, Linux users are weird, they call anything bloat based on size. But here DT seams to have no problem at all adding a several mb package to the updates just to have this plugin working.
@user-he4ef9br7z
@user-he4ef9br7z 2 жыл бұрын
@@alt2458 Bloat has nothing to do with size, bloat is about unnecessary complexity. Unnecessary complexity just happens to coincide with increased size a lot of times. Storing data locally, that's not bloat, that's what disk spaces is for.
@alt2458
@alt2458 2 жыл бұрын
@@user-he4ef9br7z That's what I though too, but he marks some programs as "bloat" because of the size. I agree, size shouldn't matter at all. I agree more with your definition of what bloat is.
@AndersJackson
@AndersJackson 2 жыл бұрын
You could use `pwd` $(pwd) or $PWD to get the current working directory in 6:30 instead of "."
@maskedredstonerproz
@maskedredstonerproz 2 жыл бұрын
he knows, he just probably couldn't remember it
@seventhgreeter5416
@seventhgreeter5416 2 жыл бұрын
ls -I *.html would hae ben faster, right?
@itsfish8672
@itsfish8672 2 жыл бұрын
GVDT.
Want A List Of Your Keybindings? Write A Shell Script!
27:11
DistroTube
Рет қаралды 24 М.
Shell Aliases Every Linux User Needs
29:03
DistroTube
Рет қаралды 37 М.
Schoolboy - Часть 2
00:12
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 4,1 МЛН
Clown takes blame for missing candy 🍬🤣 #shorts
00:49
Yoeslan
Рет қаралды 48 МЛН
How Many Balloons Does It Take To Fly?
00:18
MrBeast
Рет қаралды 206 МЛН
The 5 Things That Taught Me The Most About Linux
18:41
DistroTube
Рет қаралды 93 М.
Bash Scripting - Variables, Arrays, If-Then-Else
38:52
DistroTube
Рет қаралды 46 М.
Essential Keybindings For Bash, Fish and Zsh
16:41
DistroTube
Рет қаралды 28 М.
~/.dotfiles in 100 Seconds
13:54
Fireship
Рет қаралды 413 М.
Is The Unix Philosophy Still Important?
18:02
DistroTube
Рет қаралды 32 М.
Why Use The Terminal Instead of GUI Apps?
23:40
DistroTube
Рет қаралды 45 М.
Linux Gaming Setup Script
2:32:14
Titus Tech Talk
Рет қаралды 26 М.
Getting Started With Git and GitLab
24:34
DistroTube
Рет қаралды 41 М.
Why Do Bubbles Form In Glasses Of Water?
12:33
Joe Scott
Рет қаралды 38 М.
Rate This Smartphone Cooler Set-up ⭐
0:10
Shakeuptech
Рет қаралды 6 МЛН
Сколько реально стоит ПК Величайшего?
0:37
Как бесплатно замутить iphone 15 pro max
0:59
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 8 МЛН
Лучший браузер!
0:27
Honey Montana
Рет қаралды 1,1 МЛН
Tag him😳💕 #miniphone #iphone #samsung #smartphone #fy
0:11
Pockify™
Рет қаралды 4,2 МЛН