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)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
So Long Neofetch and Thanks for the Info
Today is a day that every Linux user who enjoys bragging about their system(s) will mourn, as Neofetch has come to an end.
-
Ubuntu 24.04 Comes with a “Flaw"
If you're thinking you might want to upgrade from your current Ubuntu release to the latest, there's something you might want to consider before doing so.
-
Canonical Releases Ubuntu 24.04
After a brief pause because of the XZ vulnerability, Ubuntu 24.04 is now available for install.
-
Linux Servers Targeted by Akira Ransomware
A group of bad actors who have already extorted $42 million have their sights set on the Linux platform.
-
TUXEDO Computers Unveils Linux Laptop Featuring AMD Ryzen CPU
This latest release is the first laptop to include the new CPU from Ryzen and Linux preinstalled.
-
XZ Gets the All-Clear
The back door xz vulnerability has been officially reverted for Fedora 40 and versions 38 and 39 were never affected.
-
Canonical Collaborates with Qualcomm on New Venture
This new joint effort is geared toward bringing Ubuntu and Ubuntu Core to Qualcomm-powered devices.
-
Kodi 21.0 Open-Source Entertainment Hub Released
After a year of development, the award-winning Kodi cross-platform, media center software is now available with many new additions and improvements.
-
Linux Usage Increases in Two Key Areas
If market share is your thing, you'll be happy to know that Linux is on the rise in two areas that, if they keep climbing, could have serious meaning for Linux's future.
-
Vulnerability Discovered in xz Libraries
An urgent alert for Fedora 40 has been posted and users should pay attention.