12 ms·
More, less, and a story of typical Unix fossilization
- teknopaul 10y agoOn 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, Thus highlighting the benefit of simplicity over cruft. Sometimes, because more does less, more > less.
- ploxiln 10y agoThe "-r" option to less will allow the "raw" control characters to pass through. "less -r" will do what you want.
- therein 10y agoThat'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.
- digi_owl 10y agoOr maybe we are observing an OS that is allowed to evolve with the needs and wants of its environment, rather than something created by decree.
- voltagex_ 10y ago>On Linux, more is part of the util-linux package but its manpage outright tells you to use less instead On minimal distros (say, Debian in the minbase configuration), more is more likely to be included than less. I haven't used any other small distros for a while but is util-linux normally there instead of other packages (actually, I wonder why minbase doesn't just use busybox).
- ajdlinux 10y agoNot a debootstrap or any sort of Debian developer, but I assume minbase is expected to be strictly a subset of the packages one would find on a regular Debian system, which would imply having bash, dash, util-linux and so on, rather than attempting to use busybox (which is Priority: optional).
- mjevans 10y agoThere's still a need to at least include the hard/sym-link to less, and if you do that you should probably communicate why. (E.G. so that when someone digs out a floppy disk from who knows how long ago with a recently deceased relative's old scripts on it they'll still work.) Also, that more's features are more likely to end up in something seriously constrained (busybox) means that if you're ever stuck on a really low end system you can still use more to get some critical things done (like page through a file or result set too large to read correctly otherwise).
- ChuckMcM 10y agoNow all we need is someone to modify less to recognize that its standard in is connected the output of more so that if you type `cat /etc/passwd | more | less` it could output something which, more or less, looked like the input.
- billforsternz 10y agoI see what you did there. I think.
- wiredfool 10y agoThe problem is less that we have fossilization and pointless cruft around basic utilities, it's more that the replacements are written by people with a sense of humor, and their sense of humor is distinctly punny.
- knz42 10y agoIt actually works already :) (more does not page if its stdout is not a terminal)
- jjnoakes 10y agoThat only gets you half way. You also need less to not page its input to its output if it detects "more" is on stdin (much harder).
- SixSigma 10y agoI hereby award you a "Useless use of cat" award [1] more < /etc/passwd | less http://porkmail.org/era/unix/award.html#cat http://porkmail.org/era/unix/award.html#cat
- inopinatus 10y agoI applaud all distributions that include the simplest tools. Sometimes - always the worst times - they're the ones that still work.
- winteriscoming 10y agoI prefer less. Incidentally, the other day I was on a CentOS system where I wanted to paginate a log file and typed in "less". Turns out, unlike more, less isn't installed by default. Was a bit surprised because I was under the impression that most Linux systems would have had it in their default install.
- annnnd 10y agoDebian doesn't install it by default either - agree, surprising. On another note, even more surprising is less's behavior with colored output (you have -r and -R switches, which are almost, but not completely, alike; and in neither of them does page-up render properly).
- RJIb8RBYxzAMX9u 10y agoI 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/ 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.
- d0mine 10y agoI 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
- RJIb8RBYxzAMX9u 10y agohttps://github.com/tianon/docker-brew-debian/blob/c2882c541f5bd5cfdd28a505a4e635d42c7fd946/jessie/build-command.txt 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.
- pmontra 10y agoThere is another pager, less advanced than more http://www.unix.com/man-page/linux/1/pg/ http://www.unix.com/man-page/linux/1/pg/
- pbhjpbhj 10y agoThere's "most" pager discussed here a week or so ago, too. (Incidentally that link returns a blank page for me on FF mobile.)
- pmontra 10y agoI missed most, I'll look for it. The link to pg works on my FF Android. I'm using uBlock origin. Are you using some other adblocker or add on?
- amavisca 10y agoThe link is similarly a white screen on Android Chrome for me.
- pmontra 10y agoHopefully this works http://man.he.net/?topic=pg§ion=all http://man.he.net/?topic=pg§ion=all The page source is as simple as it could have been in 1996 :-) The original link has a broken table layout with some unbalanced </table> and </tr>. Maybe that breaks rendering on your browsers, but why not on my Firefox?
- Sylos 10y agoFor me, not only the page is completely empty, but also the page-source, so I don't think that it's a rendering problem and rather the server sending a 0-long HTML-file or something like that. It also finishes loading rather quickly, so it would only make sense that it's not even downloading anything. And neither Firefox, nor Lightning Browser (WebView-based), nor CyanogenMod's Gello Browser (Chromium-based) show any form of error and just happily render a completely empty page. Also, I do get the favicon displayed, so at least some form of connection to the server seems to be possible. Edit: Just had another idea. It works for me when I tell Firefox to request the desktop site. So, maybe the server just gets confused by a mobile useragent-string...?
- frederikvs 10y agoI 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.
- flukus 10y agocmd.exe starts in a second, powershell takes 5 and then another 10 to actually be interactive. So it's still useful to me.
- mavhc 10y agoAnd then 5 mins while you google how to enable scripts
- Zardoz84 10y agoPlus who would use these weird script language. Common! Even bash scripting it's more easy that powershell!
- vertex-four 10y agoErr. Bash scripting is awful. Trying to figure out what chain of commands you need to pull out that one particular piece of data from the output of that command... I've seen a dozen lines to manage it in some cases before, or calling out to a script in Awk or Perl. And then it won't work when you update your system because somebody decided to update a command's output format just slightly. Powershell is an object-oriented scripting language along the lines of something like Python, just with different syntax and more of a focus on managing services. It also has reasonable syntax for applying one command to the result of another - the pipe operator. And it's reasonable to use it in day-to-day usage as a command line. I've written a Powershell script to change an Exchange server setting we needed to change ever so often, faster than I could ever write a bash script to do the same. Under Linux, I'd likely have given up trying to use bash to edit a config, and just started writing an m4 file which generates the config as part of a cron job.
- 10y ago
- sjellis 10y agoI've used Linux for a decade-and-a-half, but I've never totally loved the shell, because of the need to learn this sort of pointless arcana. PowerShell was a massive step forward, and I had hoped that an Open Source, cross-platform equivalent would develop so that we could get past the current local maxima of 1970s-era design. It's rather weird that the Open Source equivalent of PowerShell is now...PowerShell. Even if you don't like Microsoft or .NET, if you care about shells I'd recommend trying out PowerShell Core for an hour or two. It's only when you use it for a bit that you start to realize that you can guess commands based on the rules and actually be right and how big an improvement that actually is, rather than the current UNIX method of having to memorize more and more obscure trivia in order to get the computer to do what you want. I'm not sure if PowerShell itself is a long-term answer because of the .NET and Microsoft dependencies, but it gets lot of things right. It's time we dropped the "Bash is good enough" arguments. There are now new Linux users starting every day, and asking them to learn that less is better than more is not funny.
- rollthehard6 10y agoI dunno, I'm a long term *NIX person (Solaris 1994-2011, Linux on and off 1994-2006, Linux mostly 2006-now) I am now involved in more Powershell scripting on Windows than I have ever done before. I don't see - Get-Content -Tail 10 FILE as an improvement on - tail -10 FILE I think when it comes to the combination of intuitive command names and terseness when required, VMS' DCL is still unsurpassed. Having commands with sensible names that can the be shortened and a really useable HELP system was a major plus and I've not seen anything match that since.
- CJefferson 10y agoTo me, the main advantage of Powershell is filename handling. I know that if I do everything just right, then my scripts will handle filenames with spaces/newlines/other crazy characters, but I always mess up somehow. Nowadays if I ever want a script I'll distribute to people who might have spaces in directories, I write it in python even if it would be a 4 line bash script, just to avoid the issue.
- JoachimS 10y agoAnd then, of course, there is most: http://www.jedsoft.org/most/ http://www.jedsoft.org/most/
- frederikvs 10y agoreading the phrase "Why settle for less?" made me laugh :-)
- iuguy 10y agoI have to say that when it comes to pagers, I more or less prefer most.
- Annatar 10y agoFrom the article: I am not a fan of Solaris's long standing refusal to touch anything. This is what people often deeply misunderstand about traditional UNIX operating systems: one of Solaris' greatest features, in stark contrast to GNU/Linux, is the insistence on not breaking backward compatibility. Solaris has however delivered less(1) as standard since Solaris 8, so there is nothing stopping one from configuring their PAGER to it. In fact, I do the exact same thing in my OS builds of Solaris and SmartOS. It's called system engineering. illumos has the entire GNU userland in /usr/gnu and it's packed with new features under the hood, but those will almost never be introduced such that they break someone else's stuff; it's the very advantage differentiator illumos provides over anyone else! And it's good engineering, adding new funtionality while not breaking existing one.
- guitarbill 10y ago> one of Solaris' greatest features Features are use-case specific. One person's feature is another person's bloat. (Personally, I side with the article author on this.)
- Annatar 10y agoDo you deliver any software for the platform you use, and if so, do you not mind when things suddenly stop working? Or, are you responsible for delivering any services, and if so, do you not mind when someone else's changes cause you an outage? Perhaps you have some private automation in place; do you not mind if your automation breaks because of someone else? Apropos bloat, illumos is the only operating system codebase which gets faster and more efficient with every commit. If there are others out there, I have yet to see such a thing.
- guitarbill 10y agoI see this as a necessary consequence of being human. Sometimes, a genius comes along and gets the design and implementation right for years to come. Most of the time, people try their best. But nobody can really see into the future. I'm happy enough if people say "okay, we didn't get this quite right, but we learned and we've made it better". And if the new approach isn't compatible, well okay. The short-term pain is usually worth moving forward in the long-term. And when this happens, it's usually not a technical issue anymore, but a communication issue, which is a way harder problem to solve. If your solution to the communication problem is technical, i.e. let's always maintain backwards compatibility, then there's still the issue of communicating what the new, preferred method is. So I feel that if you have great communication with the people who care, it shouldn't impact them badly in the first place. The danger of backwards compatibility is maintenance cost, and stifling new ideas to solve an existing problem better - people won't bother, because the effort of making something new would be overshadowed by the effort to retro-fit old behaviour. Still though, I get the point of changing stuff just for the sake of change is bad. I'll ignore the hyperbole about illumos though.
- xioxox 10y agoOne 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.
- rootbear 10y agoThose 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 always available. I'm not sure what you mean about -X and mouse scrolling.
- kerny 10y agoPut 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 <KeyPress> z: set-altscreen(toggle)
- taneq 10y ago> In a sane world, Unix vendors would have either replaced their version of more with the clearly superior less But that's just the thing - 'less' isn't "clearly superior" to 'more'. It is (or was, maybe this has changed) heavier weight and offers more functionality that may not be needed. Having both commands lets script writers use exactly the tool they need for the job. And it's not like the extra 35KB of keeping the 'more' binary around is really breaking the bank.
- CJefferson 10y agoThe problem isn't the 35k, the problem is now we all have to spend a little bit of extra brain capacity, remembering the difference between 'more' and 'less', and how while you would imagine 'more' is better (based on the traditional English meaning of the words), actually, 'more' is the lesser product. I wonder how many hours have been wasted altogether on people learning, and misunderstanding, which of more or less they should use?
- oneeyedpigeon 10y agoPlus, `more` as a pager command at least makes a tiny bit of sense, but `less` is a ridiculously obscure command name for beginners.
- Sylos 10y agoI don't think it's that bad. This is one of the cases where your usual ignorance towards new/different things is pretty effective. At least for me personally, 'less' was what I always saw everywhere being used, and had used myself many times before I discovered that 'more' was a thing. And when I discovered 'more', it took me maybe a minute to figure out that it's pretty much exactly like 'less', but that I didn't like it as much, and with everyone else seemingly agreeing on that, I didn't put any further thought to it.
- lazyjones 10y agoI preferred 'more' over 'less' only in situations where I just wanted to see the first couple of many pages of output from something (for example compilation errors where the root cause is at the beginning and the rest is meaningless). 'less' would then block user interaction while reading all input (interruptible with ^G), while 'more' would display the first page immediately and stop reading from stdin. For all other use cases, 'less' seemed clearly superior.
- lmm 10y agoI don't believe more is the first Unix pager - doesn't pg predate it? IIRC pg is the only pager required by POSIX.
- JdeBP 10y agopg and the System 5 side of things are notable by their absence from M. Siebenmann's article. But pg appeared in System 5 release 2 or (more probably) 3 whereas more was 3.0BSD.
- SixSigma 10y agoOn plan9 the "terminal" window pages by itself (it is not a tty) but there is also p(1) [1] which does even less than more or less. [1] https://swtch.com/plan9port/man/man1/p.html https://swtch.com/plan9port/man/man1/p.html
- tambourine_man 10y agoI've recently been using Vim as a pager and it's great. :help manpager Suggests export MANPAGER="env MAN_PN=1 vim -M +MANPAGER -" Which doesn't work for me, but this does: export MANPAGER="/bin/sh -c \"col -b | vim -c 'set ft=man ts=8 nomod nolist nonu noma' -\""
- akavel 10y agoInterestingly, it occurred to me that NixOS might be in perfect position to enable painless "gradual migrations" of tooling. Imagine alternative history of UNIX, where NixOS was invented really long time ago, before 'less' was created. Now, imagine we're Mark Nudelman and we want to add fancy features to 'more' (instead of creating a new tool named 'less'). We could do this freely, and all tools depending on peculiarities of "old more" could be pinned to use a "private" old version of the binary, while new ones would by default use the "new more". Then, the backwards tools could be gradually updated, until no one imported the "old more" and it could be safely removed from the nixpkgs repository. (While any external, non-nixpkgs package definitions could still backport the "old more" definition should they really need it.) Does this reasoning have any holes?
- zeveb 10y agoI can imagine, though, that more(1) in that case would eventually fork, so that some software depended on my-more and others on his-more and still others on her-more. And that-other-dude's-more would have a security vulnerability, and no-one would update it, and we'd all get pwned, oh the embarrassment.
- RubyPinch 10y agoI'd be asking the question of wether anything depended on `more` that couldn't depend on `less` already, but instead depends on more because more is not less. Or, in other words, maybe the issue is cultural instead of technical, which would in practice, result in new users going to either more (the relic) or less (the bloated), depending on their views, instead of all new users going to less edit: reading through the rest of the comments here, it seems a lot of people prefer more, for various reasons!
- xg15 10y agoSo to sum up, more had more features than more but less features than less.
- josuah 10y agoFortunately, `more` may be a very small piece of software and may not clutter the /bin too much. Moreover it may already be used by some scripts displaying long output they want user to read briefly. But there may be (much) larger softwares superseded by more modern versions, both present on the os.
- josuah 10y agoDo one thing and do it well, but... - If more and less are split in two: more does not page well (no scrollback), and less does two jobs: paging and blocking the scrolling. - If more gets dropped in favor of less: less is a rather good pager, and serve only its own purpose of paging lines of text in different way.
- kyberias 10y agoWell, at least Yngwie Malmsteen doesn't agree with this nonsense: https://www.youtube.com/watch?v=QHZ48AE3TOI https://www.youtube.com/watch?v=QHZ48AE3TOI
- BrandoElFollito 10y agoTL;DR: less has better specs and replaced more for non-philosophically inclined sysads.