TopRatedTech

Tech News, Gadget Reviews, and Product Analysis for Affiliate Marketing

TopRatedTech

Tech News, Gadget Reviews, and Product Analysis for Affiliate Marketing

This Linux Terminal Tool Supercharges the history Command

Abstract

  • The historical past command shops and shows earlier instructions, however Atuin enhances this with cross-host sync and a strong interface.
  • Atuin replaces the default historical past performance, bettering navigation and search via a TUI and superior options.
  • Atuin could be simply put in and customised, providing context-specific historical past, stats, and lots of configurable choices.

Spending all day tapping these arrow keys within the terminal on the lookout for earlier instructions? We have all been there, however your expertise could be higher for those who use this useful utility.

What’s Fallacious With the historical past Command?

The historical past command retains a report of different instructions that you just run in a shell. It might probably show a listing of the instructions you’ve beforehand run, and allows you to handle that record.

Sample output from the Linux history command showing a list of numbered commands.

Linux offers different instructions and shortcuts to make use of this record. For instance, !22 replays the command that’s numbered 22 within the historical past. The Up and Down arrows will, sometimes, navigate from side to side via the historical past, displaying every command till you press Enter to replay one. Ctrl+R performs a historical past search.

Fittingly, the historical past command has been round for a very long time. It was launched in 1979 and have become extra broadly used from 1989 on, when the Bash shell launched. Consequently, it’s a mature device that embodies the Unix philosophy of doing one factor, nicely. Nevertheless it’s not with out flaws.

Whereas there are numerous instructions to work together with your historical past, they’re all fairly primary. Navigation and search occurs one line at a time, so could be tough to work with. And the best way that historical past works throughout shells could be complicated. Open a brand new terminal, and it received’t have entry to the historical past of your earlier one—till you shut that earlier terminal, that’s!

Associated


How to Use the history Command on Linux

Higher than typing it in manually 3 times.

How Does Atuin Work, Then?

Atuin is a program that goals to enhance Linux’s default historical past, with cross-host sync, a TUI interface, detailed statistics, and extra.

The Atuin program showing color-coded command history, in a full-screen list, with timing information.

By default, Atuin takes management of the Up arrow to current its personal view of your historical past. Like me, you could have the Up > Enter sequence—to immediately rerun your earlier command—dedicated to muscle reminiscence. If that’s the case, it could take some time to get used to Atuin’s interface showing if you do that, however the identical command sequence will nonetheless do the very same factor: rerun your final command.

This full-screen view of your historical past can take a little bit of getting used to, however when you’re accustomed to Atuin’s options, it turns into extra accessible. The device is simple to put in and fast to arrange and begin utilizing, so one of the best ways of studying about it’s by attempting it out.

To put in Atuin, follow the instructions here. The quickest set up methodology is that this command:

        curl --proto '=https' --tlsv1.2 -LsSf https://setup.atuin.sh | sh

This command downloads a shell script and runs it. Using curl like this carries a small threat, which you’ll be able to keep away from by dropping the | sh. It will obtain the file which you’ll be able to then examine on your personal peace of thoughts.

The script will set up Atuin inside your private home listing and replace your startup script (e.g. ~/.bashrc) to run it. If you re-source that file, restart your terminal, or open a brand new tab/window, Atuin will probably be enabled.

You need to use different bundle managers like Cargo, Homebrew, or Pacman to put in Atuin, however doing this requires extra handbook setup.

In the event you get an error like “curl: (23) shopper returned ERROR on write”, strive putting in curl utilizing apt as an alternative of snap. This solved the issue for me, on Ubuntu.

How Can Atuin Assist Me?

Regardless of its slender activity, Atuin has fairly a big set of options and is usually a bit daunting at first. I like to recommend taking it slowly and experimenting with Atuin whilst you use it.

Fundamental Utilization

When you’ve put in Atuin, you may open its TUI interface by urgent the Up arrow. At first, you will see an empty display screen since you don’t have any historical past:

A mainly-blank screen showing Atuin's version and Search / Inspect tabs in the upper left, with a label reading "GLOBAL" in the bottom left.

If you need, you may import your customary historical past with a easy command:

        atuin import auto

After getting some instructions in your historical past, you may navigate the TUI utilizing Up and Down arrows to pick out a command you need to replay. It will usually be the command you final ran which would be the at the moment chosen one by default, on the backside of the record.

With a command chosen, press both Enter to run it immediately or Tab to insert it in your command line, prepared for enhancing. In the event you by chance open Atuin, you may stop it by urgent Esc—or the Down arrow for those who’re already on the backside of the record.

Chances are high, you’re on the lookout for a command with a selected title or one involving a selected file. In both case, simply begin typing to go looking the historical past record and refine your choices:

The Atuin program showing a filtered command history, with search text at the bottom.

Your search will seem on the backside of the terminal, as you kind, and Atuin will filter the historical past record it shows accordingly.

It is a fuzzy search, so you could get shut matches in addition to precise, literal outcomes. You may as well search utilizing * as a wildcard, however I haven’t discovered this notably needed.

Configuration

Atuin is extremely configurable, with many settings to regulate its habits. Take a look at the ~/.config/atuin/config.toml file which has glorious feedback together with every setting. I made a number of small tweaks to the config once I began utilizing Atuin and these have served me nicely.

First, for those who don’t just like the default fuzzy search, you may change it to seek for a literal string anyplace in every command:

        search_mode = "fulltext"

The TUI interface will clear your display screen after use and is usually a bit too intrusive. That is much less of an issue for those who use a full-screen terminal, however you may also scale back the variety of traces Atuin makes use of to workaround this difficulty:

        inline_height = 10
The Atuin program showing an inline command history taking up just ten rows of the terminal.

An ideal instance of Atuin’s energy is its context-specific historical past. You need to use this function to view earlier instructions you ran solely within the present session or solely within the present listing, amongst different choices. Atuin shows the present filter mode within the backside left: e.g. “[ GLOBAL ]” by default. You may press Ctrl-r to cycle via the modes, however you may also change the default based mostly on the way you invoke Atuin:

        filter_mode_shell_up_key_binding = "listing"

This setting instructs Atuin to default to only the instructions you ran within the present listing, if you open it by urgent the Up arrow. Opening Atuin with Ctrl-r will use the default filter, nevertheless, so it is a wonderful means of getting two modes simply accessible. It is also one other instance of how configurable the device is.

Sync

Whereas synchronization is fully non-compulsory, Atuin encourages it as a way to share your historical past throughout hosts. In the event you repeatedly ssh into distant hosts, this can be helpful, particularly for those who perform the identical type of duties on them.

Personally, I haven’t felt the necessity to use sync, nevertheless it’s a powerful function that is among the main complaints leveled towards the default historical past command.

Associated


How to Connect to an SSH Server from Windows, macOS, or Linux

SSH is obtainable on each fashionable working system.

Statistics

In the event you’re ever concerned with what sorts of instructions you’re working, Atuin’s statistics will probably be of curiosity. You may view stats on your full historical past or any particular 24-hour interval:

The Atuin program showing statistics of various commands and how many times they have been run.

Atuin’s default historical past record reveals the time every command took to run. That is useful data for those who usually begin long-running processes like compiling software program or analyzing disk usage with du. It additionally consists of interactive instructions like vim, so you may see how lengthy you spent enhancing a file on a specific day.

Atuin additionally makes this data obtainable in its Examine view which reveals particulars of a selected command, together with what number of occasions you run it per day and what number of occasions it’s returned every exit standing:

The Atuin program showing its inspector which summarizes a command’s history with information like runs per day, duration over time, and exit code distribution.

The inspector notes that it’s a work in progress, nevertheless it’s value making an allowance for that Atuin is actively maintained, with a bunch of contributors making modifications regularly.

Source link

This Linux Terminal Tool Supercharges the history Command

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top