Live data from Hacker News

Atuin – Magical shell history

atuin.sh

21–30 of 118 posts

Re: Atuin – Magical shell history

#21

Why is this better than a shell's built-in history, possibly paired with fzf? I'm not asking sarcastically, either. Is this something awesome I should be using? What about it is going to blow my mind?

I've recently switched from zsh's built-in history + fzf, so perhaps I can answer.

First, a bit more about my zsh+fzf use: I use `share_history` so that my history is available across shells, allowing me to quickly find and re-run commands. (https://zsh.sourceforge.io/Doc/Release/Options.html#index-SH...)

Sometimes I want to switch back to some terminal tab/window and find a command that I nkow I ran in that session, but now it's flooded with 1000+ commands that I've entered elsewhere, making it difficult to find what I'm looking for. So the shared history is both useful and a hindrance, depending on the scenario.

Compare with atuin: I can filter by commands entered specifically within the current shell, or across all shell sessions, and possibly even across other hosts (when using atuin's sync functionality -- haven't tried that yet).

Given the metadata that atuin collects (current working directory, start time, exit status, duration, etc) I'm sure there are some other clever things that can be done with my shell history now, vs the the "line per entry, with optional start timestamp" approach used by zsh's builtin history functionality. Actually, more on that first point: you can also filter by commands entered within the current directory.

Re: Atuin – Magical shell history

#23

Earlier quoted context omitted.

The features listed on the site already tell you what it has that regular shell history + fzf doesn't have. You can decide if that makes it better.

All that jumps out to me from that page is sync, which is nice, but not life-changing. I guess I’m looking for more of a personal experience anecdote, where someone could explain how its other features made it worth signing up for another sync service and learning a new thing. It may be the best thing since sliced bread but that page doesn’t say why I should try it.

[deleted]

Re: Atuin – Magical shell history

#24

Why is this better than a shell's built-in history, possibly paired with fzf? I'm not asking sarcastically, either. Is this something awesome I should be using? What about it is going to blow my mind?

You could probably make shell history + fzf do a lot of what atuin does, but you'd have to write a bunch of glue code to make it happen. That's what atuin is doing. I particularly like the high configurability as well as the ability to switch between host, global, session, and directory history.

I have a one-liner zsh function that does the same thing, been using it for years, too powerful for me to switch it, and probably has better search capabilities, thanks to fzf.

    function hist() {
      print -z $( ([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf | sed -E 's/ *[0-9]*\*? *//' | sed -E 's/\\/\\\\/g')
    }

Re: Atuin – Magical shell history

#25
post #18

Earlier quoted context omitted.

All that jumps out to me from that page is sync, which is nice, but not life-changing. I guess I’m looking for more of a personal experience anecdote, where someone could explain how its other features made it worth signing up for another sync service and learning a new thing. It may be the best thing since sliced bread but that page doesn’t say why I should try it.

I just watched this video: https://youtu.be/WB7qojkkVVU?si=_sqnKlXrblLSwrs8 and there still seems to be nothing that stands out about atuin. I do think it might be easier to work with the data in a database. Personally I don't see a reason to use this service .

As I commented elsewhere, you can:

- Filter by commands run within the current shell session

- Filter by commands run within the current working directory

- Filter by commands run across hosts (as opposed to filtering commands run on your local machine)

- Filter by commands run within the current shell session

- All of the above searching functionality, with nice fuzzy finding support, time stamps, etc.

Before atuin I used zsh's builtin history, with ctrl+r rebound to present that builtin history through the `fzf` fuzzy finding tool, and zsh configured to share history across shells. The deficiencies I found: I couldn't optionally filter by commands _only_ run in the current shell, I couldn't filter by commands run in the current directory (useful for quickly finding commands I often need to re-run for a given project), and I can't search for commands run across hosts.

If you don't find yourself valuing these things, you may find that you have little to gain from using atuin.

Re: Atuin – Magical shell history

#26
post #2

Atuin has been the absolute best CLI tool I’ve found in years. I use it every single day that I’m at a computer. It's very easy to learn (2 or 3 essential hotkeys), and makes finding old shell commands a breeze. I was able to self-host the sync server in well under an hour, start to finish. (@ellie - if you see this thread, thanks for all the elbow grease you put in! You’ve built something really special.)

Any links in the self-hosting options? I had some saved but lost them.

Re: Atuin – Magical shell history

#27

Earlier quoted context omitted.

You could probably make shell history + fzf do a lot of what atuin does, but you'd have to write a bunch of glue code to make it happen. That's what atuin is doing. I particularly like the high configurability as well as the ability to switch between host, global, session, and directory history.

I have a one-liner zsh function that does the same thing, been using it for years, too powerful for me to switch it, and probably has better search capabilities, thanks to fzf. function hist() { print -z $( ([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf | sed -E 's/ *[0-9]*\*? *//' | sed -E 's/\\/\\\\/g') }

"I have a one-liner zsh function that does the same thing"

I think you mean "I have a one-liner zsh function that does a tiny subset". It's lacking:

- The ability to filter by current directory

- The ability to filter by current shell session, instead of across all shell sessions (that's assuming you use zsh's shared_history; if not, then the opposite is true: you can only search within the current shell session. See https://zsh.sourceforge.io/Doc/Release/Options.html#index-SH...)

- Search history across hosts

Until recently, I used zsh+fzf, with the default ctrl+r binding replacement provided by fzf. It's been great, but it has lacked functionality that I've wanted for a while now. Atuin fills in these gaps for me.

Re: Atuin – Magical shell history

#28

Earlier quoted context omitted.

The features listed on the site already tell you what it has that regular shell history + fzf doesn't have. You can decide if that makes it better.

All that jumps out to me from that page is sync, which is nice, but not life-changing. I guess I’m looking for more of a personal experience anecdote, where someone could explain how its other features made it worth signing up for another sync service and learning a new thing. It may be the best thing since sliced bread but that page doesn’t say why I should try it.

For me, syncing across machines and other shell sessions was enough to justify shelling out the $0 and 5 minutes it took to install and learn the tool.

Re: Atuin – Magical shell history

#30

Earlier quoted context omitted.

The features listed on the site already tell you what it has that regular shell history + fzf doesn't have. You can decide if that makes it better.

All that jumps out to me from that page is sync, which is nice, but not life-changing. I guess I’m looking for more of a personal experience anecdote, where someone could explain how its other features made it worth signing up for another sync service and learning a new thing. It may be the best thing since sliced bread but that page doesn’t say why I should try it.

Fair point, I've been using atuin for a few years on a few machines but never once felt the need to set up sync. I forgot sync was even a feature! It's certainly over-emphasized on the web page.

I use it mainly because a) it stores data about command history in a proper database that's easy to query (what century is this? How do other tools justify dumping what should be structured information into some god-awful mess of semi-structured text files?) and b) it makes a clean separation between SESSION, DIRECTORY and GLOBAL scopes which means you can explicitly use a recency or a locality filter (I don't want irrelevant commands cluttering my history).

Even without sync, atuin is a gem.

Post reply on HN