You are not logged in.

#1 2014-05-17 19:21:42

Efka
Member
From: Klaipeda
Registered: 2014-04-27
Posts: 113
Website

SOLVED wiki search in terminal

Hey, i know its been covered somewhere how to set up but i cant find ( searching for few hours now ). i found only long version using dig and million other letters , but is much sorter way typing "wiki foo " and gives u answer. its trough dns server, and need to set up mysql and few more bits.
p.s do not get mistaken, im not looking for wiki docs smile
Thanks smile

Last edited by Efka (2014-05-17 23:52:03)


IBM Lenovo ThinkPad T61 ; Lenovo ThinkPad X220; Lenovo ThinkPad T440p; Lenovo Thinkpad W520; Lenovo Thinkpad P71; ThinkPad X1 Yoga Gen1;  FrankenPad T25
Asus Z10PE D-16 WS; 2x Intel Xeon E-5 2690V4; 256GB ECC; nVidia Titan V CEO; Intel Core Ultra 7 265K Gigabyte Z890M Gaming X Klevv 7200Mhz 32GB

Offline

#2 2014-05-17 19:23:42

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: SOLVED wiki search in terminal

sudo pacman -S surfraw
sr archwiki surfraw


Moving to NC...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2014-05-17 19:29:40

Efka
Member
From: Klaipeda
Registered: 2014-04-27
Posts: 113
Website

Re: SOLVED wiki search in terminal

jasonwryan wrote:
sudo pacman -S surfraw
sr archwiki surfraw


Moving to NC...

sorry, thats where i thought i was typing this... sorry again, too many tabs hmm

p.s quick edit ...i need link where it was complete guide ( step by step ) ..  newbie style.
by the way , thanks for this as well smile

Last edited by Efka (2014-05-17 19:36:00)


IBM Lenovo ThinkPad T61 ; Lenovo ThinkPad X220; Lenovo ThinkPad T440p; Lenovo Thinkpad W520; Lenovo Thinkpad P71; ThinkPad X1 Yoga Gen1;  FrankenPad T25
Asus Z10PE D-16 WS; 2x Intel Xeon E-5 2690V4; 256GB ECC; nVidia Titan V CEO; Intel Core Ultra 7 265K Gigabyte Z890M Gaming X Klevv 7200Mhz 32GB

Offline

#4 2014-05-17 19:35:47

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: SOLVED wiki search in terminal

or

function archwiki() {
	S="$@"
	dwb  "https://wiki.archlinux.org/index.php?title=Special%3ASearch&search=${S// /+}&go=Go"
}

replace dwb by your browser of choice.

You may also link using "lynx --dump" in place of the browser, then adding to the end of that line "| less":

function archwiki() {
	S="$@"
	lynx --dump "https://wiki.archlinux.org/index.php?title=Special%3ASearch&search=${S// /+}&go=Go" | less
}

Last edited by Trilby (2014-05-17 23:15:26)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#5 2014-05-17 19:39:00

Efka
Member
From: Klaipeda
Registered: 2014-04-27
Posts: 113
Website

Re: SOLVED wiki search in terminal

Trilby it was different way ..  "dig +short txt <keyword>.wp.dg.cx" like this but is shorter just only wiki <keywor> only ( if my memory does not lie )


IBM Lenovo ThinkPad T61 ; Lenovo ThinkPad X220; Lenovo ThinkPad T440p; Lenovo Thinkpad W520; Lenovo Thinkpad P71; ThinkPad X1 Yoga Gen1;  FrankenPad T25
Asus Z10PE D-16 WS; 2x Intel Xeon E-5 2690V4; 256GB ECC; nVidia Titan V CEO; Intel Core Ultra 7 265K Gigabyte Z890M Gaming X Klevv 7200Mhz 32GB

Offline

#6 2014-05-17 19:44:23

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: SOLVED wiki search in terminal

Huh?

So you are not looking for a way to do what you want, you are looking for the way you used to do it?  How are we supposed to know what you used to do?

Are you just looking for a way to take a dig command and shorten it?  If so, that's what functions/aliases are for.

Last edited by Trilby (2014-05-17 19:45:33)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#7 2014-05-17 19:52:20

Efka
Member
From: Klaipeda
Registered: 2014-04-27
Posts: 113
Website

Re: SOLVED wiki search in terminal

once i was googling pages about linux and found this "dig +short txt <keyword>.wp.dg.cx" and later i found proper set up for "wiki: keyword" by instaling mysql, apache, dnstools ... and this is the way for me to use wiki in terminal, because it was step by step set up and it takes few minutes to set up, and because im complete newbie with linux experience im looking for this particular setup. sorry if i couldnt explain better .
thanks.


IBM Lenovo ThinkPad T61 ; Lenovo ThinkPad X220; Lenovo ThinkPad T440p; Lenovo Thinkpad W520; Lenovo Thinkpad P71; ThinkPad X1 Yoga Gen1;  FrankenPad T25
Asus Z10PE D-16 WS; 2x Intel Xeon E-5 2690V4; 256GB ECC; nVidia Titan V CEO; Intel Core Ultra 7 265K Gigabyte Z890M Gaming X Klevv 7200Mhz 32GB

Offline

#8 2014-05-17 20:24:06

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: SOLVED wiki search in terminal

This?

wiki() { dig +short txt $1.wp.dg.cx; }

Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#9 2014-05-17 20:30:03

Efka
Member
From: Klaipeda
Registered: 2014-04-27
Posts: 113
Website

Re: SOLVED wiki search in terminal

jasonwryan wrote:

This?

wiki() { dig +short txt $1.wp.dg.cx; }

yeah, something like  this ( I posted above one line ) ... is sorter >> wiki:<keyword> and thats it ... nothing else smile and for short version i need mysql, apache server, dnstools and manual to set it up, and this is what im looking for

Last edited by Efka (2014-05-17 20:31:33)


IBM Lenovo ThinkPad T61 ; Lenovo ThinkPad X220; Lenovo ThinkPad T440p; Lenovo Thinkpad W520; Lenovo Thinkpad P71; ThinkPad X1 Yoga Gen1;  FrankenPad T25
Asus Z10PE D-16 WS; 2x Intel Xeon E-5 2690V4; 256GB ECC; nVidia Titan V CEO; Intel Core Ultra 7 265K Gigabyte Z890M Gaming X Klevv 7200Mhz 32GB

Offline

#10 2014-05-17 20:41:27

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: SOLVED wiki search in terminal

Efka, do you now how shell functions work.  The function jwr posted would make it so you could type "wiki <keyword>" and nothing else.

But if you know you are looking for those three tools, install them, they are all in the repos.  They come with manuals.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#11 2014-05-17 20:51:07

Efka
Member
From: Klaipeda
Registered: 2014-04-27
Posts: 113
Website

Re: SOLVED wiki search in terminal

tools and soft are not a problem, problem is setting up as im newbie and a column which i found contained information and step by step guide

sorry if i explained incorrectly, hopefuly now i made a bit more clearer smile


IBM Lenovo ThinkPad T61 ; Lenovo ThinkPad X220; Lenovo ThinkPad T440p; Lenovo Thinkpad W520; Lenovo Thinkpad P71; ThinkPad X1 Yoga Gen1;  FrankenPad T25
Asus Z10PE D-16 WS; 2x Intel Xeon E-5 2690V4; 256GB ECC; nVidia Titan V CEO; Intel Core Ultra 7 265K Gigabyte Z890M Gaming X Klevv 7200Mhz 32GB

Offline

#12 2014-05-17 20:54:09

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: SOLVED wiki search in terminal

It really isn't clear what you are trying to do, other than the fact that you want a step-by-step guide to do it.

English is clearly not your native language: try posting in the Other Languages board in your mother tongue where you can properly articulate what it is you are looking for.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#13 2014-05-17 20:54:33

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: SOLVED wiki search in terminal

We have no way of knowing what guide you followed previously, so we can't possibly locate it for you.  We can help you set it up again.  And how much more step-by-step can you get than copying and pasting a three line function?  What is wrong with the functions provided above?  If they don't do what you want, we can improve them - but you need to communicate better.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#14 2014-05-17 21:06:30

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: SOLVED wiki search in terminal

While we're waiting for more complete details, I'll just add that IMO installing mysql, apache, and dnsutils just so you can search wikis from the command line is bloat, overkill, and more bloat.

Offline

#15 2014-05-17 21:20:12

Efka
Member
From: Klaipeda
Registered: 2014-04-27
Posts: 113
Website

Re: SOLVED wiki search in terminal

nothing  wrong i just dont know where to put them hmm this is the reason why im looking for this particular article/setup ... it was simple and easy for me to understand (like arch beginers guide), and i dont like to keep poping in and keep asking questions about simple ( for others) scripts, installations ect ect, and, maybe that article would be helpfull for others like me smile
jason ... in my language is not many forums about linux and all of them very quiet.


IBM Lenovo ThinkPad T61 ; Lenovo ThinkPad X220; Lenovo ThinkPad T440p; Lenovo Thinkpad W520; Lenovo Thinkpad P71; ThinkPad X1 Yoga Gen1;  FrankenPad T25
Asus Z10PE D-16 WS; 2x Intel Xeon E-5 2690V4; 256GB ECC; nVidia Titan V CEO; Intel Core Ultra 7 265K Gigabyte Z890M Gaming X Klevv 7200Mhz 32GB

Offline

#16 2014-05-17 21:25:52

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: SOLVED wiki search in terminal

You'd put it in your shellrc file hmm

Every guide has to have some starting assumptions.  We all (I suspect) assumed you knew how to use shell functions - not all archers do, but then not all archers want to have handy commands to use in the terminal.  As you asked for a way to do this in the terminal, I gathered you use the terminal regularly - and I can't imagine someone using the terminal regularly and not knowing how to edit the shellrc files.

So step by step: open ~/.bashrc (if you use bash) in your favorite text editor.  Paste one of the functions above into it.  (re)start your terminal.  Then you can type "wiki searchword".  Note each of the functions about work slightly differently, and all may need to be adjusted to do exactly what you want - but any of them should be a start.

As for asking simple questions - I think this forum is very welcoming to any level of question, as long as the person asking is willing to participate in the process and learn.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#17 2014-05-17 21:26:32

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: SOLVED wiki search in terminal

Efka wrote:

jason ... in my language is not many forums about linux and all of them very quiet.

https://bbs.archlinux.org/viewforum.php?id=30


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#18 2014-05-17 22:18:03

Efka
Member
From: Klaipeda
Registered: 2014-04-27
Posts: 113
Website

Re: SOLVED wiki search in terminal

tomk wrote:

While we're waiting for more complete details, I'll just add that IMO installing mysql, apache, and dnsutils just so you can search wikis from the command line is bloat, overkill, and more bloat.

well, as im not that geeky i dont care if its overkill or no , at the minute its very very handy and quick , mutch quicker to use terminal ( press F1) tilda pops out, type in wiki keyword pres enter and thats it. for me its time saving "module" i should say.  and on another side ... mysql, apache is for web pages as well , and sometimes i like to fiddle about with web pages (i went to colledge to study IT and web design many many years ago) so i still have a bit of atraction to web design ( once in a blue moon ) so one shot two rabbits smile .

jasonwryan wrote:
Efka wrote:

jason ... in my language is not many forums about linux and all of them very quiet.

https://bbs.archlinux.org/viewforum.php?id=30


I would love to see this forum ( languages i know ) active but....

Trilby wrote:

You'd put it in your shellrc file hmm

Every guide has to have some starting assumptions.  We all (I suspect) assumed you knew how to use shell functions - not all archers do, but then not all archers want to have handy commands to use in the terminal.  As you asked for a way to do this in the terminal, I gathered you use the terminal regularly - and I can't imagine someone using the terminal regularly and not knowing how to edit the shellrc files.

So step by step: open ~/.bashrc (if you use bash) in your favorite text editor.  Paste one of the functions above into it.  (re)start your terminal.  Then you can type "wiki searchword".  Note each of the functions about work slightly differently, and all may need to be adjusted to do exactly what you want - but any of them should be a start.

As for asking simple questions - I think this forum is very welcoming to any level of question, as long as the person asking is willing to participate in the process and learn.

emm, thats the point... "handy commands to use in terminal" . I know how to edit things, but if no exponation  what file to edit - im pretty useless,, plus i know that terminal is linux main command window , so i need to utillise what is given to me by the system smile and its easy to use ( i use terminal more then file manager) because i know some commands and its quick easy and handy smile
barshrc i know this file and i have this file , and now i know where to put these command lines  smile
Thank you , my search for other easy steps is over as long as it gives me what i want and if not, i will look for other options/improvents smile


IBM Lenovo ThinkPad T61 ; Lenovo ThinkPad X220; Lenovo ThinkPad T440p; Lenovo Thinkpad W520; Lenovo Thinkpad P71; ThinkPad X1 Yoga Gen1;  FrankenPad T25
Asus Z10PE D-16 WS; 2x Intel Xeon E-5 2690V4; 256GB ECC; nVidia Titan V CEO; Intel Core Ultra 7 265K Gigabyte Z890M Gaming X Klevv 7200Mhz 32GB

Offline

#19 2014-05-17 22:25:52

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: SOLVED wiki search in terminal

Efka wrote:

use terminal ( press F1) tilda pops out, type in wiki keyword pres enter and thats it.

jasonwryan wrote:
sudo pacman -S surfraw
sr archwiki surfraw

Seriously. And it doesn't require mysql, apache or any of that other unnecessary bloat.

Read this: https://wiki.archlinux.org/index.php/Surfraw


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#20 2014-05-17 22:29:58

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: SOLVED wiki search in terminal

I think surfraw will be your best bet for this too.  I like the simpler functions - but they may require some tinkering.  Surfraw will "just work".  Or at least it will once you define the surfraw browser variable.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#21 2014-05-17 23:03:43

Efka
Member
From: Klaipeda
Registered: 2014-04-27
Posts: 113
Website

Re: SOLVED wiki search in terminal

i dont want results in web browser, im very multi tabie person, and im allways 10+ tabs, so surfraw does not work , well it works but not in the way i want smile i need complete terminal based thing smile f1 + wiki moon + enter - quick  read in this same terminal + Esc = info is in my head smile no tabbing, no web browsers smile You know ... arch way wink
by the way ... just got one idea ... can i make allias for "dig +short txt <keyword>.wp.dg.cx" , shall we say allias wiki = dig +short txt <$keyword or $name>.wp.dg.cx  ... or im going into different direction and its all wrong?


IBM Lenovo ThinkPad T61 ; Lenovo ThinkPad X220; Lenovo ThinkPad T440p; Lenovo Thinkpad W520; Lenovo Thinkpad P71; ThinkPad X1 Yoga Gen1;  FrankenPad T25
Asus Z10PE D-16 WS; 2x Intel Xeon E-5 2690V4; 256GB ECC; nVidia Titan V CEO; Intel Core Ultra 7 265K Gigabyte Z890M Gaming X Klevv 7200Mhz 32GB

Offline

#22 2014-05-17 23:14:20

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: SOLVED wiki search in terminal

That's the right idea - but aliases can only fill in a prefix essentially - they can't take parameters.  So you'll need to use a function.  See JWR's example in post #8.  I have no idea how the dig command works, but if that command does what you want, JWR's function should produce the results you want.  Or see my edit to post #4 for another approach.

Last edited by Trilby (2014-05-17 23:15:50)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#23 2014-05-17 23:31:47

Efka
Member
From: Klaipeda
Registered: 2014-04-27
Posts: 113
Website

Re: SOLVED wiki search in terminal

JWR`s line produces good results but only small section of article ( this same with my posted line )  and i need to go to wikipedia to read rest of the article which isnt better then surfraw hmm ...shame i cant remmember a thing about setup with mysql so i cant tell if i found what i want or no hmm oh well .... for the start i think this should b enough ... maybe in the future i will find what im looking for.
Thank You all for the support ! smile i will mark this thread solved and move to the next articles smile its a lot to learn and a lot to read and much more to write smile Cheers .


IBM Lenovo ThinkPad T61 ; Lenovo ThinkPad X220; Lenovo ThinkPad T440p; Lenovo Thinkpad W520; Lenovo Thinkpad P71; ThinkPad X1 Yoga Gen1;  FrankenPad T25
Asus Z10PE D-16 WS; 2x Intel Xeon E-5 2690V4; 256GB ECC; nVidia Titan V CEO; Intel Core Ultra 7 265K Gigabyte Z890M Gaming X Klevv 7200Mhz 32GB

Offline

#24 2014-05-17 23:32:18

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: SOLVED wiki search in terminal

Efka wrote:

i dont want results in web browser, im very multi tabie person, and im allways 10+ tabs, so surfraw does not work , well it works but not in the way i want smile i need complete terminal based thing smile f1 + wiki moon + enter - quick  read in this same terminal + Esc = info is in my head smile no tabbing, no web browsers smile You know ... arch way wink

If you bothered to read the surfraw documentation, you'd see that the results are returned in w3m/3links/links/your terminal browser of choice. Or, if you are really insistent on bypassing the browser, you can have surfraw just dump the output into the term, but that doesn't help if you want to access any linked material.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#25 2014-05-17 23:51:35

Efka
Member
From: Klaipeda
Registered: 2014-04-27
Posts: 113
Website

Re: SOLVED wiki search in terminal

jasonwryan wrote:
Efka wrote:

i dont want results in web browser, im very multi tabie person, and im allways 10+ tabs, so surfraw does not work , well it works but not in the way i want smile i need complete terminal based thing smile f1 + wiki moon + enter - quick  read in this same terminal + Esc = info is in my head smile no tabbing, no web browsers smile You know ... arch way wink

If you bothered to read the surfraw documentation, you'd see that the results are returned in w3m/3links/links/your terminal browser of choice. Or, if you are really insistent on bypassing the browser, you can have surfraw just dump the output into the term, but that doesn't help if you want to access any linked material.

i did, but i couldnt find anything about terminal option ( my bad ) ... so i will try surfraw then ! and i will read surfraw column again smile Thank You smile


IBM Lenovo ThinkPad T61 ; Lenovo ThinkPad X220; Lenovo ThinkPad T440p; Lenovo Thinkpad W520; Lenovo Thinkpad P71; ThinkPad X1 Yoga Gen1;  FrankenPad T25
Asus Z10PE D-16 WS; 2x Intel Xeon E-5 2690V4; 256GB ECC; nVidia Titan V CEO; Intel Core Ultra 7 265K Gigabyte Z890M Gaming X Klevv 7200Mhz 32GB

Offline

Board footer

Powered by FluxBB