Tracking command history across multiple computers
Normal Search
If you pass in additional arguments to Atuin when you call it, you can filter for exit codes, among other things, which limits the results to commands that completed successfully. In addition, you can control the output by specifying the directories in which the commands were entered. The search can also be restricted to specific time periods (Figure 7). Table 1 shows some Atuin query examples. For more parameters, see the search
function documentation on GitHub [9].
Table 1
Atuin Query Examples
atuin -e (--exit) 1 |
Shows which entered commands were not allowed, typically because of missing permissions (see Table 2). |
atuin search --exclude-exit 1 |
Does the opposite of the above command. |
atuin search --exit 1 --after 01/07/2022 |
Displays commands that were entered after July 1, 2022, and were not executable. You can use the --before parameter in a similar way. |
atuin search --exit 0 --before 01/07/2022 --cwd . |
Displays commands that were successfully executed from the current directory (--cwd .) before July 1, 2022. |
atuin gen-completions --shell bash --out-dir ~/.config/atuin |
Creates a command completion (bash-completion) in the specified directory. |
curl https://api.atuin.sh/enable -d $(cat ~/.local/share/atuin/session) |
Creates an activity graph similar to the one for GitHub activities. |
Table 2
Exit Codes
Exit Code | Meaning |
---|---|
0 |
Success |
1 |
Operation not allowed |
2 |
No such directory |
3 |
No such process |
While it's a bit of a gimmick, the command
atuin stats all
prints an overall statistic and can be restricted to a specific day, for example, by typing
atuin stats day last friday
or by specifying a date (Figure 8). The last row in Table 1 shows how to create a GitHub-style activity graph. However, creating this graph requires registering with the public sync server or running your own server.
Conclusions
There are many tools that extend the basic history
function in different ways. First released in April 2021, Atuin focuses on synchronizing command sequences on different computers. You can use the results globally across all synchronized computers. However, you can also filter your results by computer, the current session, or the directory in which the commands were originally accessed.
Atuin's documentation is still a little sparse, but otherwise it does exactly what it should. Direct support for the tool is available from the Atuin channel on Discord [10], if needed. If you're interested in the way projects like this come about, you can discover more in an interview with Ellie Huxtable, the developer behind Atuin [11].
Infos
- Bash history: https://www.digitalocean.com/community/tutorials/how-to-use-bash-history-commands-and-expansions-on-a-linux-vps
- Atuin: https://github.com/ellie/atuin
- Debian package: https://github.com/ellie/atuin/releases/tag/v0.10.0
- Docker image: https://github.com/ellie/atuin/pkgs/container/atuin
- Docker Compose: https://github.com/ellie/atuin/commit/a9d1ece0cb2090b54668765f70ec00cd2b3a8554#diff-e45e45baeda1c1e73482975a664062aa56f20c03dd9d64a827aba57775bed0d3
- TOML: https://en.wikipedia.org/wiki/TOML
- Fuzzy search: https://github.com/ellie/atuin/blob/main/docs/config.md#fuzzy-search-syntax
- Filter mode: https://github.com/ellie/atuin/blob/main/docs/config.md#filter_mode
- search: https://github.com/ellie/atuin/blob/main/docs/search.md
- Atuin on Discord: https://discord.gg/Fq8bJSKPHh
- Interview with Ellie Huxtable: https://console.dev/interviews/atuin-ellie-huxtable/
« Previous 1 2
Buy this article as PDF
(incl. VAT)