As a software engineer, I am using the shell a lot. Besides the IDE, it is the most important tool. Since working in the shell can be complex sometimes, it is important to find the right tooling which not only makes working in the shell a lot of fun but also boost your productivity.
Here you can find a list of my favorite tools.
Since there is so much out there, and I am 100% sure I have missed a beneficial tool, feel free to give me a hint.
ack is a replacement for grep for searching in source code written in Perl which is much easier to use.
You just need to add the pattern you want to search for after the ack command and the list with the occurrences in all files in the current folder recursively with a nice color highlighting will show up.
ack diginights
If you want to search for occurrences only in specific files, just add its type as option:
ack --type=markdown diginights
You can install ack with Homebrew brew install ack
or go to the installation guide
for other installation options.
Don't forget to check out the documentation for more options like search by regular expression pattern or change the highlight colors.
Midnight Commander is a visual file manager for the terminal. Its initial release was in 1994.
mc allows you to do the standard file and folder operations like copy, move and delete in a rich full-screen text mode. You can also search for files, connect to external services like ftp or sftp and even compare files.
You can install mc on macOS with Homebrew brew install mc
or go to the
Midnight Commander Development Center for installation other options.
htop is an interactive system monitor, process viewer, and a process manager in one application.
You will have the following data in one scrollable terminal screen:
The keyboard shortcuts can be seen in the bottom footer. Press F1 for help to see more.
For example, you can kill a process right out of htop by highlighting it and pressing F9.
You can install htop on macOS with Homebrew brew install htop
or check the
GitHub repository for other installation options and the documentation.
Like htop, glances is also an interactive system monitor. Besides, htop, glances shows more system information like networkm, disk i/o and much more.
For some of the following features, you will need to install additional libraries.
glances also provides a server / client mode. You can connect to an external server by terminal or even by a web browser.
You can install glances on macOS with Homebrew brew install glances
or check the
GitHub page for other installation options and the documentation.
ctop is an interactive container monitor showing following statistics of each container
If you want to check on the ressources of one of your containers for example when it is importing a MySQL dump, ctop is the perfect tool.
Each container has an extra menu with more features
You can select a container with the arrow keys (up/down) and open up the menu by pressing ENTER.
Install ctop on macOS with Homebrew brew install htop
or check the GitHub repository
for other installation options.
autojump (j) is a faster way to navigate your filesystem. For example, you just have to enter j michilehr.de
to jump
to the given directory. It does not matter in which directory you currently are at the moment.
autojump maintains a database of the directories you use the most from the command line.
But be aware that a directory has to be visited first before it can be jumped to.
Instead of jumping to a directory in the terminal, you can also open up the default file explorer (Finder, Windows
Explorer etc.) pointing to the directory instead by calling jo michilehr.de
.
Install autojump on macOS with Homebrew brew install autojump
or check the
GitHub repository for other installation options and the documentation.
On macOS, you need to add the following lines to your ~/.bash_profile or ~/.zshrc file:
[ -f $(brew --prefix)/etc/profile.d/autojump.sh ] && . $(brew --prefix)/etc/profile.d/autojump.sh
If you want to use the autocompletion feature with Oh My Zsh, you need to enable the autojump plugin first:
plugins=(... autojump)
fx is a command-line processing tool to beautify JSON in an interactive viewer.
You can either pass a filename as the first parameter fx example_2.json
or pipe JSON into it for example from a curl
response curl -L https://bit.ly/3Go7Njv | fx
In the interactive window, you can navigate with the arrow keys or use your mouse to expand arrays and objects by clicking on {...}.
With fx, you can use the full power of JavaScript. Given you have the following JSON...
{
"list": "My favorite books",
"books": [
{
"name": "All those trees",
"type": "Thriller"
},
{
"name": "All those bees",
"type": "Fantasy"
}
]
}
... and you want to replace the type of all books which have the type Fantasy by the type Thriller, you can use JavaScript to manipulate the JSON...
cat test.json | fx '{...this, books: this.books.map(x => x.type == "Thriller" ? x : {...x, type: "Thriller"})}'
... which results in the following output:
{
"list": "My favorite books",
"books": [
{
"name": "All those trees",
"type": "Thriller"
},
{
"name": "All those bees",
"type": "Thriller"
}
]
}
You can install fx with Homebrew brew install fx
, npm npm install -g fx
or go to the
GitHub repository for
other installation options. The full documentation can be found over
here.
duf is a simple utility to show the disk usage and free space on a machine with a colorful output. Just start with
entering duf
without any command-line arguments.
If you need to process the data, you can also output the data in JSON duf --json
.
Install duf on macOS with Homebrew brew install duf
or check the GitHub repository
for other installation options including the documentation.
bat is a replacement for cat when you want to show source code. Its main feature is a nice syntax highlighting.
bat has a few more features like a nice git integration to show the modifications with respect to the index.
Install bat on macOS with Homebrew brew install bat
or check the GitHub repository
for other installation options including the documentation.
exa is a modern replacement for the file-listing cli application 'ls' with more features and better defaults. For example, it uses colors to differentiate between file types and also between different metadata.
Install exa on macOS with Homebrew brew install exa
or check the GitHub repository for
other installation options including the documentation.
pbcopy is a simple tool that outputs the content of a file or redirects the output of command line tool into the clipboard buffer.
# put content of file into clipboard buffer
pbcopy < example.file
# redirect output of command line tool clipboard buffer
echo 'Hello World!' | pbcopy
On macOS, pbcopy is available by default in the terminal. On Linux, you can use xclip which has a little different syntax.
If you need to rename a lot of files by a consistent naming scheme, F2 is the right tool for you with lots of different options like find and replace by regular expressions or exif data.
By default, F2 shows a preview table with the original and renamed filename with a status. Only if the status is OK and
there were no conflict errors, you can run the command again with the argument -x
to apply the changes.
In the example, I am renaming the photos of a mountainbike trip.
What I have:
20220312_132843895.jpg
What I want:
001-2022-03-12-bikerausch-wintertour-im-pfälzer-wald.jpg
Here I can use two different commands:
By regular expressions:
f2 -f '(\d{4})(\d{2})(\d{2}).*.jpg' -r '{%03d}-$1-$2-$3-bikerausch-wintertour-im-pfälzer-wald.jpg'
-f
find files by regular expression patterns-r
start name with count ({%03d}
) and add found regex patterns ($1
, $2
, $3
)By exif data:
f2 -f '.*.jpg' -r '{%03d}-{{exif.cdt.YYYY}}-{{exif.cdt.MM}}-{{exif.cdt.DD}}-bikerausch-wintertour-im-pfälzer-wald.jpg'
-f
find all jpeg files by regular expression patterns-r
start name with count ({%03d}
) and add year, month and date by exiftoolBy adding {%03d}
, F2 automatically adds a counter with 3 digits at its position. There are other built-in variables
available like a random string or the file hash.
When you have validated the preview table, you can run the command again adding the argument -x
to apply the changes and
rename your files.
F2 is written in Go and is pretty fast.
You can install F2 with brew install f2
, yarn global add @ayoisaiah/f2
or other installation methods.
Check the GitHub repository for the documentation.