78 comments

[ 1.3 ms ] story [ 106 ms ] thread
This is really cool. Has anyone made a version for Windows?
yep, it's called linux! :)
Groan. But I still smiled.
Stallman would point out that it's gnu/linux... but then there's a number of things he'd likely try and point out.

More seriously, this doesn't seem to be linux as much as it is bash and a handful of commonly found on linux tools - all of which you can now run on windows anyway.

Windows users: install bash and follow along.

If one were feeling contrary, one could point out that it's not GNU/Linux in this context... it's GNU/NT (WSL1 and cygwin). Unless we're talking about WSL2, in which case it is GNU/Linux again:)
I saw Stallman talk about a decade ago and was thrilled to be picked on, so asked a question about my Linux setup.

"I think you'll find," he interrupts me, like he's done to most of the other people asking questions "that it's actually GNU/Linux" and then fixes me with a look usually reserved for telling an adult that yes, they really have just soiled themselves.

"Actually," I took great joy in responding, "I'm running Mr Torvalds' kernel with a BSD userland, so really, I'm pretty sure I'll find it's not."

We haven't stayed in touch since.

Beautiful. I've been wanting to do that, actually, but I keep having a rough time because the BSDs tend to assume you're using their kernel, libraries, and userspace all together.
(comment deleted)
Yes, mintty + msys2. I use gnuplot, w3m, tmux, vim, gcc etc. on Windows 10 which is my main OS.

When I need something, I use pacman.

There's plenty of options; WSL2 which feels more like a virtualised system but with access to your files (careful!), or the msys system shipped with git-bash, or the more traditional Cygwin.

Line endings can become an issue, as can the various BOM characters.

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.

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

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

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

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

Does anyone know of a similar tool to the weather api wttr.in for stock prices?
There's surfraw(1)'s "--stockquote" argument.

I've looked around for a freely-available source of raw stock quote data without success (though not invested too much time in it). I've written my own wrapper around Yahoo's stock quotes page (https://finance.yahoo.com/) which strips off everything but the prices themselves (see sample output: https://pastebin.com/gR2j3zB3)

However that's not something which will query for a specified portfolio.

It does feed xrootconsole nicely though.

If you use Haskell, then I'd recommend just using ghci over bc because you can't do floating point stuff in bc:

    1/3
    0
Whereas ghci, or your language's REPL, will likely do better:

    > 1/3
    0.3333333333333333
That's because bc is fixed precision:

    % bc
    bc 1.07.1
    Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006, 2008, 2012-2017 Free Software Foundation, Inc.
    This is free software with ABSOLUTELY NO WARRANTY.
    For details type `warranty'.
    scale=10
    1/3
    .3333333333
Launch bc using the -l or --mathlib option to get 20 decimals of precision and load some basic math functions. I have this as an alias in my .bashrc, so I don't need to do this every time I launch the program.
you can use pari-gp for your floating point needs inside unix. It's an extremely beautiful calculator language (for rational, floating point and polynomials). Also octave and julia, if you are mostly interested in matrices, but they take quite a few miliseconds to start and are not as useful inside shell loops.
You can set up bc to any scale by adding

    scale=INTEGER
for some reasonable INTEGER, say, 6, to your ~/.bc file (you need to also export BC_ENV_ARGS=~/.bc), or alias bc to bc -l). After having gp-pari fail after a brew upgrade I started using bc instead and have been relatively happy so far (although I miss isprime and factors which I used sparingly)
Do note that setting scale breaks modulo tho.
I love finding good command line replacements for UIs. One I've grown to rely on a lot these days is awslogs:

https://github.com/jorgebastida/awslogs

Which allows you to stream Cloudwatch logs via a command like:

  awslogs  get <log group name> ALL --watch
which is cool because you can just specify the log group and get all streams without having to dig around for the specific stream in the AWS console.

There's a python based command line HN client (https://github.com/donnemartin/haxor-news) that's nice, although I think the dependencies need updating (I get various conflicts if I try to install other packages in the same venv).

For twitter, rainbowstream is nice:

https://github.com/orakaro/rainbowstream

awful scroll-jacking on this site. I really hate that.
With the javascript blocked (by NoScript in default deny all JS mode) there is no scroll-jacking, and scrolling works just as expected using the browser scrollbar.
What is even the point of scroll-jacking like this? Is there some SEO or monetization opportunity I don't get? Pretty much everyone (surely including the site owner?) who runs into weird chunky wrestling-an-oiled-pig scrolling like this is going to find it a crappy experience so there must be some compelling reason that I don't understand for its continuing existence.
Work in progress, but sixel support may be coming to mainline tmux:

git clone git://github.com/tmux/tmux

git switch sixel

git checkout b1904c9b8db514133d3372aac13b2ff0b2093cc3

This will give you the "placeholder" box for sixels in terminals that do not support sixel (but you should use mlterm on Linux or mintty on Windows)

The upcoming feature is to replace this placeholder box by unicode art for the sixels, cf https://github.com/tmux/tmux/issues/1613 for the current discussion.

Then you will be able to break your dependency on the GUI just by using w3m and your favorites sites, whether your terminal supports sixel or not (but it should, it's just better!)

apt-get install libsixel1-bin

w3m -sixel -o display_image=1 google.com

Cf https://apple.stackexchange.com/questions/244930/how-do-i-vi...

There are other apps with integrated sixel support like mikkuter for twitter, gnuplot (there was https://github.com/csdvrx/sixel-gnuplot , but now the sixel backend is compiled by default in the official gnuplot-nox starting from debian-10)

At the moment, I'm working on a mutt hack rendering outlook emails with all their included thingies (images etc) into sixels.

If someone is looking for an idea, it'd be great to have a IRC client that replaces URL containing pictures by their sixels renditions, a bit like what lsix does ( https://github.com/hackerb9/lsix )

Yes. This (image support in general in Terminal emulators and Terminal multiplexers) is currently being actively discussed here: https://gitlab.freedesktop.org/terminal-wg/specifications/is...

Many important people are there, e.g. the Tmux maintainer/developer Nicholas Marriott, the Mintty developer, some Xterm.js developer, and others.

The discussions are very interesting, but I'm not sure they are going anywhere. Sixels might win by default. It's not a bad thing. Sixels in 16m colors are quite versatile. But let's suppose that, eventually, a better standard for terminal image support might emerge.

Anything that can already support sixels won't be too hard to change to support this new standard, unless it doesn't use pixels -- though it would be neat if this standard was vector based, like ReGIS: https://en.wikipedia.org/wiki/ReGIS - I want SVG in my terminal :-)

For now, sixels already work reliably for most of the things I do. So now, I concentrate on the applications, to make sure most of my workflow can be console based.

I'm not really convinced by the general mindset of ths discussion. What programs need is not to display a "png file" inside the terminal. What you want is to access the individual pixels of a rectangular framebufer using serialized escape sequences. That way you can intetact with the images.
I love my dependence on the GUI, otherwise would still be stuck using MS-DOS.
"Slide rules to replace your dependence on calculators"
That analogy doesn't hold well though, because calculators were (at least eventually) better at everything a slide rule could do. This article is predicated on the idea that this doesn't hold for CLI->GUI. You may disagree, but it's not obviously false.
Yes, I caught the drift of the article. I think a better title might have been "Teletype Emulation Strategies to Break Your Dependence on the GUI"
(comment deleted)
If we are going there, why not "Teletype Emulation Strategies to Break Your Dependence on Limited Desktop Metaphor" ?
Or "airplane seat" metaphor as Frederick P. Brooks, Jr. said.
If MS-DOS had enjoyed as much developer attention as the *nix command line experience has over the past couple of decades, that might not be so bad a prospect.
Couple? You mean 4?
'Couple' is a word that in some contexts means two specifically, but in other (informal) contexts means a small number. Generally when somebody describes three or four things as a "couple", they're being informal and a correction isn't warranted.
”but in other (informal) contexts means a small number"

Isn't there a word for that ? I'm thinking of "several". That is what I learned in school (not a native english speaker )

Both "several" and "couple" are applicable. "A handful" or "some" have the same connotation generally, and I'm sure there are many others.
Except, we actually don't mind, because we have a proper GUI experience and don't need to use the shell for basic stuff.
Which is neither here, nor there.

It's more like saying "I love my dependence on images, else I would still be stuck using text". Well, text can be more information-dense and efficient than an image or a movie. And similarly, a CLI can be more efficient than a GUI. Depends on the application.

And if the "MS DOS" reference is about release time, well, there are CLI tools that were built far more recently, and are much more modern than many GUI tools people use.

I like awk as a calculator:

    calc () { awk "BEGIN { print "$*" }" }

    $ calc "2^16"
    65536
    $ calc "2*16"
    32
    $ calc "2+16"
    18
units, too:

    $ units -t "sqrt(3^2 + 4^2)"
    5
    $ units -t "forty rods per hogshead" "miles per usgallon"
    0.0019825576
    $ units -t "32GB / (1MB/s)" "hours; minutes"
    8;53.333333
You can use this CLI to plan you haircut by browsing queue times for Cutters hair salons:

https://github.com/draperunner/cutters

Which enables you to run:

  $ npx cutters | grep Oslo | head -3
to get queue times in Oslo. Made by a colleague of mine.
Nice. I have this as an alias in my ~/.zshrc:

curl -s https://www.cutters.no/api/salons | jq '.data[] | select(.location.key == "oslo") | .details.estimatedWait /= 60000 | {name: .name, wait: .details.estimatedWait, serving: .details.numberOfServing, waiting: .details.numberOfWaiting}'

This article is awful. You're not going to "break your dependence on the GUI" by replacing 5 things you do a few times a day with obscure, less good CLI alternatives. What about things like manipulating files and running programs? Aren't they the things people do with computers?

Also, bc is especially terrible. Nobody who is already "dependent on the GUI" is going to want to know about scale= and all that. Better to use Python or even bash (echo $((123+456)) etc)

> What about things like manipulating files and running programs? Aren't they the things people do with computers?

I'm confused. Manipulating files and running programs is a given, isn't it? You mean ls/cp/mv/rm-style? And running programs is... type in the name of the program (if in $PATH) or its path (if not) and press enter. Why would anyone bother blogging about that?

It depends on what people use the GUI for. It's not inconceivable that people start up gvim to make a new file (instead of cat > file) or use some bulk-renaming tool instead of learning about shell expansions.

"Awful" was a mean description of this article. I'll fix it (edit: comment, not fix).

  touch file
if you need an empty file (also prevents accidental truncation).
`vim newfile` (or gvim/nano/emacs/whatever) will create a new file. I won't say I've never created a file with cat (handy for pasting), but it's a little unusual.
I usually do it when autoindent is going to make a mess of whatever I'm pasting into the file.
Or using Midnight Commander !

(Ok, it’s a bit cheating, sort of text/GUI, but makes file manipulation so easy on console)

How about finding out what files are there in the first place, what data the files represent and which programs would be useful to operate on the files?

In other words, things a typical GUI file manager can do easily.

> finding out what files are there in the first place

ls?

> what data the files represent

ls, file

> which programs would be useful to operate on the files?

I guess I assume that people know this kind of thing, but xdg-open is fine.

I wouldnt say it's awful, couple of neat things that one can use - noone forces anything on anyone.
"Awful" was mean. Sorry.

I just meant that IMO it's more productive to get familiar with the shell and demonstrate powerful shell alternatives than learning a handful of situation-specific CLI alternatives. Getting to know things like shell expansions, using ipython (or whatever) for adhoc data crunching, the "jq" command, sup/mutt/whatever and so on will make someone a much better CLI wrangler (and less dependent on GUI tools) than knowing you can Google from the command line.

`bc -l` gets you everything you need. Sometimes I prefer Python, but `bc -l` is seriously a little more user friendly.
I never tried googler, but I have used lynx before. Far from a productivity boost, all it really did was help me look busy to the untrained eye while reading HN.
I'm a little late to the party, but something I've come realize recently is that my affection towards CLI applications comes from the fact that I usually don't have to take my hands off the keyboard.

Human hands can move very fast, faster than we can assemble cogent thoughts thanks to muscle memory (and other things that I'm sure I'm not aware of). I don't know if this is a universal thing, but I like it when I don't have to think about how to get something done. I consciously picture the end goal in my mind, and my hands just do.

Of course, I'm a sloppy typist, and still relatively unrehearsed when it comes to working with Vim and friends. But I've been most of the standard GNU applications long enough to realize that my brain no longer directs my hands to interact with the keyboard for frequent simple tasks (generate a line plot for this two column CSV, use awk to get the penultimate column of this file, hash files in a directory to remove duplicates, open HN in a browser...).

I'm also a big sucker for working with programs that compose well with other programs. If I had all the time and money in the world, I'd love to have more GUI apps that explored GUI/CLI interop better. I think one example many developers can comment on is how nice it is when you can combine CLI git commands with git in your code editor. Sometimes, it's just easier to resolve ugly merge conflicts with a GUI. Or there's a really weird command that doesn't exist in your GUI so you need to type it out on the commandline.

There's definitely a lot more work to be done in this domain and I'm excited to see how software/OS/library developers explore this in years to come.

I came to a similar realization which prompted me to start working on a suite of GUI programs that are keyboard focused.

I think that is very different than an app with good keyboard shortcuts btw which is why, for example, despite many editors having great keyboard shortcuts I keep going back to vim. So I’m Making basic apps that are intended to be used entirely with a keyboard and just happen to support mouse input too.

I realize this doesn’t work well for everything but my todo app and my note taking app should work great at least.

It's funny how condescending some will try to be about use of the command line, as if it's something special.

You can quickly invert this to read as: GUI configurations to break your dependence on the command line.

In moment's thought, it becomes very obvious that a GUI can readily conceal complexity and require earned skill in the same way any text mode interface might. Text command skills also evaporate just as quickly when you realize you were just locked into preferences specific to the system they bind to.

The command line is not better than other ways of completing tasks. When Linux (and each and every last variant) dies (however long that may take), it will become all too obvious that the essential commands people memorized were only useful within the scope of that particular operating system

Lots of people in this thread are recommending blogs, videos or books to get to know the command line or just tell to RTFM.

I'd like to note that no manual at all is needed to understand a basic menu structure or a GUI system with consistently used widgets.