this post was submitted on 09 Jan 2024
118 points (95.4% liked)

Open Source

29862 readers
230 users here now

All about open source! Feel free to ask questions, and share news, and interesting stuff!

Useful Links

Rules

Related Communities

Community icon from opensource.org, but we are not affiliated with them.

founded 5 years ago
MODERATORS
 

Atuin replaces your existing shell history with a SQLite database, and records additional context for your commands. With this context, Atuin gives you faster and better search of your shell history!

Additionally, it provides optional and fully encrypted (E2EE) synchronisation of your history between machines, via an Atuin server, or you can self-host your own server. There is a single command to easily delete your data from the server too.

It supports zsh, bash, fish, and nushell shells right now.

The search is as easy as pressing the up arrow in the terminal and then scrolling back, or typing to search. But you could also type something like this to do a search [search for all successful make commands, recorded after 3pm yesterday atuin search --exit 0 --after "yesterday 3pm" make].

Atuin offers configurable full text or fuzzy search, filterable by host, directory, etc. As it has context around dates, times, exit code, and even the directory location form where a command was executed, you could use the -c flag to just search for commands run in a particular directory.

The sync function allows you to have the same history across terminals, across sessions, and across machines.

There is a quick start script that can be run to install it, otherwise you can also install from the various Linux repos. For manual installation, the steps I found to get going were:

  • Install Ble.sh and add it to your .bashrc (or other shell) file
  • Install Atuin and add it to your .bashrc (or other shell) file (after Ble.sh)
  • Restart your shell and run 'atuin import bash' to import my bash history into Atuin
  • Press up arrow to see if Atuin interactive search triggers

The link below has some good documentation as well a link to their source code.

See https://atuin.sh/

#technology #Linux #opensource

all 21 comments
sorted by: hot top controversial new old
[–] [email protected] 23 points 7 months ago (1 children)

Syncing shell history between machines seems like an incredibly bad idea considering how many commands are specific to one host and not having all the commands from other hosts in the history makes it so much easier to find them again in the history. Maybe I am thinking about this too much from a cross-platform and server viewpoint though.

[–] [email protected] 3 points 7 months ago (1 children)

You can though search, hit TAB, and then do edits to the line before executing. That is pretty handy if it is something complex across a few machines with a specific change.

[–] [email protected] 1 points 7 months ago

Yeah, but lets say I have two servers, one hosts matomo.foo.com and the other hosts matomo.bar.com and I want to update each of those for the second time (the commands are already in the history from last time), with sync I would have to pay much more attention to get the correct commands from the history when I recall the commands for upgrading the database in the correct vhost dir for each (some php matomo.php core:upgrade or similar invocation using a script in the vhost dir), especially when it is mixed in with commands from 50 other servers.

Or lets say I run some dangerous command on the dev server (DROP DATABASE), without sync I can never accidentally use it from the history on the live server.

[–] [email protected] 9 points 7 months ago

I don’t have a clue what any of what that means but I’m a big discworld fan so I love the choice of name.

[–] [email protected] 3 points 7 months ago (1 children)

Does sqlite read-only access still work when the disk is full? Would be bad if your history tool prevented shell access when you need to delete something if your disk fills up. Also not sure how fsynced access might slow down debugging of I/O starvation issues (when you want your shell to run from memory mostly).

[–] [email protected] -2 points 7 months ago (1 children)

I think a lot of other OS things are going to break when a disc gets full... But you can also delete history within Atuin.

[–] [email protected] 4 points 7 months ago* (last edited 7 months ago) (1 children)

The point was more if atuin breaks your shell under those circumstances so you can not fix the full disk. Sqlite usually writes some transaction file before it does anything, doesn't it?

[–] [email protected] -2 points 7 months ago (1 children)

But like most other things you'd chroot in and disable it? I think though whatever fills up your disk is probably going to prevent a proper boot up.

[–] [email protected] 1 points 7 months ago

Usually apart from potentially a reboot afterwards to make sure all services are running normally again a filled up disk doesn't require a reboot.

[–] [email protected] 2 points 7 months ago

Stumbled across some self-hosted hacks online but hopefully someone does a PR to add instructions to their GH wiki.

[–] [email protected] 2 points 7 months ago (2 children)
[–] [email protected] 2 points 7 months ago

Atuin only has styles really but if you mean the bash prompt, I'm using Starship prompt.

[–] [email protected] 2 points 7 months ago (1 children)
[–] [email protected] 1 points 7 months ago

Fast to open, search, sync compared to? To answer generally, though - no lags or long waiting for anything to happen.

[–] [email protected] 2 points 7 months ago (1 children)

How are y’all planning to sustain the server?

[–] [email protected] 3 points 7 months ago (1 children)

It can be self-hosted as well so that server is not essential to the service...

[–] [email protected] 1 points 7 months ago (1 children)

Yes, but you still have an official server to maintain.

[–] [email protected] 1 points 7 months ago (1 children)

In what way though? If you're self-hosting you just keep your server online. It does not need that central server at all to operate. Even if there are no updates it keeps running.

[–] [email protected] 2 points 7 months ago (1 children)

I didn't mean that all servers would require the central server lol. Unless I'm mistaken, the default is still the official server, and that server is still going to have to handle a ton of requests from people, which requires money to maintain.

[–] [email protected] 2 points 7 months ago

Ah got you, it is just text though so the syncing is pretty quick and light. I'd say way less than any site hosting images and videos. The default is no sync, so users need to set that up to sync too. It attempts to do smart sync between successful syncs.