Live data from Hacker News

More, less, and a story of typical Unix fossilization

utcc.utoronto.ca

111–120 of 127 posts

Re: More, less, and a story of typical Unix fossilization

#111
post #71

Earlier quoted context omitted.

I was pretty sure this is incorrect for at least Debian 8 / Jessie based on recollection. And now I'm 100% sure it's false -- sigh https://www.xkcd.com/386/ -- having just installed it in a VM with only "standard system utility" selected (it is selected by default), and verified that less is installed.

I don't see it: $ docker run --rm debian:jessie less -V docker: Error response from daemon: Container command 'less' not found or does not exist.. while more is present: $ docker run --rm debian:jessie more -V 1 ↵ more from util-linux 2.25.2

https://github.com/tianon/docker-brew-debian/blob/c2882c541f...

It's using debootstrap --variant=minbase, which (from the man page) "...only includes essential packages and apt." It makes sense that docker would want only the bare minimum. And to be fair, but getting into nit-picking territory, minbase is the default for debootstrap, but debootstrap is not the default method of installing Debian: debian-installer is. So docker's Debian image doesn't install less, but they're not doing a default install, as in invoking debian-installer, and keeping the preselected choices as much as possible.

Re: More, less, and a story of typical Unix fossilization

#112

Earlier quoted context omitted.

I hereby award you a "Useless use of cat" award [1] more http://porkmail.org/era/unix/award.html#cat

or just more /etc/passwd | less ¯\_(ツ)_/¯

cat /etc/passwd | head -n X | tail -n Y

Print lines X-Y to X of a file. :D

Re: More, less, and a story of typical Unix fossilization

#113
post #63
post #24

Earlier quoted context omitted.

> I've never totally loved the shell I don't understand your point, PowerShell is a shell too, just like Bash or Zsh. When you call less, more or any other tool from Powershell, you still retain all the problems that are mentioned in the article. I think the article was focusing more on the ecosystem than anything.

The ecosystem creates problems that don't exist with PowerShell, which is more like a cross-platform programming language that sits above the OS than the traditional *NIX arrangement of an OS-specific collection of a shell (with some built-ins) plus a grab-bag of third-party tools. Like Python, Node.js etc., PowerShell has one development team that will now be delivering one implementation across all of the operating…

Thanks, I didn't know about the packaging system. So the idea is that the ecosystem is made of PowerShell (i.e. the shell itself and PowerShell scripting language) + .NET + 3rd party packages, am I right?

Re: More, less, and a story of typical Unix fossilization

#114
post #63

Earlier quoted context omitted.

The ecosystem creates problems that don't exist with PowerShell, which is more like a cross-platform programming language that sits above the OS than the traditional *NIX arrangement of an OS-specific collection of a shell (with some built-ins) plus a grab-bag of third-party tools. Like Python, Node.js etc., PowerShell has one development team that will now be delivering one implementation across all of the operating…

Thanks, I didn't know about the packaging system. So the idea is that the ecosystem is made of PowerShell (i.e. the shell itself and PowerShell scripting language) + .NET + 3rd party packages, am I right?

Oh I actually did know about the package manager, but I didn't know that that's coming to *NIX through PowerShell. For reference: https://blogs.technet.microsoft.com/packagemanagement/2015/0...

If I remember well, some time ago MS announced that on Windows you would be able to use Chocolatey as an additional source, which I thought was interesting.

Re: More, less, and a story of typical Unix fossilization

#115
post #36

On thing the article misses on is that, at least in Linux, less is not a line by line pager, it controls the whole terminal screen area, so for example if you pipe output to a file that has terminal instructions (bold, color, cursor moves etc) and try to use less to read the file it will not give such good output. More just outputs the ctrl chars and lets the terminal emulator deal with them, so they are visible, Thu…

The "-r" option to less will allow the "raw" control characters to pass through. "less -r" will do what you want.

That's great to know but you still need to make sure the process generating the output isn't trying to outsmart you.

For instance ag (silver surfer) needs you to specify `ag --color` otherwise it will detect you are piping it and disable colors.

And if I remember correctly, grep needs a `grep --color=always` to achieve the same.

Re: More, less, and a story of typical Unix fossilization

#117
post #19

One advantage I find of more over less, is that it doesn't clear the terminal on exit. It's often nice to see what you have looked at above the command prompt. There is a "-X" option for less, but this also breaks mouse wheel scrolling.

Those horrid alt-buffer init and exit strings in terminfo and termcap are the bane of my existence. I almost never want that behavior, particularly when I've got a relevant section of a man page on the screen and want it to STAY THERE when I quit out of the pager. I use -X in less, but I really want a more universal solution, so I use a terminal type that doesn't have those strings, usually xterm-noapp. But it's not…

Put something like this into your .Xresources:

For URxvt:

! Ctrl-Shift-A will show alternate screen URxvt.keysym.C-S-A: command:\033[?47h ! Ctrl-Shift-Z will return to regular screen URxvt.keysym.C-S-Z: command:\033[?47l

For XTerm:

! Ctrl-Shift-Z will toggle alternate screen VT100translations: #override \n\ Ctrl Shift z: set-altscreen(toggle)

Re: More, less, and a story of typical Unix fossilization

#118
post #10

I can see the fossilization, but I don't see what's so typical Unix of that phenomenon. Windows still includes cmd.exe with all its broken, retarded features, while it has powershell, which is supposedly (no experience myself) a little less retarded.

Contrary to less, PowerShell is definitely not backwards-compatible with cmd. Microsoft has changed cmd a select few times, most notably adding command extensions around NT 4, I think. But those changes were very careful not to break existing scripts (which means delayed expansion is always disabled by default). If vi acts a little bit different, or more accepts other keys that don't scroll a whole page, it's also no…

I disagree; would it be Unix/Linux without a bourne/csh/bash/whatever shell? Would Win3.x/NT/Win10 be the same without CMD.EXE? I have built, developed in both, heavily, and I say that Unix/Linux without a shell is not really Unix. But the Windows without a shell may disadvantage admins, but wouldn't be missed by the vat majority of users.

Re: More, less, and a story of typical Unix fossilization

#119
post #116
post #112

Earlier quoted context omitted.

cat /etc/passwd | head -n X | tail -n Y Print lines X-Y to X of a file. :D

Why so complicated? sed -ne 'X,Yp' /etc/passwd

Because that's what I came up with in first year uni and nobody ever said "hey, that's too complicated, you should learn to use sed properly."

I should learn to use sed properly.

Re: More, less, and a story of typical Unix fossilization

#120

Earlier quoted context omitted.

Thanks, I didn't know about the packaging system. So the idea is that the ecosystem is made of PowerShell (i.e. the shell itself and PowerShell scripting language) + .NET + 3rd party packages, am I right?

Oh I actually did know about the package manager, but I didn't know that that's coming to *NIX through PowerShell. For reference: https://blogs.technet.microsoft.com/packagemanagement/2015/0... If I remember well, some time ago MS announced that on Windows you would be able to use Chocolatey as an additional source, which I thought was interesting.

PowerShell itself now has a packaging system and public repository for modules: http://www.powershellgallery.com/

PowerShell for Windows got this earlier in the year, and it's part of PowerShell Core. So with PS Core, you should be able to start a freshly installed copy of PS on whatever OS you are using, and add the AWS modules with this command:

Install-Module AWSPowerShell.NetCore

(Warning: this command does not work on the alpha release due to a bug - you need a workaround as described on the AWS blog: https://blogs.aws.amazon.com/net/post/TxTUNCCDVSG05F/Introdu...)

Nothing very impressive to anybody that has used any modern programming language, but now your shell has this too (if you use PS).

Post reply on HN