Skip to content

Posts tagged "sh"

On which, type, and readlink commands

The `which` command identifies the location of a command. It does this by searching the `PATH` for executable files. The `-a` option prints all matching locations. To inspect the `PATH`, use `tr` to split it into separate lines for improved readability.

bash or sh

I prefer `!/bin/sh` over `!/bin/bash`. I begin almost every script with the same four lines. Use a POSIX-compliant shell. Exit immediately if any command returns a non-zero status (indicating an error).

Vim - Add a file to the staging area

This is a mapping that adds the current file to the git staging area. This won't work if the file is not located within your current working directory. How can you determine the current working directory?

git open - A shell script

git-open is a fantastic tool. It allows you to open a repo website in your browser. It supports Linux, Mac, and Windows, and supports GitHub, GitLab, and Bitbucket.

Fix laggy key presses

If key presses are slow or laggy, check the system configuration. On Ubuntu you can configure keyboard repeat interval and delay.

Remapping CapsLock to Escape

Do you use your CapsLock? Perhaps you like shouting at people. If you're a vim user, I suggest remapping it to Escape or at least something more useful.