Managing your Trash efficiently

What / for what is the Tool?

You may know this problem. You want to delete something, but you are not sure if you maybe would want to restore it at some point in the future. This is exactly what a trash folder is for. But how can we efficiently clear, add, restore stuff from that in the CLI?

This is exactly what trash-cli was designed for. As the name says, it is the Trash Bin (you may already know from a GUI File-Manager) for the CLI. It provides lots of functionality to manage your trash.

How to use the Tool

To use trash-cli, you can use those simple commands:

1
2
3
4
trash <File(s)> # Adds a file to the trash bin.
trash-restore # Starts an interactive "Session" where you can select which file(s) you want restored.
trash-list # Lists out every file you currently have in the trash.
trash-empty # Clears the trash and permanently deletes its contents.

Tips and Installation

You can also alias your rm command to trash, to always only add files to the trash and not delete them. Even though this is not recommended, because you may get wrong habits, I love this feature.

Now you maybe want to install trash-cli to give it a try. How do you do that, though?

It is very simple. Here I will tell you the steps of installing, but it may have changed in the future. Because of this, be sure to check out the Project`s Page!

Ubuntu / Debian

1
sudo apt install trash-cli

Arch

1
sudo pacman -S trash-cli

Fedora

1
sudo dnf install trash-cli

Python / pipx

1
2
pipx install trash-cli
pip install trash-cli

For more installation methods, be sure to visit their GitHub Page!

Improving the boring ls

What / for what is the Tool?

You may know this problem. You type in ls, just to be greeted with a boring and monotone colored prompt. This is especially true, if you have already looked / found some nice looking alternatives for other tools on your system.

This exactly was my problem too. But then I found out about the existence of 164b97c2-beb7-4204-99b4-6ec2ddc93f9c. It is like 164b97c2-beb7-4204-99b4-6ec2ddc93f9c, but with colors and symbols. If you don’t want / like any symbols, take a look at 164b97c2-beb7-4204-99b4-6ec2ddc93f9c

Here you can see an example Picture of how your new lsd would look like: Picture of LSD Command

You can’t tell me that this doesn’t look way better than the default ls command.

How to use the Tool

To use the ls alternative, you only need to install it and then use the flags you want. It is that simple.

lsd -lA --group-dirs=first This executes the default lsd, but includes the following:

-l Display extended file metadata as a table

-A List nearly everything, including hidden directories. But ignore . and ...

–group-dirs=first This sorts the directories to the first lines. This removes the clutter of having some folders between files, just because the name starts with the same letter.

Tips and Installation

If you are liking the tool, be sure to alias your ls to your new lsd command. This removes the need to type one letter more than needed 😜

To install the Tool, the Developers recommend to use cargo. Other Package Managers may have a package too, though.

Cargo

1
cargo install lsd

Arch

1
sudo pacman -S lsd

Switch Directories much faster

What / for what is the Tool?

What do you do when you want to switch to a directory?

Most people will do cd directory. This is okay, but now imagine the following:

You are in the directory /run/media/user/usb. Now you want to go to ~/Documents/Development. You maybe have already used the power of aliases to create an alias which directly jumps you there. But now imagine that this is a directory you maybe visit every month, and you don’t want to create an alias. Maybe because you can’t remember the name of it anyway (because you use it so rarely).

This is where zoxide comes in, and makes your life so much easier. In this case, it would allow you to do the following: z Dev. Yes, you read that correctly. zoxide remembers every directory you cd into. And then it allows you to jump between them, by just using (a part) of their name.

This means you can do this as an example: z Down. And boom. You are in your Down(loads) folder. This is not everything, though.

How to use the Tool

It provides so much more. Here is a short text copied from their GitHub site:

1
2
3
4
5
6
7
8
z foo # cd into the highest ranked directory matching foo
z foo bar # cd into the highest ranked directory matching foo and bar
z foo / # cd into a subdirectory starting with foo

z ~/foo # z also works like a regular cd command
z foo/ # cd into relative path
z .. # cd one level up
z - # cd into previous directory

This just shows how powerful this tool is.

It is like cd but so much smarter and made for someone who needs to navigate a lot.

Tips and Installation

If you don’t want to change your memory to use z instead of cd to move directories, be sure to alias it.

If you want to install zoxide, you can look below:

Ubuntu / Debian

1
sudo apt install zoxide

Arch

1
sudo pacman -S zoxide

Fedora

1
sudo dnf install zoxide

And so much more. If you didn’t find your installation method of choice, be sure to check out their GitHub!

Improving the look of cat

What / for what is the Tool?

If you often read files using cat, or just use it in your file manager to preview files, you may be thinking: I would love to have some syntax highlighting, line numbers, git integration and non-printable characters!

If you ever had this thought, then bat is for you. It`s “A cat(1) clone with wings”.

And yes, it is exactly what you think it is.

How to use the Tool

The usage is really simple. Install, use. That`s it. Yes, you can use some special flags, but it is definitely not needed for basic usage.

If you were wondering how it looks:

Syntax Highlighting

Syntax Highlighting Image

Git Integration

Git Integration Image

Yes, those image were copied from their GitHub Page.

Tips and Installation

The Bat Tool is also a really great tool for File-Previewing, as discussed earlier. I use it to preview Files in 164b97c2-beb7-4204-99b4-6ec2ddc93f9c.

To install bat, use one of the following methods:

Ubuntu / Debian

1
sudo apt install bat

Arch

1
sudo pacman -S bat

Fedora

1
sudo dnf install bat

For more installation methods, be sure to visit their GitHub Page!

Viewing your disk usage

What / for what is the Tool?

You may think to yourself now: “Why should I install any other CLI Tool to view my disk usage? I already know and use df!”

And this is not wrong. If you are fine with something looking outdated and only single colored, I won’t tell you to use anything else.

But for me, I love having more color and visual information in my CLI journey.

This is where 164b97c2-beb7-4204-99b4-6ec2ddc93f9c comes in, and adds colors, bars, themes and more.

If you wonder: “How can this look good?”, here you go: Image of duf in action

How to use the Tool

The usage is, once again, really simple. You just need to install it and then use it. If you want to, you can use more custom flags. But in my opinion, the default usage is more than good enough.

Tips and Installation

To install duf, use one of the following steps. If you want more installation methods, be sure to check out the developers GitHub.

Ubuntu / Debian

1
sudo apt install duf

Arch

1
sudo pacman -S duf

Fedora

1
sudo dnf install duf

For more installation methods, be sure to visit their GitHub Page!

Improving grep

What / for what is the Tool?

The Tool I am talking about, is ripgrep. It is like grep, but with Regular Expression support and other Improvements. It also adds line numbers to search results, adds highlighting and so much more.

Its syntax is also simpler, and on top it is faster. Here you can see a small chart of comparisons, I copied from their GitHub Page

ToolCommandLine CountTime
ripgrep (Unicode)rg -n -w '[A-Z]+_SUSPEND'4520.136s
git grepgit grep -P -n -w '[A-Z]+_SUSPEND'4520.348s
ugrep (Unicode)ugrep -r --ignore-files --no-hidden -I -w '[A-Z]+_SUSPEND'4520.506s
The Silver Searcherag -w '[A-Z]+_SUSPEND'4520.654s
git grepLC_ALL=C git grep -E -n -w '[A-Z]+_SUSPEND'4521.150s
ackack -w '[A-Z]+_SUSPEND'4524.054s
git grep (Unicode)LC_ALL=en_US.UTF-8 git grep -E -n -w '[A-Z]+_SUSPEND'4524.205s

This just shows how much faster ripgrep is. On top, it also has the better syntax (in my opinion).

All in all, it is a complete replacement to the traditional grep for me.

How to use the Tool

After installing the Tool, you can just use it.

I will not explain how you format the Regular Expression to use it, though.

Tips and Installation

To install the Tool, you can follow one of the following steps:

Ubuntu / Debian

1
sudo apt install ripgrep

Arch

1
sudo pacman -S ripgrep

Fedora

1
sudo dnf install ripgrep

Finding large folders

What / for what is the Tool?

Let me ask one question to you: How do you find large folders on your system to free up disk space / delete things you don’t need anymore?

I think that you will have no answer.

This is exactly what ncdu was built for.

It`s a program, which allows you to view all folders inside the current folder you are in. This now sounds like nothing special, but it also displays the size of each folder.

This now allows you to find your largest folders / disk space wasting folders, and delete them.

This is what it looks like: Image of 164b97c2-beb7-4204-99b4-6ec2ddc93f9c in action

And on top, it also allows you in the GUI to delete folders you no longer need.

All in all, it is a great utility you should definitely try to use, if you know the problem of sometimes not having enough disk space.

How to use the Tool

The usage is pretty simple. Navigate using either h j k l or the arrow keys.

With the press of d, you can delete a folder you no longer need.

Tips and Installation

If you want, you can use ncdu --exclude *.txt`` to exclude a specific file type from ncdu.

To Install ncdu you can use one of the following steps:

Ubuntu / Debian

1
sudo apt install ncdu

Arch Linux

1
sudo pacman -S ncdu

Fedora

1
sudo dnf install ncdu

Unpack all kind of archives

What / for what is the Tool?

This is something which made my life so much easier. You maybe have one Friend, who sends his files packed in zip archives. The next one uses .tar.gz, and another one .gz.

This can get annoying really fast. Some people would write a simple shell script to handle those cases. This is a good idea, but it quickly falls apart.

What will you do when you encounter another packaging format? Maybe another Windows one? Then someone else uses another format?

This is exactly the point I was at, and I thought: “There must be a simple solution to that? It can’t be that I am the only one with that problem?”

And no, I definitely was not the only one. This is exactly what atool, with the command aunpack, was made for.

How to use the Tool

aunpack allows for one simple format, regardless of the packaging format: aunpack FILE. It also provides the command atool, which I never used, to be honest.

For me, using a single command to unpack all file formats I encountered so far, is more than good enough.

Tips and Installation

If you have a hard time remembering aunpack, think about aliasing aunpack to extract. That is at least what I have done.

If you want to install atool, follow one of those steps:

Ubuntu / Debian

1
sudo apt install atool

Arch Linux

1
sudo pacman -S atool

Fedora

1
sudo dnf install atool

Timing application

What / for what is the Tool?

This one may be pretty niche. I personally love optimizing scripts, finding better and faster alternatives etc.

This is exactly what hyperfine was made for.

It describes itself as “A command-line benchmarking tool”. And this is exactly what it is and does.

It allows you to run a command multiple times, find the average runtime, and so much more.

This is a must-have for everyone who loves to optimize their CLI workflow.

As an example here, you can see a benchmark between 164b97c2-beb7-4204-99b4-6ec2ddc93f9c and 164b97c2-beb7-4204-99b4-6ec2ddc93f9c: GIF of the benchmark between fd and find using hyprfine

How to use the Tool

To use hyperfine, you just need to do the following: hyperfine COMMAND.

This is the basic usage I use the most. If you want to learn more and dive deeper into the usage of hyperfine, be sure to check out their GitHub!

Tips and Installation

To install hyperfine, please follow one of the following steps:

Ubuntu / Debian

Download the appropriate .deb package from the Release page and install it via dpkg:

1
2
wget https://github.com/sharkdp/hyperfine/releases/download/v1.16.1/hyperfine_1.16.1_amd64.deb
sudo dpkg -i hyperfine_1.16.1_amd64.deb

Arch Linux

1
sudo pacman -S hyperfine

Fedora

1
sudo dnf install hyperfine

Standardize your git commit messages

What / for what is the Tool?

This one is for every developer (or person that uses git).

You may know the problem: You have changed something and now want to find out where / who changed something in your git repository. Then you need to look through many commits, with maybe useless titles, and find the one you were looking for.

This is what czg is preventing. It is standardizing all your commits, by letting you choose which type of change you made, which issues you resolved, and more once you commit.

This prevents the issue where you won’t find what you were looking for. Why? Let`s say you are looking who and where the Feature XY was implemented. Now you can search for every git commit, including feat: (Short for feature) and XY.

This is really awesome because you can now group your commits and search for specific categories of titles.

On top, your description of the commit is also standardized. Even your issue-closing in the commit now looks the same across the board.

I think, I don’t need you to tell you why this is awesome?

They also implemented ai support using OpenAI. This is something which is a big downgrade for me, but maybe you will love that feature :)

How to use the Tool

To use it, you simply need to be in a git directory, and then run czg. If you have already added some files to commit, you will get a dialog which will look something like this: Video of 164b97c2-beb7-4204-99b4-6ec2ddc93f9c in use

After choosing everything and entering your description, you are ready to push your new change.

And thats it. Isnt that awesome?

Tips and Installation

If you want to sign your commits using a GPG key, you can simply run czg gpg. It will then use your default GPG key to sign the commit.

To install czg, please follow one of those steps:

1
npm install -g czg
1
brew install czg