How to use atuin on same machine in different networks?

I ran into an issue where atuin thinks that my MacBook is a different host.

When accessing different WLANs, the DHCP might change the domain name, and atuin thinks that my MacBook is a different host.

On one side it makes sense, since myhost.local is indeed different from myhost.wlan1.domain and myhost.wlan2.domain.
On the other side, I am still using and sitting in front of the same MacBook.

Yet, atuin doesn’t show me the history for my host.

Is there any way that atuin can be forced to not use the FQDN or allow me to set aliases for a host?

There’s a few ways to approach something like this. If I got a vote I would prefer to set the hostname in the local config versus setting up a group of aliases.

Would it be helpful at all if you used the global filter mode with up arrow or some other keybinding kind of thing ?

https://docs.atuin.sh/configuration/key-binding/

Just an idea that came to mind when I saw this. Good luck!

Setting a hostname in the config file makes using something like dotbot to deploy config files more complex. I’d opt for a flag like hostname_fqdn = false|true.

I’ve been using the following for a long time and changing it does not fit my workflow.

filter_mode = "host"
filter_mode_shell_up_key_binding = "session"

I can always switch to global via Ctrl-r in the TUI, but that’s not the issue or the solution. It’s merely a workaround.
The fact that the same MacBook is not recognized as the same host is IMO a bug - or at least an unwanted side effect of the current implementation.

@ellie do you have any suggestions or ideas?

I’ve never really had this issue

sudo scutil --set HostName <hostname>

usually sets the hostname and stops macOS changing it whenever DHCP gives it a new one.

Otherwise, I think being able to override it with some string in config would make the most sense.

Our logic currently just reads the result of hostname - changing that to be hostname_override_whatever.unwrap_or(hostname()) would work, but aliasing logic is probably overcomplicating things.

1 Like

I will try that when I am back in a week or so. The current Wifi I am using does not change my domain and thus it is still .local

Overriding the hostname in the config might make using one config for different machines impossible. Would it also be possible to just use the short hostname instead of the fqdn?

e.g. if hostname_fqdn = false, atuin does a match on the short hostname, thus hostname.domain1 and hostname.other.domain are treated as the same hostname.

In most cases it should be more than enough not to use the fqdn.

Brilliant. This worked. Thank you!

One last question: Is there a way to move the commands that were recorded as hostname.other to hostname.local?
I am a bit confused, since I am using sync v2, but atuin still uses history.db and records.db. They always seem to be accessed at the same time. But in records the data is enrypted so I have no idea what to do…

Glad it worked!

Not atm, editing history isn’t yet possible.

records.db is an encrypted log that we sync. Eg, AddHistory(history-data), DeleteHistory(history-id). This means we can reconcile changes from other machines, even if they make a bunch of changes while offline. If you were to try and manually edit this, it would cause issues with sync.

history.db is just what we use to actually search the history. It’s kept unencrypted, and can be rebuilt from the record store whenever (atuin store rebuild history)

1 Like