Hacker News new | ask | show | jobs
by exergy 2392 days ago
A dictionary? I mean, that's neat and all, but not all that useful is it? I might check the weather once a day, tops. This is better solved by having a widget on my smartphone. Same for the dictionary, and same for short google searches too (Firefox Focus).

I had a twinge of hope that this might have been more of an introduction to using the terminal effectively on Linux for diagnoses.

I'm new to Linux, and every time I have an issue and find a thread addressing it, they ask for me to run a whole bunch of commands and paste a bunch of logs. I'm happy to do that, don't get me wrong, but I rarely have the faintest idea of what it is that I'm typing in.

7 comments

What kind of diagnoses are you interested in learning about? This may be too rudimentary, but I found ‘The Linux Command Line’ a good book to build up skills and knowledge.

Also I would say: don’t try to force it. People write a lot about ricing their Gentoo installs, which tiling window managers use the least RAM and which plugins they use with Neovim. This makes using the terminal effectively seem like a big thing.

But the terminal is exactly not that — all proxies are removed and you just use it for what you want to do, nothing more. Just start by using grep on a text file instead of opening that text file up in your editor.

You can bind dict to the "keywordprg" query key ('K') in vim.

By default, that's tied to 'man', which lets you look up a particular command in the system manpages. Swap that to dict for text files (say, filetype markdown or HTML), and you've now got a dictionary lookup for any given word. Not sure of spelling or meaning? Position cursor on word and hit 'K', and you'll get the word's definition, or a match of near-spellings.

The dict database can also be extended to other datasets -- anything with a keyword-result relationship. On Debian, this includes the US Census "Tiger" files (thanks to Bruce Perens for buying a copy and sharing them to the project), which lets you look up any specific city or place name in the United States.

You can specify the dictionary you want to use on the commandline, or write a shell alias or function to query a specific database, say:

    dictzip () { /usr/bin/dict -d gaz2k-zips "$*" | ${PAGER:-less}; }
    dictplace () { /usr/bin/dict -d gaz2k-places "$*" | ${PAGER:-less}; }
Which allows you to query ZIP Codes or place names without otherwise mentioning the dictionary on the commandline.

There are numerous other query tools bundled together in tools such as surfraw(1) (https://packages.debian.org/buster/surfraw), with 123 separate query targets.

Or you can write your own. I've got a wrapper around the NOAA's weather six-day forecast page which dumps a text-formatted version of just the forecast text (a lot of ugly sed and awk). Having to write programmes to remove the text other programmes lard onto a simple data request is Where We Are Now in Today's WWW.

Or a lookup for the Online Etymological Dictionary:

    etym () { \w3m -T text/html "https://www.etymonline.com/word/${1}"; }
(w3m is escaped '\' to byapass the alias I've defined, 'alias w3m="w3m -B"', which defaults to opening my bookmarks file if no argument is given.)

Learning what you're typing, and what it does, and what the underlying logic are, is much of the fun.

> I rarely have the faintest idea of what it is that I'm typing in.

I suggest checking out Like Smith's beautifully assembled video guides, whom I think has done a lot for newbies by releasing comprehensible content while minimising the whole RTFM attitude that kept newbies away from the terminal.

But yes, also RTFM.

Luke Smith? Do you have a link?
Lukesmith.xyz I believe
I interpreted the premise of the article as weaning people off of GUI with everyday trivial tasks that can be done via CLI. I myself do almost all my work from the CLI, but it was this blog post [0], specifically the open, pbpaste, and screenshot commands, that got me into dabbling with my shell, before I understood the power and convenience of shell scripting.

I try to get novices interested in the shell via youtube-dl, which is very useful and has no good GUI counterpart. However, for a lot of people, downloading copies of video are just not an everyday task like checking the weather or dictionary.

[0] https://news.ycombinator.com/item?id=10143143

There are a few worthy webextensions that can do the basics of what youtube-do does. Enough to only need the command line for batch stuff or more advanced conversions.
I would never think to check the weather, but having it in my tmux status is useful

https://github.com/jdxcode/tmux-weather

why would you want to know the weather at the spacetime position you are? A forecast, ok, but why here and now? Don't you have windows where you work?
I don’t know how warm it is outside. Chiefly I use it to tell if it’s a good time for a run or if I need to put a jacket on before stepping outside.
>A dictionary? I mean, that's neat and all, but not all that useful is it?

Depends on your job. For certain jobs is 10x more useful than most programs you use every day...

Im a big fan of a cli program called tldr[1].

Usually when the internet says "Run these commands", they either don't tell you what they do, or tell you to just check `man`. The problem is that man pages can be super long, can have a somewhat intimidating syntax, and 1,000 flags that arent your flag. Running `tldr program_name` gives you a way simpler manual with common flags and actual examples.

[1]https://github.com/tldr-pages/tldr