Atuin: A Modern Shell History on Steroids (Installation + Usage)

Linux TLDR
Last Updated:
Reading time: 3 minutes

Atuin is a steroid for your traditional shell history, using SQLite as a database to record each user-issued command along with additional context like exit status, hostname, session, cwd, etc.

It also offers a free public server or the option to self-host to sync your shell history across multiple systems in real time is available, and each stored data is encrypted on the server.

To give you my suggestion: if you’re a beginner, I suggest sticking with your traditional shell history for at least a short period before transitioning to Atuin, as it will undoubtedly improve your productivity in situations where you need to quickly retrieve long executed commands in any terminal window running on the current or another system.

In this article, I’ll point out its benefits, installation steps, and a few command-line usages with practical examples.

Tutorial Details

DescriptionAtuin: Magical shell history
Difficulty LevelLow
Root or Sudo PrivilegesYes (for installation)
OS CompatibilityUbuntu, Manjaro, Fedora, etc.
Prerequisites–
Internet RequiredYes (for installation)

Features of Atuin

The following is a list of Atuin features that set it apart from traditional shell history:

  • An SQLite database stores all user input.
  • Each user input instantly becomes available on another terminal session or system configured with Atuin.
  • Backup and sync are encrypted, and you can use the public server or opt for self-hosting.
  • Each user input is stored with additional context such as exit code, cwd, hostname, session, command duration, etc.
  • β€œCtrl+R” and β€œUP” are rebinded to Atuin’s full-screen history search UI (manual configuration is still available).
  • The old history file and its records remain accessible, with each command being actively updated in the file.
  • Configuration with Bash, Fish, and Zsh shells is effortless and hassle-free.

How to Install Atuin on Linux

The installation step is quite easy if you want to install it only on your current system. Then simply execute the following command to begin the installation:

$ bash <(curl https://raw.githubusercontent.com/atuinsh/atuin/main/install.sh)

Once the installation is complete, you have three options: either immediately start using it, enter the β€œatuin register” command to create an account on the Atuin public server, or enter the β€œatuin login” command if you have credentials for an already existing Atuin account.

The step to create an account or log in with an existing account is quite easy, so I’ll directly show you its command-line usage.

How to Use Atuin on Linux

Once the installation is complete, make sure to restart your terminal session to refresh the new changes made to your shell configuration file. Once done, either use the β€œCtrl+R” shortcut key, press the β€œUP” arrow key, or execute the β€œatuin search -i” command to enter the Atuin full-screen history search UI.

atuin interface

Here, you can use the β€œUP/DOWN” arrow key to scroll; each command entry has its index number, command duration, and command execution time.

To filter out results, you can enter the first few initials of the command you have been looking for to refine the results to your desired command.

filtering the data in atuin

Once found, you can press the β€œENTER” key to execute it, the β€œTab” key to return to the shell with the selected command to make new modifications, or to quit, either by pressing the β€œESC” button or holding the β€œDOWN” key.

To find out the stats of your most executed command, along with the number of times it’s executed, as well as additional information such as total executed commands and unique commands, execute the following command:

$ atuin stats

Output:

checking the command stats using atuin

To import commands from your traditional shell history to Atuin, simply run the following command; it will automatically detect your current shell and import all the records.

$ atuin import auto

Output:

importing shell history to atuin

To check the imported or existing Atuin records, including execution date, time, and execution duration in traditional format, execute the following command:

$ atuin history list

Output:

checking the shell history using atuin

Tracking a successfully executed command can be easily done by using the exit status code; for example, β€œ0” denotes a successful exit code. Therefore, to track all successfully executed ping commands, the β€œatuin” command will appear as follows:

$ atuin search --exit 0 ping

Output:

checking the history of successfully executed commands

Instead of listing all the successfully executed commands, you can filter out data by date. For example, searching for the β€œping” command that exited successfully before yesterday at 4 p.m. with exit code β€œ0” will look like the example below.

$ atuin search --exit 0 --after "yesterday 4pm" ping

Output:

checking the history of successfully executed commands based on date

There are many more things you can do with it, but I’ll end this article here. I would also suggest you check out its help section by running the β€œatuin --help” command.

Final Word

Atuin is an amazing tool, and once you’re addicted to it, it becomes hard to resist. It’s always the first thing you install on a new system. That’s why I suggest beginners stay away from it unless they properly understand the workings of the traditional shell history, as they won’t benefit from using it in all environments.

If you have any questions or queries related to the topic, then please let me know in the comment section.

Till then, peace!

Join The Conversation

Users are always welcome to leave comments about the articles, whether they are questions, comments, constructive criticism, old information, or notices of typos. Please keep in mind that all comments are moderated according to our comment policy.