<< Go Back

Words from Jacob Herrington >>

Howdy! 🤠

I write code at Engine and I run the devpath.fm podcast. I also help maintain the Solidus platform.

Sometimes I do consulting through Narvi.

I live in Northwest Arkansas with my incredibly talented wife Kristen and our dogs.


Social Links


Talks

I'm trying to fool conferences into giving me a microphone.

  • My Heroes Are Imposters Too (200OK 2019):
    Slides | Video

Conferences

I like to help organize conferences. I've been a board member, fundraiser, or talk reviewer for each of the events on this list.


Uses

I use all of these tools daily-ish.


~$ ./jh.codes

5 Handy Bash Tricks in 2 Minutes

August 11, 2019

This article should only take you a couple of minutes to read, and you’ll walk away with a handful of the bash tricks I constantly use.

1. Make a directory and navigate to it

mkdir /foo/bar && cd $_

In bash, $_ is a reference to the last parameter that was used. It can come in handy all over the place. Generally, the best use for $_ is to avoid repeating yourself in cases like the above example.

2. Backup a file without typing it twice

cp /some/path/to/file.txt{,.bak}

This feature of bash is called brace expansion, it has a ton of useful applications. This is just one I sometimes use when I want to create a copy of a file quickly.

3. Move every file in a folder

for file in * ; do mv $file ../elsewhere/$file; done

In this oneliner, we are taking advantage of bash’s ability to loop over the files in a directory.

Frequently, I find myself using this syntax to avoid using multiple lines.

4. Find a command by its description

apropos "some description"

apropos is a command that looks through the commands on your machine for one that has a description like the one you provided.

It can be extremely useful when you remember what a command does, but not its name.

5. Repeat the last command with sudo

sudo !!

!! is a quick way to repeat the last command. I do this a ton.

Feel free to add your own useful bash tricks in the comments. 🤠