197 points · by triyanox · 2y ago · 154 comments
While these may be sufficient for a naive developer, this oversight then breaks many downstream tools.
Again though, thanks for sharing. Bringing your own spin and ideas into the world can be anxiety inducing and I'm pleased you went about this in a helpful and measured way!
The software is provided as is, in the hope it will be useful, but without any warranty whatsoever.
All free and open source software licenses contain some version of the above statement.
All of this is implicitly for personal use. In the sense that it's not a product, just something people made because they needed a problem solved.
However, this is a website of opinions, and gp's opinion is valid, because this forum is where opinions go. It's not as though gp said to stop doing this project.
This pedantic finger wagging is just so rote.
One says that open source projects should clearly state when they are not meant as a serious replacement for standard tools. The other says that they disagree and that open source projects don't have to give any warning.
I guess I am a little in-between: if you open source your code, I don't think you have anything to do (it's already nice to put an open source license on it). If you advertise your open source tool (e.g. on this website), then it is polite to set expectations.
These hidden "expectations" that people seem to have regarding free and open source software can be incredibly demoralizing. It's something I wish would change. That's why I commented on it.
Feature-request: bring back clickable ls results!
Bonus points for defining a new term type and standard for this.
You see, Genera knows the actual type of everything that is clickable. When a program needs an input, objects of the wrong type _lose their interactivity_ for the duration. So if you list the files in some directory, the names of those files are indeed links that you can click on. Clicking on one would bring up a context menu of relevant actions (view, edit, print, delete, etc). If a program asks for a filename as input then clicking on a file instead supplies the file object to the program. Clicking on objects of other types does nothing.
I have this side-project fantasy of a very simple terminal pipe-types project. The basic idea is a set of very basic standardized types, demarcated using escape sequences. Dates, filenames, URLs, numbers, possibly one or two number units as well (time periods, file sizes only).
Tools that already produce columnar data (ls) get a flag that lets them output this format, and tools that work with piped data (cut, sort, uniq) get equivalents or modes that let them easily work with this.
Essentially, simple typed tables held in text, with enhancements for existing tooling to know how to deal with it. Would make my day-to-day on the command line much easier.
$ man ls | grep '\--hyperlink' -A 1
--hyperlink[=WHEN]
hyperlink file names WHENYou should be able to get this to work on Unix with plan9port.
> Feature-request: bring back clickable ls results!
Doesn't your desktop (or distro) have a graphical file manager? On KDE it's Dolphin, which ex-Windows users absolutely love. I don't know what it would be on Gnome or other desktops.Efficient file listing: Optimized for speed, even in large directories
What exactly is it doing differently to optimize for speed? Isn't it just using the regular fs lib?
Checkout the man page: https://www.mankier.com/1/gio
highlights:
- showing progress in `cp` equivalent
- Easy cli interface to freedesktop trash (!)
- tree command
- filesystem changes monitor (inotify wrapper)
This is basically a Show HN without a summary I think.
fwiw:
I wonder if it was always like this or we're getting further and further from the idea of keeping programs simple and open.
This project in particular is not being sold as a drop-in replacement for ls.
Among a few things it does that `ls` (and other alternatives like `eza` don't do) are: - icons (SVG icons in terminals that support it, Nerd Fonts otherwise) - advanced filtering using regex - advanced sorting across multiple sort bases - styles and colors using customisable rules
For someone wanting to make the output of `ls` prettier (with a few extra bells and whistles) without having to relearn a new workflow, something like an `ls` replacement makes more sense.
[1]: https://pls.cli.rs [2]: https://dystroy.org/broot/
`eza --long --hyperlink --header --all --icons --git --sort name`
also the hyperlink thing is useful
This tool by triyanox -- just from the screen shot if you click through -- will also colorize permission masks and sizes, dates, user & group.
Two settings for ls make some of the colouring less useful to me.
BLOCK_SIZE='1 formats sizes in bytes with comma separators. TIME_STYLE=long-iso formats the dates sensibly.
This means entries line up in neater columns.
-rwxr-xr-x 1 root root 852 2024-02-23 22:31 zsh5
-rwxr-xr-x 1 root root 1,022,760 2024-08-09 04:33 zstd
lrwxrwxrwx 1 root root 4 2024-08-09 04:33 zstdcat -> zstdI see a screenshot that looks like the output of ls, ok it has colors, and some filenames have "!!" behind it. Great success?
While I like it and it's a good idea, I think the reality is that developers capable enough to write shared library/DLL plugins are more likely to just submit PRs and make such stuff built-in but maybe optional.
> more likely to just submit PRs and make such stuff built-in but maybe optional.
Which are more likely to just be rejected by the more conservative maintainers of the tool. That's the empowering beauty of plugins - no such barriers
[1]: https://pls.cli.rs
What good is a ls alternative if I need to install it everywhere I need ls? I'd prefer using the standard ls even if it is not ideal. But maybe that's just me.
Imagine a car mechanic that won't use a big hydraulic lift that hoists a car in seconds and lets him walk under it, claiming that by using a manually cranked portable jack, he can be almost as productive when fixing something by the roadside with emergency equipment as he is in his garage.
If you ever meet such a mechanic you can be sure that he programs computers as a hobby.
I spend maybe 1% of my working hours (being generous) using `ls` and something like 50% (likely more) using my editor.
If there is some alternative to `ls` that makes my `ls` workflows 2x faster, my productivity increases by 0.5%. If I use a sub-optimal editor that makes my workflow 2x slower, I lose 25% of my productivity.
When I need to login to a remote box, I am also very likely to need to use `ls` since I am less familiar than on my own machine, whereas I am unlikely to do any sort of heavy development work (typically I just need to edit a couple configuration files, or do some git operations).
I developed on SCO (and, later, Unixware) on a PC, all of the clients were running the gamut of Unix OSes: HPUX, DGUX, AIX, SunOS, you name it.
Most of the time was spent on our box in the office, but I was constantly bouncing back and forth to client systems. Either on site, or over the modem. Having to juggle Termcaps and the whole thing. It was polyglot machine/OS world back then.
Just had to learn to get the best out of a baseline set of Unix tools. vi instead of emacs, awk instead of perl. Master those and never be left wanting on a new environment, so I can hit the ground running. No need to "bootstrap" (if the client would even let you, not always). Couldn't even rely on a C compiler.
(Thinking it was Ubuntu server, but guessing someone will correct me)
Nowadays, and possibly for the better (every line of code is a potential bug and every bug is a potential vulnerability) it seems like systems don’t want to include this sort of stuff. So, I’m sure if the decision were made today, tmux or screen, tmux would win. Unfortunately, “none” seems like the real future option…
This doesn't mean there's no value in developing one's own tools. Contributing to other projects can be quite difficult and time consuning. GNU projects are even more so.
We shouldn't limit ourselves to POSIX stuff either. Better software and tools can and should be built. Every attempt is valuable. And who knows? It might just turn into a staple of Linux distributions some day.
man dir_colors
I think.But recently, there were two submissions here that actually turn the "rewrite in Rust" meme into something substantial.
The two factions of C++ https://news.ycombinator.com/item?id=42231489 On "Safe" C++ https://news.ycombinator.com/item?id=42186475
Be warned that the second one is a really long read!
For reference, those are the ones I am familiar with. They are somehow active in contrast to things like exa which is not maintained anymore.
eza: (https://github.com/eza-community/eza)
lsd: (https://github.com/Peltoche/lsd)
colorls: (https://github.com/athityakumar/colorls)
g: (https://github.com/Equationzhao/g)
ls++: (https://github.com/trapd00r/LS_COLORS)
logo-ls: (https://github.com/canta2899/logo-ls) - this is forked because main development stopped 4 years ago.
Any more?
Personally I prefer eza and wrote a zsh plugin that is basically aliases that matches what I have from my muscle memory.
I guess this is a mini lament that many of these tools are moving away from the Unix philosophy of do one thing well, and make it easy to chain.
And a last very small lament that BeOS didn’t succeed, and their filesystem-as-a-database approach didn’t become more standard.
It does indeed also include other functionality that might traditionally be left to other tools (like filtering files). But this is nothing that GNU grep wasn't already doing itself anyway.
IMO, it's better to view the Unix philosophy as a means to an end and not an end to itself. And IMO, it's important to weigh the benefits of coupling to the user experience.
it won't be a means to an end any more if you don't preserve it, so not breaking that aspect of it has to be one of your ends. if you use it to take ls to a new place but that place is not within the ecosystem, it will be an evolutionary dead end, or worse, the first meteor in the meteor storm that ends all life.
current/traditional unix may not be the be-all/end-all, but replacing it/changing it requires viewing it comprehensively and changing all the tools at once or having a plan to. A good example of this is Plan9
Headings on when isatty and off when piping the output put me off when I first tried ripgrep. I don't expect the tools to change their output format on me.
Luckily, you made this behavior configurable, so I'm a happy convert now.
So, ls can be chained very nicely, which I do every day, even without thinking.
You don't need to have a "structured data with fields" to parse it. You just need to think it like a tabular data with line/column numbers (ls -l, etc.) or just line numbers (ls -1).
So, as long as ls does one thing well, it's alright.
Ah, some of the "enhanced" ls tools can't distinguish between pipe and a terminal, and always print color/format escape codes to pipe too, doubling the fun of using them. So, thanks, I'll stick with my standard ls. That one works.
If they want something that is easy to use in a non-scriptable way, maybe they should replicate Norton Commander instead.
Like don't get me wrong, if they had fun, that's great.
But all i use ls for is getting a list of files. I barely ever even use the -la options. There just doesn't seem like a lot of room for improvement in something so simple.
But as I added more and more features to it, it has become a good tool that does a number of things that `ls` doesn't do (unless you chain it with other tools like `sort` or `grep`) and even other `ls` replacements don't do.
So even though `ls` is fantastic as-is, it's always fun to build something of your own, add a little more polish in areas that matter to you and put it out there to see if it resonates with more people.
[1]: https://pls.cli.rs
Not a big surface area, some easy improvements. A whole lot less stressful than rewriting grep (although I'm massively grateful Burnt Sushi did such a crazy thing)
$ du -a | grep blblCertainly I use these less than plain "ls," but digging through hidden files and folders and looking at timestamps is very important for me.
Hidden files are almost always of interest to me since my job involves configuring servers.
lc is a highly configurable "multi-dimensional"[1] file lister written in Nim focused on flexibility and configurability.
Key features:
- Multi-level sorting by combinations of attributes like size, time, and file type, with user-defined precedence
- Configurable file kind sorting order
- Value-dependent coloring for file attributes such as timestamps, permissions, or sizes.
- Abbreviations: Automatically shorten filenames, user/group names or symlink targets.
- File type classification: Integrates libmagic for file type inspection.
- Hyperlink support
- Per-directory configs: custom behaviors for specific directories using local tweak files (.lc).
- Lightweight (~900 lines of code) with only author's CLI library "cligen" and Nim's stdlib as dependencies.
and more.
[1]: https://github.com/c-blake/lc#vector-typemulti-dimensionalit...
[1]: https://pls.cli.rs [2]: https://pls.cli.rs/about/comparison/
# Different options to search for files
# da=36 cyan timestamps
alias ls="EZA_COLORS='da=36' eza --time-style=relative --color-scale=age"
alias lsa="ls --almost-all" # ignore . ..
alias l="ls --long --classify=always" # show file indicators
alias la="l --almost-all"
# Tree view
alias ltreea="ls --tree"
alias ltree="ltreea --level=2"
# Sort by time or size
alias lt="ls --long --sort=time"
alias lta="lt --almost-all"
# lsd is faster than eza
alias lss="lsd --long --total-size --sort=size --reverse"
alias lssa="lss --almost-all"
lla seems to go beyond what ls should do for some reason. Why show git and code complexity info? Just use tools dedicated for these things, otherwise, it will be an unmaintainable mess. If you can solve a problem easily with external tools, then there's no reason to add a feature for it.
But before inviting others to use something, please think of how to make its use more clear. After all, I assume you post this so that people use it, not only admire your coding skills. There is a group of people who have learned to read and rely on man pages.
For example, the top-level README says:
> -s, --sort <CRITERIA>: Sort by "name", "size", or "date"
OK, does "date" refer to creation date, modification date, access date? I can understand "size", but does it produce smallest-first or largest-first? It might not matter if... ah, no, there is no -r/--reverse flag. Can I have more than one "criteria" (since the plural is used)?
Getting answers for such questions now means I have to go read the code in src/args.rs and follow to the implementation of the various functions. And in a few days, when I have the same questions again and I have forgotten the options, I will again have to dive into the code.
Please consider providing a short man page. It documents the "calling interface" to your program and makes it easier to use. I usually start writing one even before implementing the whole thing, to clearly articulate what I expect the program to do.
paste <(lc -1m25 ../..) <(lc -1m25 ..) <(lc -1m25 .)
Some shell script that uses $((COLUMNS)) arithmetic to do 2 or 4 or whatever terminal width is a pretty simple exercise for the reader and one might want to pipe to less.