Imagining the CLI For the Modern Machine
scc writes "TermKit is a re-think of the storied Unix terminal, where human views, input and data pipes are separated. Output viewers render any kind of data usefully. It may not be a new idea, but it's certainly a new take on it." I know you are quite comfortable in your shell of old, but this sort of thing sure gets my juices going. The best of both worlds.
Windows PowerShell beats all.
Everything goes in cycles. From terminal, to personal computer, to cloud. Here's terminal again. - www.awkwardengineer.com
This saddens me, I would so want Windows and Linux ports. There's a brief mention that it should work with a normal web browser, and it appears to use node.js, but I am unsure what exactly to do. I haven't done any coding with node.js.
They took down the TermKit repository for no apparent reason, 'permission denied' when trying to git
Lame
Doesn't run vim. Mac-only. Lame.
Not to praise M$, but isn't this exactly what the Monad shell for Windows does?
The big pros of a command line:
-Very low resource usage
-Automation via scripts
I thought the whole point of a command line was that you didn't have to look at it while it was doing its automated thing. If you need interactivity, the GUI can handle that. It seems to me like this new interface will suck up too many resources doing something that admins won't be staring at.
But it's worth a shot. ;)
RAM and bandwidth are cheap, why not add tons of bells and whistles? They may not make anything more functional, but they make it more fun, and that's what counts, right? Oh, it's only for Mac? Well that makes perfect sense.
- None can love freedom heartily, but good men; the rest love not freedom, but license. -- John Milton
...can I just get ncurses capability in my bash shell, so it will respond to mouse clicks?
Forgive me, but I just don't see the "usability" aspect. How is this more "usable" than what I have now? What the author calls "raw" data, I call data. To me, that is WAY more usable than what the author has posted.
I like some of this idea, but frankly, it doesn't go far enough. Take a look at Windows PowerShell. Instead of the UNIX 'everything is a file' philosophy, it says 'everything is an object', and it's pretty cool.
I would pay good money for a PowerShell implementation on Linux, and even more if Linux internals were exposed in the same way that WMI objects are on Windows.
And this is from a thirteen-year Linux veteran.
"Sometimes, I think Trent just needs a cup of hot chocolate and a blankie." -Tori Amos on Nine Inch Nails
The Simple solution in my opinion is to simply have the GUI windows, with a section at the side for terminal.
Whenever the user ls (or dir)'s from the terminal, the GUI changes. If you click on something in the GUI, the terminal automagically puts in the exact path to the object in the GUI.
Best of both worlds, might be fun to do.
But if we moved to this model, how would I give tips on climagic? I'd start having to post links to screen shots. I kid. Sounds like this guy is trying to turn the command line into the multilayer net with protocols between the programs.
If i cat something, it is because I want to see the source, not the interpered result.
"You can cat a PNG and have it just work."
Uh, no, Doctor Disorthogonality, you broke it. When I cat a PNG I want to see the bytes, not a picture. If I want to see the picture I'll firefox or gimp the PNG, then it will just work.
And fixed-width fonts for data are ideal. Using a variable-width font and trying to od anything is a freaking nightmare.
Ever since I got my Nokia N800, it has been obvious to me that an xterm on a mobile device is extremely limiting. So when I saw the TermKit post on LWN, I went right to the blog article. The idea is extremely inspirational. I would love to see someone do a tablet/handset shell/term project that incorporated some of TermKit's ideas. Scared to death that TermKit has grep and ls implementations. Love the idea of 'cat foo.png' to see an image in the terminal.
why not offer an 'easy' path for those who don't have the shortened commands memorized?
Because you would be encumbering every one with a verbose syntax. After just a few times you'll feel it quite easy to remember that 'move' is 'mv'.
Once you learn the short way to do it you don't want to spend the extra effort in the long command. You may think it only takes one second to type, but you forget how many thousands of times you'll be using the same command again in the future.
This has lead to "somewhat parseable text" being the default interchange format of choice. This seems like an okay choice, until you start to factor in the biggest lesson learned on the web: there is no such thing as plain text. Text is messy. Text-based formats lie at the basis of every SQL injection, XSS exploit and encoding error. And it's in text-parsing code where you'll likely find buffer overflows.
?
Thus says the guy who's implementing a HTML5 + CSS + JS client / server terminal wrapper. Hey, FYI, your whole TermKit stack is made of parsed text. Indeed, the only way to access your API is via parsed text. As if Webkit (that TermKit is build on) never has any "buffer overflows". Pffffft. Added complexity, more surface for bugs to appear, 'nuff said.
Also -- No thanks. I already have a window manager. I agree that occasionally mouse input is the right choice, and an environment that embraces both text terminal and GUI elements is neat, but I just couldn't stand to read any more of the Hypocritical remarks...
He talks about displaying objects and passing them around as JSON objects -- Yeah, JSON is a textual representation of an object that must be parsed to be displayed.
P.S. Only available on Mac? What the duce? It's just a HTML / CSS + JS interface -- If the guy had any brains you could just point any browser at it and he'd have saved the time of writing a complete client... unless... the goal is to take some elitist (noob) stance regarding UI.
More "Text is Sloppy" hypocrisy:
TermKit's input revolves around tokenfield.js, a new snappy widget with plenty of tricks. It can do auto-quoting, inline autocomplete, icon badges, and more. It avoids the escaping issue altogether, by always processing the command as tokens rather than text. Keys that trigger special behaviors (like a quote) can be pressed again to undo the behavior and just type one character.
The behaviors are encoded in a series of objects and regexp-based triggers, which transform and split tokens as they are typed.
Uhhhggg.
This seems to be a really interesting opportunity for fun security problems. :)
I mean, from the attacker perspective...
I don't understand why there is such a push to use grids to display sorted lists. Unity, Gnome 3, Android, Windows Explorer, iOS, MacOSX, etc. (even posix CLI commands such as ls): all of them have default settings to take a list of elements and then break the list up into meaningless rows and display a grid. I find it far too easy to miss important elements in these grids and I observe this behavior in others. Why are grids so damn popular?
Note that in this instance I am not complaining about grids where the user can create an arbitrary organization (such as a desktop not set to auto-arrange), but when the computer is taking a list of items and organizing it for you in a grid.
Some tool found a way to both reduce contrast AND waste visual space in a text terminal. Ooh, and he got rid of that useless rate and ETA information in wget. Bonus.
I like the simplicity of Xterm. It works well with SSH, can talk to endless serial devices (like console terminal login on headless stuff) and can run over a modem. All I need is twm and Xterm and I have a nice lightweight X desktop on a server for installing Oracle. There aren't a lot of dependencies so I can keep the software footprint small. Updates are faster and few.
Now in KDE on a desktop, something like Termkit might be more practical. Don't forget though, eye-candy comes at the expense of resources. You can't have all that bling without giving up cpu or ram. In the end, is the payoff worth it to be able to run a screensaver in your terminal?
All the work that went into the Compiz bling; it's cool but I just don't use it. The exploding windows are neat, I just don't see the point in having a desktop that contributes to my distractions.
boycott slashdot February 10th - 17th check out: altSlashdot.org
Take a look at Windows PowerShell. Instead of the UNIX 'everything is a file' philosophy, it says 'everything is an object'
The big advantage of the Unix philosophy is that plain text is human readable. 'Objects' have this terrible problem that you always need a specific program to read and write them. With plain text you can see the data structure at a glance, you don't need to get some separate documentation that may be wrong, not up to date, or not even exist.
Plain text is output to the screen and input from the keyboard. Any program that writes text to the console can send data to any program that reads text from the keyboard. This means development and testing is simple, you do it one module at a time, type the input and watch the output. And you can very easily combine different programs in a way that no one tried before.
I don't think powershell offers any advantage over the way Unix has been working for forty years.
Maybe if it could emulate a plain color terminal so I could run things like vi, screen, etc. But only being able to type commands seems a little restrictive.
You missed the biggest pro of them all, central to the Unix philosophy: Composition of simple tools to do complex tasks.
With a GUI, you are bound to whatever the GUI designer has included, and basic features are replicated endlessly in different GUI:s. For example: If I want to process five files with some program in a command line, I can list them with ls or find, type them manually, or cat the list from a file, just to name a few ways. With a GUI, you often have only the Open File Dialog, built right into the processing program, and that's it. In that case, creating the list of files is not separated from processing them.
This seems to be completely the wrong crowd for this development (it is hugely upvoted on Reddit, though), but one reason this may be an improvement is simply that it can combine the speed of writing a command-line program with the visual appeal of a web or GUI application. Speaking personally, there are many times I write a command line program simply because I don't want to invest the time and effort in a GUI program and a web app just isn't appropriate for the task. With this system, I could just output HTML instead of text, and now I've got a nice looking semi-graphical app that's still quick to write and easy enough to use.
I'm not sure I'm getting the view out and data out thing. I guess I understand the idea, but if I'm seeing different output then what the next command in the pipe chain is seeing, then how do I know that its receiving the right data in the right format?
will suck up too many resources
What are you using? A 66mhz g3?
Unix is meant to be difficult - it keeps idiots out of the datacentre.
Ha ha, only serious.
C-x C-s C-x k
The reason terminals are so useful is because they have greater usable information density than really any other interface. The article desperately misses this in its lead about the 2.3 megapixels of display space, and the presumed potential information content. But a terminal has quite a lot of information in it! Far more information--from a human usability POV--than the oversized icons this TermKit uses to adorn every small bit of textual information.
For example, on my MacBook Pro, using a pretty large font size, I run a 90x48 terminal (with multiple tabs, but that's a different issue). This terminal occupies approximately half of my display (sometimes I put another one next to it, though there's slight overlap at my screen size, font size, frame elements, dock/menu bar, etc). Now, as we can see using the 'calc' utility I wrote for systems I work on:
505-Documents % calc 90x48 # result on stdout, canonical form of expression on stderr
90x48
4320
Well, 4k-ish characters isn't that many positions (but it's not tiny already), but each of those characters might be any of approximately 256 values. Saying exactly how many it is is a little tricky though. Many of my tools (e.g. the bash prompt itself, ls, less with lesspipe, vim, etc) colorize output, making for multiple easy distinguishable ways the letter 'A' might appear. On the other hand, while high-bit characters are not generally usefully or frequently displayed, modern terminals *do* display many thousands of Unicode characters potentially. So as an approximation, we might say that there are approximately 1.1M easily distinguishable states of my terminal. I know, of course, that, most of the time most of the characters that display are along the left edge of my terminal, and the right side is largely blank. But nonetheless, there are at least a couple 100k states that are both plausible and importantly EASILY distinguishable... not *instantly* distinguishable, of course. Obviously, my eyes need to flit back and forth a while to compare, say, the file sizes and permissions of a bunch of things that show up in an 'ls -l' display. But it is still at least an order of magnitude more information than I'd discern with equal ease using TermKit (or, say, using a GUI file manager like Finder) to look at the same 'ls -l' directory.
Obviously, the theoretical information content of a high-res display is enormous. If I even have a 16-bit display, running somewhere over 1.5 megapixels (my screen is apparently slightly lower res than Steve Wittens') that's something like... well, more than the number of particles in the universe, possible states (e.g. (2**16)**(1680*1050)). But in fact, as a human, I really can't meaningfully distinguish nearly any of those states. I can't even *see* individual pixels, nor distinguish very close colors very well. But even within my actual perceptual threshold, I cannot give direct meaning to a slight color difference in some small part of the GUI screen, except in very broad categories that contain a few bits of information each. My recognition and discernment of the meaning of *characters* of my native language is far greater than some other graphical abstraction.
Buy Text Processing in Python
The *nix philosophy can be more accurately stated as "Everything is a file, except when it's not, and the meaning and syntax of the file can only be understood by examining the source code of all the programs that might potentially want to read or write it, as well as all the documentation, and location of the file in the file system hierarchy, and the ownership of the file and the permissions on the file, and what kind of filesystem it's sitting on, and how the filesystem was mounted, and by the way, and streams aren't files and files aren't streams, and it's not very consistent between various *nix variants." OK, that's files, now let's rant about programs' I/O, which is even more random. :-)
You COULD make everything neat and parseable and self-descriptive and consistent, but then it wouldn't be like UNIX(tm), it would be a Plan-9y sort of thing.
Every object has a mandatory .ToString() method
Two possibilities:
A) ToString lists exactly all the properties of the object. Then *why* have the object at all, why not use the string itself?
B) ToString does not list exactly all the properties of the object. So, what if you need something that ToString does not list?
I see this problem with Python objects, they have a __str__ method and a __repr__ method. They are useful as a reference, but they are often incomplete. Unless you have a good documentation you cannot rely on them.
I don't always re-implement basic Unix commands, but when I do, I do it in javascript.
Having a somewhat similar idea.
Well, not exactly, but it's been a long time since I've suspected that there is something fundamentally flawed about the idea of having a cellular grid of glyphs trying to pretend that it is a teletype.
The first problem is that no input (no new commands) is accepted while a previous one is still being executed. Of course shells allow the user to place a job in the background, but if it outputs any text (or does some tricks to update text that is already on the screen), your input and output are melding into a mess.
Another thing is that there are layers of abstraction over the raw terminal emulator interface, like readline or curses. The first tries to make editing a command a smaller pain, the other one's role is essentially to turn the terminal emulator running on top of a grid of character cells... back into a grid of character cells.
I think it's time to get rid of terminal emulation. It's 2011. I consider myself a Unix geek (of a younger generation), and I haven't seen a real serial terminal even in a museum. Of course I'm sure that some of you guys have one at home, maybe even hooked up to your box's serial port. But hold on, because what I'd like to propose would be backwards compatible - it could easily be emulated on top of curses, and still would be able to be interfaced with via stdin/stdout/stderr.
Well, the idea is to take our 80x25 grid of characters and provide a completely raw, low-level API to it. API like, "put glyph 0x41 in position 0,0". curses can do that, but it's two unnecessary layers of abstraction, so better just take an X terminal emulator, rip out all the terminal emulation code, and provide THAT api over it. Now, the second step is to let a library manage this area - if you want to emulate a VT100, just put a VT100 widget in there. If you want to run a curses-based program, it would make sense to port ncurses to use this backend. But the most interesting thing (IMHO) is the new (old) text user interface that I've conceived.
Basically you have your cellular grid split into two non-overlapping areas, one short at the bottom, and one tall, taking up the rest of the vertical space. The bottom one is an input buffer, the other one holds the output. Seems familiar? Of course, that's how all chat programs and IRC clients have been looking like since the beginning of the time. Also, this resembles how Emacs handles its minibuffer, or if you stretch the idea even further, that's the relationship between dmenu and the rest of your X display. So it's a well-tested paradigm.
So, what else exactly does it change? As I said before, you can run all of your commands automatically in the background, and they could keep updating the output with useful information as they go. No more need for readline - or rather, it would get integrated with the input buffer. Or possibly something else, I suspect that it would be quite possible to embed an Emacs or Vi buffer in there. Also, as the output buffer is just a widget reading commands' stdout&stderr, we could let it interpret the output and format it in various ways.
There is lots of lots of really fancy stuff that one could possibly do with such an UI. The raw grid area could be split into more areas, so that you could have all sorts of statusbars or sidebars displaying realtime stats (like screen or tmux do). If the terminal window is running over a graphical display, I would dare to say that doing what TermKit does would be even funny&profitable (although I'd probably do many things differently than TermKit... I have a deep hate for all things web). It could be abstracted to let software run unchanged both under graphical and text-based displays.
I have lots of other funny ideas in my mind, but can't really shape them into words (or code) yet.
I am a geek and thats just my *character*
Anybody who is housemates with cats knows full well there there is more than one output path.
STDIN frequently doubles as STDERR.
the preceding comment is my own and in no way reflects the opinion of the Joint Chiefs of Staff
I've often wanted to have a CLUI that works with my GUI. Imagine I'm in Photoshop, mousing or tablet-ing away, and I have a layer on my canvass. Rather than trying to remember where in the menu structure a bunch of commands are in order to manipulate that layer, I just bring up my CLUI and type something like "resize 50%, flip, gamma -20" Or how about in Word: "Find foo replace bar, insert header from page 2-", and so on?
Why are we forced to find commands in mouse-driven menu bars (of worse, "ribbons" and whatnot) when they could be available any time in the app you are using?
"And the meaning of words; when they cease to function; when will it start worrying you?"
Talking about those who do not know history, XMLTerm in 1999.
__
Men with no respect for life must never be allowed to control the ultimate instruments of death.
GW Bu
Not sure about Linux, but in Windows Command Prompt I can't copy & paste conveniently.
I have to right click the mouse to select 'paste'.
And when I want to copy, I need to right click and select 'mark' and then mark the areas, then press Enter.
I wonder if I missed something obvious, because if there is some hot keys I can save a lot of time.
The operative question is out of all the atomic operations one can do to an object, which are most likely to least. For example with an existing PNG one can either view, or change, with the former being less destructive especially in the context of "Cat".
hahahahahaha! this made my day! what a ridiculous concept. only a mac user could come up with a gay tinkertoy like that! this guy has clearly not understood, how cool a text terminal really is. i do nearly all my stuff on a terminal (even sound and video editing and to some extend image processing) and will never cease to do so, because it's the fastest and most efficient way a human can work on a computer. it's fucking powerfull, don't you get it?
There is a text command window where you can type "tan to" and then click somewhere near the curve and your line will make a nice tangent to the curve. QCAD does it as well and I'll be the things AutoCAD was written to replace had it as well.
Actually, if you use Emacs, ^X-^F lena.png works fine.
Installation procedure doesn't work, too bad. The GIT fetch of the package fails over some certificate issue. Blah... http://tech.slashdot.org/story/11/05/19/1648200/Imagining-the-CLI-For-the-Modern-Machine?utm_source=headlines&utm_medium=email#
Very good points. Plan9 is certainly interesting.
However, there is a few obvious but important differences between "everything is a file" and "everything is an object": Encapsulation and reflection. In PowerShell ps produces a sequence of System.Diagnostics.ProcessInfo objects. This type has methods like Kill (terminate the process), Refresh (refresh the properties for CPU usage, mem usage etc), WaitForExit, WaitForInputIdle etc. When the objects are self-discoverable (reflective) it alleviates the need for specific external commands.
Consider how the COM object Excel.Application comes with methods for manipulating workbooks/sheets, calculating etc. This allows you to directly use the very same objects and methods as used internally by Excel:
$app = new-object -com Excel.Application
$app.DisplayAlerts = $false
$wb = $app.Workbooks.Add()
$ws = $wb.Worksheets.Item(1)
$ws.Cells.Item(1,1) = "Life, the Universe and Everything?"
$ws.Cells.Item(1,2) = "=6*7"
$ws.Calculate()
$question = $ws.Cells.Item(1,1).Text
$answer = $ws.Cells.Item(1,2).Text
$app.Quit()
echo "$question $answer!"
Also consider how the objects can be designed for use within an application as well as on the command line. Although not obvious at first, this is a major point which will help drive automation and scriptability. Exchange has since version 2007 used used the very same "command" objects within the GUI as are scriptable on the command line. Because the commands are handling in-memory objects with no text/JSON/xml serialization when combined they are suitable for applications as well as CLIs.
Reading slashdot one-liner: (irm http://rss.slashdot.org/Slashdot/slashdot).rdf.item | fl title,desc*
Ironically, most of the time I drop into the shell on my Windows box is when I get annoyed by all the stuff which gets in a way of doing work.
File Manager of Windows 3.1/3.11 was quite useful. And fast. Original Win95's Explorer half so useful but still OK, since keyboard support was OK. But Win2k/XP made a step back by essentially breaking the keyboard shortcuts, by introducing bunch of useless sidebars. Win7 made the Explorer essentially a nice frontend for the Picasa and Mercurial - I personally can't use the new Explorer for anything else - it is simply way too unpredictable in both behavior and performance.
All hope abandon ye who enter here.