Pimp my Shell: Useful helpers for the terminal - TUXEDO Computers

  ATTENTION: To use our store you have to activate JavaScript and deactivate script blockers!  
Thank you for your understanding!

Pimp my Shell: Useful helpers for the terminal

Linux has the reputation that users always have to execute commands in the console, which makes it unnecessarily difficult for beginners. However, this criticism is a bit out of date: Graphical frontends usually do most of the work for the user. Software can be installed via the Discover package management, the TUXEDO Control Center ensures quiet operation and maximum battery runtime, and Tomte controls important system adjustments without your intervention.

In forums, blogs, or articles about Linux you can still find terminal commands and their outputs. Even here on our pages. Is the reputation justified after all? You typically go to the terminal when you really have to work on the inside of the system or when you want to set up server services, for example. It is often faster and more precise to explain to the reader that a certain package has to be installed via sudo apt install instead of doing this via the graphical user interface.

Pimp your Terminal

To make the work in the console a little easier, there are a number of helpers in the package sources of TUXEDO OS. We do not install them with the system out of the box, as every user has different requirements. It is best to try for yourself what you personally like and what makes your everyday life with the console easier.

HSTR: a better HiSToRy

The console in TUXEDO OS stores the last 1000 commands you executed. Type history to get a listing. If you want to repeat an old command, you do not have to retype it, instead you can simply search for it from the history. To do this, tap Ctrl+R and then enter a suitable search term. The search will automatically filter out the command you are looking for – in chronological order. Pressing Ctrl+R again will jump to the next older hit in the history.

Much more comfort and numerous other functions are offered by the upgraded search of HSTR (short for HiSToRy). You install the program via the package repositories and then have the settings written to the configuration file ~/.bashrc. The command source ~/.bashrc then instructs shell to reread its configuration. With Ctrl+R you open now an interactive dialog, which sorts the search results automatically on the basis of the frequency of the given command.

sudo apt install hstr
hstr --show-configuration >> ~/.bashrc
source ~/.bashrc

Thus, a command such as sudo apt update always appears above the one-time executed command sudo apt install hstr in a search for apt. Use the up and down arrow keys to move the selection and press Enter to execute the highlighted command. Alternatively, press the left and right arrow keys to still edit the selected command. Press Del to delete the selected command from the history. Important if you have accidentally typed a password instead of a command.

If necessary, use Ctrl+/ to switch the sorting between the classic history view, sorting by frequency, and commands marked as favorites. To do this, select an entry in the history and press Ctrl+F. Optionally, select another filter method with Ctrl+E. You can display only exact matches or use regular expressions (regex).

EXA: an alternative for ls

The command ls stands for list and - as the name suggests - lists the contents of a directory. It is not unusual to make the simple output somewhat more readable for humans with switches such as ls -l -all –human-readable or ls -alh for short. Thus, in TUXEDO OS you can also use l, la and ll as alternatives. The corresponding aliases are defined in the configuration file ~/.bashrc. Especially the last variant provides you with much more information in everyday life than the simple list command.

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

Even more details, presets that make more sense to the human eye and, above all, more color are provided by the output of the ls alternative exa. Install the program in TUXEDO OS via the package of the same name from the package management (sudo apt install exa). Then define a suitable alias in ~/.bashrc. In our example, we comment out our default for ll by prefixing it with a hash and replace it with the call to exa -bghHlS. This way you get a detailed overview of the current directory right from typing ll. Colors provide a clear distinction of the areas for rights, file sizes, users, date, and the name.

# Alias definitions.
# alias ll='ls -alF'
alias ll='exa -bghHlS'

Jump’ll make you jump, jump

Navigating to deeply hidden directories with cd in the shell is not quite easy. It is true that you can complete file and directory names by simply pressing the Tab key, and double-press Tab to display suitable alternatives for selection. But even for experienced users it often takes quite a while to put together a longer path. How about an alternative to cd that remembers frequently used directories and takes you to your destination in a clever way?

Under TUXEDO OS, you install Jump from the package sources (sudo apt install jump) into the system. After the installation you have to integrate the program into the shell. To do this, edit the configuration file ~/.bashrc again and add the following lines to the end of the file. For your changes to become active, either restart the console program or execute the command source ~/.bashrc once again.

# Integrate Jump with your shell.
[ -x /usr/bin/jump ] && eval "$(jump shell)"

After this addition, you continue to work normally, as before. With cd you change from directory to directory as usual. However, Jump now saves all the folders you access in the background. The more often you call a directory, the higher the path rises in the statistics of Jump (to be seen via jump top). After a few directory changes, you then move on to jumping to another directory with j.

In our example, we have created the folders tuxedo-ideas, tuxedo-media and tuxedo-notes under ~/documents. You can now jump directly to the ideas folder using j ideas, j ti, or j doc idea – regardless of which folder you are currently in. Using “Fuzzy Search” Jump automatically tries to find the desired target. If Jump gets lost, press j to repeat the last search, and Jump will jump directly to the next most likely destination.

Other classics in the Software Center

In addition to our tips, you will of course also find many other command line classics such as the file manager Midnight Commander, htop, which is much more advanced than top, or Glances for displaying system information in the package sources of TUXEDO OS. Just have a look around and bring a little more Hollywood into your terminal.