Skip to content

CLI Random Tips

taco-chacho

Adding Commands

When you download an application using wget, you can add it to your command directory rather than updating your PATH variable.

wget DOMAIN-TO-DOWNLOAD-APPLICATION
Extract Application from tarball if necessary:
tar -xf APPLICATION-TARFILE-NAME 
CD
cd APPLICATION-EXTRACTED-DIRECTORY
List the contents of the directory to see the exact name of the applicaiton.
ls
Install the application where it belongs.
install APPLICATION-NAME /usr/local/bin

Forgetting Sudo

It turns out this is such a common occurance, there's a shortcut for when it happens. Rather than punching that up arrow, CTRL+A to the beginning, you can just sudo !! and it will apply sudo to whatever your last command was.

sudo !!

Read the Error Message!

This sounds like common sense, but it turns out that I'm not alone in sometimes getting caught up in what I thought the error was that if I'd just read the error output, it would have led me to the issue quicker.

Pipe Output to vim -

If you don't know where you want to put the output of a command yet

grep -Hnri "chacho" | vim -
This opens the output of the command in vim where you can edit it or you can use :%! to run the output back through another command:
:%!grep -v sushi
or
:%!sort