11 ms·
Lsd: The next gen ls command
- lucasmullens 7y agoIs there a list of features? Or can I assume it implements the same features as colorls?
- hyh1048576 7y agoI've noticed a lot of command line utilities are being rewritten in Rust. Is there a reason for this?
- empath75 7y agoI’d say it’s about 80% projects for people wanting to learn the language and 20% about safety, speed and concurrency.
- addicted 7y agoIn this case it appears they are getting better performance than colorls, whose features the author presumably likes.
- gnulinux 7y agoPossibly because 1. People predict Rust will be more popular in the future, so they're trying to learn/master the language by practicing it. 2. People think speed and memory safety are important guarantees for unix programs. 3. People are testing whether Rust deserves the fame it has
- megous 7y ago> 2. People think speed and memory safety are important guarantees for unix programs. I don't think any of the typical unix tools ever segfaulted on me in the last 15 years I use Linux.
- coder543 7y agoSegfaults are the ideal case for memory errors, and those are the most easily caught and fixed, so you're least likely to see them. But, often those memory errors result in silent corruption which can be exploited, and that's harder to detect, especially if it relies on very specific corner cases. `curl` has had a number of these vulnerabilities over the last several years, for example. Something as simple as `ls` is probably so small and battle tested that it's not an issue, but if you're writing an all-new, not-battle-tested tool, why wouldn't you want stronger guarantees? The new tool is being written for the features, but it's not fun to write vulnerabilities into something that should be simple and "just work." Languages like Go and Ruby are also mostly memory safe, so those are generally fine picks here too, but every language has trade offs. In this case, the author clearly cares about performance, which Ruby does not care about. Rust also has a built-in testing harness, which is a lot more convenient IMHO than using whatever C testing framework you might have a predisposition towards.
- hermitdev 7y agoRegarding segfaults, when I was interviewing devs for C++ roles, I'd ask questions about a simple function like this: std::string foo(bool flag) { if (flag) return "true"; } Questions I'd ask: * Is the function well formed (Yes - functions need not return a value on all paths due to C ancestory, even if the return type has a non trivial actor - not sure if this is still considered well formed, but I think it was as least to C++11) * what happens if 'foo' is called with true? (Returns "true" as one would expect) * what happens if 'foo' is called with false? (Undefined or implementation defined behavior, but generally nothing nice - segfault, acces violation, etc) * if it crashes, where, when and why does it crash? (Technically since its undefined, nearly any answer here suffices, if it can be backed up. Since practically, most optimizing compilers assume UB can never happen, when you return nothing from a non-void function, the compiler will attempt to invoke the destructor of a non existent object instance (assuming non POD) and boom.) I asked this because it was a distilled example of a real world rare crash that was extremely difficult bug to track down because the crash location is often know where near the offending function. I remember getting into a heated argument with a coworker when I claimed it should have been a compilation error. IIRC, he claimed it to be a halting problem and that the compiler couldn't determine that all paths didnt return a value. I called BS, citing at the time (circa 2004) that the new compiler on the block for C# could reliably emit errors when not all return paths returned a value. I also like it that in C++, it's a very rare example of a very terse example dealing with a number of topics such as undefined/implementation defined behavior, debugging, compilation settings (warning levels, etc) all in a mere 4 lines of codes. With 4 LOC, which is straight forward and simple for the candidate to mentally parse, I can gleam a lot about their understanding of the language (and it's potential pitfalls). Sorry if this got a little long winded and ranting.
- mhh__ 7y ago1. Hype 2. Rust is, despite reasons for which I don't use it, a good language which seems to achieve it's goals 3. Why not
- c3534l 7y agoBecause it's a low level system's programming language with Haskell influences (makes it good for modelling a well-defined problem domain) with the "rewrite it in Rust" meme behind it. It's meant to be a replacement for C, so it makes sense that rustaceans would want to write replacements for programs written in C.
- ThemalSpan 7y agoI think its worth mentioning that rust has the gold standard argument parsing library now: https://clap.rs https://clap.rs That library is used by most(?) rust cli tools, so they all have a similar feel. In addition, there is a library built on top of clap called struct-opt that makes bringing up a new cli exceedingly easy: https://docs.rs/structopt/0.2.15/structopt/ https://docs.rs/structopt/0.2.15/structopt/ Seriously, checkout struct-opts page even if you don't know any rust. I think their demonstration on the front page summarizes a lot of things I like about idiomatic rust.
- rakoo 7y agoI haven't needed it in a long time, but I still think trollop for ruby is magical. It seems it's been renamed to optimist now: http://manageiq.github.io/optimist/ http://manageiq.github.io/optimist/
- epage 7y agoI'd say Rust is a productive language for providing competitive CLIs. - Compiled so easy to distribute compared to Python, JS, etc - Cargo makes it easy to pull in libraries compared to C/C++ - Smart people made some great libraries that make it trivial to get performance and/or a nice UX. e.g. Everything in ripgrep is available for reuse, down to how it walks the filesystem.
- empath75 7y agoHow does this compare to exa.
- tambourine_man 7y agoI don’t think exa uses nerdfont for one. It’s also a lot faster, according to the benchmarks.
- h1d 7y agoexa does have a fork which does but exa's development seems to have paused. https://github.com/ogham/exa/pull/368 https://github.com/ogham/exa/pull/368
- crystaln 7y agoIt has a much better name for one.
- cjauvin 7y agoEven though of course nothing beats the power of a set of standardized and ubiquitous tools that you can always count on whenever you find yourself on a new machine, I must admit that I'm favorably inclined toward this trend (or what I perceive as one) of rewriting classic CLI tools with sometimes radical performance improvement promises, but most importantly (for me at least) better UIs: `grep` has always been acceptable for me, but I prefer `ag` these days, and I recently discovered `fd`, which seems like it will replace `find`, as I could never remember its weird syntax, even for the most basic cases.
- crowbahr 7y agoThank you. Find is so complex and looking at fd is a revelation here. Now I feel like all my hard earned cli-fu is a lie.
- michaelcampbell 7y agoCare to share a link? Using fd as a utility name for an os that already uses the word fd as file descriptor is maddeningly hard to find
- thunderbong 7y agoI'm assuming it's this - https://github.com/sharkdp/fd https://github.com/sharkdp/fd
- deleted 7y ago[deleted]
- h1d 7y agoIt's the first result for a maddeningly simple search of "cli fd".
- hermitdev 7y agoI remember posting a bug to WSL about supposedly incorrect behavior with find, only to realize that I had incorrect syntax. I forgot to include the escape on the terminating semicolon (also, conveniently never shown the man pages), or maybe it was the enclosing parens around an or for name pattern matching. Anyways, Id been away from *nix for a few years at the time, so I was a bit rusty and soon felt like a moron and closed the bug once I realized my error.
- gremlinsinc 7y agowow this is amazing... I love the file icons and it's beautiful... ls --tree ran almost instantly on a laravel folder which has a huge number of packages....
- incanus77 7y agoThey’re gonna need a better list of reasons to try it out than: 1. It’s written in the author’s preferred language
- ksherlock 7y agoWish it would disable ANSI stuff (--classic) if it's not a vt100/xterm/etc TERMinal.
- reddotX 7y agoto install "sudo snap install lsd --classic"
- lifthrasiir 7y agoEvery time I see a project using icon font sets (this particular project recommends Nerd Font [1]), I feel something is very wrong. We already have a sort of way (or two) to represent an image in the terminal, but icon fonts are a different beast because it essentially supports a vector representation. Code point collision is already happening (Nerd Font is already coping with this [2]), and in a long run this seems unsustainable. So... is there any way or proposal to encode a vector image in the terminal? (And no, iTerm doesn't seem to support SVG in its inline image support [3].) [1] https://github.com/ryanoasis/nerd-fonts https://github.com/ryanoasis/nerd-fonts [2] https://github.com/ryanoasis/nerd-fonts/wiki/Codepoint-Conflicts https://github.com/ryanoasis/nerd-fonts/wiki/Codepoint-Confl... [3] https://www.iterm2.com/documentation-images.html https://www.iterm2.com/documentation-images.html
- darkpuma 7y agoxterm has a Tektronix 4014 mode, but that's not exactly what's needed or desired..
- msla 7y agoxterm also has sixels, which give reasonably high-resolution color graphics in normal VT340 mode. https://github.com/saitoha/libsixel https://github.com/saitoha/libsixel By high-resolution I mean you can display JPEGs using sixels. You can run OpenGL programs using sixels.
- pcwalton 7y agoUnfortunately, the Unix terminal is a gigantic pile of hacks accumulated since the late 1960s. It's a miracle the software stack manages to stay upright at all; adding features and getting the entire ecosystem to support them would be tough. Introducing the concept of an external resource that has to be fetched doesn't seem impossible to me, but there are a lot of issues that would have to be thought through. Anyway, one nice thing about TrueType/OpenType fonts is that the vector representation is extremely well compressed. SVG or similar would be an efficiency loss. In this light, fonts are actually a fairly decent and practical way to represent vector symbols that will be cached and reused. Maybe a minimal practical solution might be to add an ANSI extension that requests an appropriate font for a particular area of the screen, perhaps with a URL from which a specific webfont can be fetched.
- fao_ 7y agoLooking at the example -- do the symbols really help any more than just normal highlighting, and, `x --> y` and `/` at the end?
- deleted 7y ago[deleted]
- anderspitman 7y agoHas anyone made an "awesome" list of new CLI tools designed to replace ancient ones?
- h1d 7y agoFound some links. https://github.com/alebcay/awesome-shell https://github.com/alebcay/awesome-shell Only for rust but not a bad list I think. https://lib.rs/command-line-utilities https://lib.rs/command-line-utilities Some blog post introducing cli tools. https://darrenburns.net/posts/tools/ https://darrenburns.net/posts/tools/
- bmn__ 7y agohttps://altbox.dev/ https://altbox.dev/
- ac29 7y agoThis might be the sort of thing you're looking for: https://github.com/agarrharr/awesome-cli-apps https://github.com/agarrharr/awesome-cli-apps
- chmln 7y agoOne major showstopper I have with this utility is that it doesn't obey my terminal color scheme and instead hardcodes some colors that probably just look good on author's terminal. [1] Would love to see this resolved, cause it seems rather nice otherwise. https://github.com/Peltoche/lsd/issues/90 https://github.com/Peltoche/lsd/issues/90
- superconformist 7y agoIt doesn't install a man page for itself, requires weird-ass fonts, has a fraction of the features of the real ls [0], and runs about half as fast ... However it's written in our lord and savior RUST and has lots of colors so this shit is definitely "next gen." 0: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls...
- hermanradtke 7y agoI will stick with exa instead. https://github.com/ogham/exa https://github.com/ogham/exa
- guytv 7y agoI am using exa now, and was wondering the same thing. Could you explain why you made the decision? what's the difference?
- echelon 7y ago> our lord and savior RUST So you're using this as an opportunity to bash an entire language ecosystem? The merits of this project have no bearing on Rust or its adoption.
- bobbylarrybobby 7y agoI think they were referring to the fact that when a new popular language arises, people rush to build things in that language and then act as if the language itself is sufficient to make the resulting product good instead of any inherent merits.
- paulddraper 7y agoI don't think the parent was bashing Rust. I think the parent was bashing the attendant hype and the resulting reinventions but worse. There was a blog I read about the Rust Zealot Brigade (or similar name) that would reliably descend on any HN conversation.
- 7y ago
- xwdv 7y agoThis project becomes pretty ridiculous when you realize you can already accomplish the same features with regular ls, if you just bother to read a bit. That means the target audience for this is very junior engineers.
- tambourine_man 7y agoCan ls use nerdfont? Does ls color coding display anywhere near the granularity that lsd and colorls feature? So please drop the dismissive patronizing tone.
- ddeokbokki 7y agoOP's point is that if you know how to use ls you don't need icons and extra granularity in color scheme to understand the output.
- tambourine_man 7y agoIt’s not a valid point nor was it properly articulated. It’s obviously not a matter of needing, but of aesthetics and usability, and that’s very much a valid pursuit.
- moomin 7y agoThe same is true of reading a hex dump of the inode table. Improved UIs can matter.
- xwdv 7y agoYes. Learn to use dircolors.
- tambourine_man 7y agoProve it. Show me the output of BSD or GNU ls and compare it with lsd.
- 7y ago
- thatguy1 7y agoThere is an easier way to do this - Use File Manager UI
- caymanjim 7y agoThis is pretty and all, and there's nothing wrong with it, but...why? Do people run ls enough that they need something more than a plain ASCII list of filenames? Are peoples' directories so disorganized that this adds enough value to justify it over /bin/ls? I probably run ls a few dozen times a day, but it's usually just to answer "what did I call that file again?" or "did I remember to copy that over?" I can't imagine a scenario where I'd require too many extra visual cues. I use color ls, mostly because I find the optional symbols like '/' to be distracting, and differentiating files and directories via color is about all I care about. There's overhead in becoming too attached to non-standard tools: you have to go out of your way to install them, your muscle memory needs retraining, etc. Most importantly, tools like this break a bunch of core command line standards, like doing one thing and doing it well, and producing clean output that can be pipeline-filtered with all the other Unix standards.
- JdeBP 7y agoOne need only consider that Orthodox File Managers have been in existence for decades to realize that yes indeed people do like to work with more than plain lists of filenames. Playing the "doing one thing" card when it comes to ls is rather risky, as ls, with its options for doing things like sorting its output, is one of the favourite examples that people point to of tools that do not adhere to this philosophy in practice. * https://news.ycombinator.com/item?id=4023265 https://news.ycombinator.com/item?id=4023265 * https://news.ycombinator.com/item?id=9673975 https://news.ycombinator.com/item?id=9673975 * https://news.ycombinator.com/item?id=8484718 https://news.ycombinator.com/item?id=8484718 ... and so on.
- estomagordo 7y agoGiven the name, I was surprised at how much sense the choices of colours made.
- nikeee 7y agoHow does it compare with exa? https://the.exa.website https://the.exa.website
- jasonhansel 7y agoWe really need a way for terminfo/termcap to indicate whether a user has Powerline fonts. Would be great for programs like this.
- sridca 7y agoWhy would I use this over exa? https://github.com/ogham/exa https://github.com/ogham/exa
- jenhsun 7y agoI use below sometimes. Hope you guys like these. A modern replacement for ls, written in Rust. https://the.exa.website/ https://the.exa.website/ ls with coloring and icons https://github.com/Electrux/ls_extended https://github.com/Electrux/ls_extended