What the heck are they using xargs for?

You know how to connect two tools via stdin and stdout? Great!

  • But how about the commands that don’t read from it’s input-datastream?
  • How to interconnect commands together, that naturally won’t fit?

This is, where xargs comes into play.

And because I know your time is precious - I’ve created this really short video-training … only 7:32 min :-)

In this video you will also discover …

  • the one big philosophy you can expect from most linux-tools

  • which commands can be interconnected directly

  • and the only two parameters you need for controlling the behavior of xargs most of the time.

So sit back, watch and enjoy …

If your shell always get’s you wrong - quote the right way

This is another topic I’m often questioned about by my students: quoting when working with the shell:

…What are the problems with these “special-characters”?…

As you know, there are characters at the command line, that simply has special meanings for the shell.

You use them for instance for referencing the content of a variable (“$”) or for redirecting a datatream to a file (“>”):

~$ ls -l /etc > $TEMPFILE

Everytime you use such special characters but you don’t want that special meaning for the shell, you have to care about it accordingly.

This mechanism is called “quoting” and technically explained for instance in depth in the Bash-Documentation.

In this post I show you how the quoting works. And your shell never gets you wrong again … ;-)

read more »

SSH port-forwarding from within the Google Cloud Shell

Google provides a very useful tool especially for those I’m calling “cloud workers”: the Cloud Shell. This gives you access to a linux-shell for just whatever you do usually in a linux shell - directly from your browser.

From time to time I use the cloud shell as a starting-point to connect via ssh to other systems. Recently I noticed that tcp-port-forwarding via the outgoing ssh-connections doesn’t work out of the box: When trying to establish a port-forwarding (ssh user@targethost -L 8080:127.0.0.1:8080) the following error occurs:

bind: Cannot assign requested address

… and the port-forwarding doesn’t work.

The reason for this is simple - as always as you know it: The ssh-client tries to bind to the local ipv6-port. This is not supported in the cloud shell and therefore fails.

read more »

How you delete commandlines from the bash history

And suddenly it happened again: I’ve typed sensitive information - at this time it was a password - into the commandline.

And the shell kindly saved the typed commandline into it’s history. This way it want’s to help me, if I need the same commandline again.

But what happens, if the system I’ve worked on isn’t under my full control (a customer system)? Or what if someone later looks over my shoulder, while I’m searching my history for an other command?

The sensitive line needs to be removed.

  • what’s the best way to do this?
  • How do we save us from doing this again at some time in the future?

Generally you have two ways to remove commanlines from the bash-history: by using the history command or by editing ~/.bash_history directly.

read more »