A CLI tool that can easily manage more than 281 runtimes, and it’s easy to add custom runtimes/plugins. It’s open-source!

Replica: https://www.lozanomatheus.com/post/an-easy-way-to-switch-between-runtime-versions-nodejs-terraform-and-279

How to keep tools updated. How to switch between versions on Linux
How to keep tools updated. How to switch between versions on Linux

Introduction

There are many tools out there that promise to manage multiple runtimes and/or runtime versions, some are exclusive to a specific language, like the pyenv and others can manage multiple runtimes, but it’s not easy to switch between the versions of the same runtime, like the Homebrew (You can unlink/link, but in my opinion, it’s too unstable).

Here comes the asdf, yes, this is the name. Simple name, simple to use! asdf is an open-source tool under the MIT License. Currently, it supports 281 runtimes, also known as plugins. …


Using Bash/Shell trap, a built-in command to define any action to be executed before exiting the Bash or Shell script. You can define multiple actions and per signal.

List of signals that can be used on Bash / Shell trap
List of signals that can be used on Bash / Shell trap

Replica: https://www.lozanomatheus.com/post/how-to-trigger-an-action-at-the-end-of-the-shell-bash-script

trap — ‘’ SIGTSTP
trap — ‘’ SIGTTIN
trap — ‘’ SIGTTOU

How it works

The Bash/Shell trap is a built-in command that can be used to trigger an action at the end of the script according to the signal. For example, you can use the ERR to run a function in case something goes wrong. Use the EXIT signal to run something every time that exists the script.

Note: Defining another action within the same signal will override the trap.

The Shell Trap built-in command and it’s available on most of the Linux and Unix distributions.

Signals available

Currently, there are 65…


How to get Linux IP address, netmask and gateway without ifconfig or ip commands

How to get Linux IP without ipconfig or ip address
How to get Linux IP without ipconfig or ip address

Replica: https://www.lozanomatheus.com/post/getting-the-linux-ip-address-without-any-package-ifconfig-ip-address-etc

bash: ip: command not found
bash: ifconfig: command not found

Explaining how it works

How many times you tried to debug/troubleshoot a Linux with an unprivileged user and you didn’t have net tools or iproute installed? Well, the good news is: You can do it with Bash (ok ok, this not a bash feature :’), without having to install any package.

Many information displayed by those tools are available by the Kernel and most of them doesn’t require a privileged user. Cool, right?

In order to understand how this is possible, we’re going to explore~very shortly~ the IPv4 Routing Subsystem, in specifically…


Sending HTTP / TCP / UDP requests via Bash without using any other tool

Image for post
Image for post

Replica: https://www.lozanomatheus.com/post/part01-tcp-udp-request-with-a-native-bash-feature-and-without-curl-wget

bash: wget: command not found
bash: curl: command not found

Explaining how it works

How many times you tried to test an application or service and you couldn't because you don't have curl/wget/telnet/* installed and the user doesn't have permission to install? Well, the good news is: You can do it with Bash, by native.

One of the optional features (also a default one) for Bash is the --{enable,disable}-net-redirections. With this feature, you can send TCP or UDP requests in many ways.

If host is a valid hostname or Internet address, and port is an integer port number or service name, Bash…

Bash Tips and Tricks

Bash tips and tricks that will save some time and lines.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store