Change / Rename file extension on multiple files

for f in *.markdown; do mv -- "$f" "${f%.markdown}.md"; done

Remove JSON comments

See JSON

One line simple Web server (In Python)

python -m SimpleHTTPServer 8000

Search current folder

export PATH=$PATH:.

And add to ~/.bashrc

How to check bash exit status

doSomeCommand

if [ $? -eq 0 ]
then
    echo "Success"
else
    echo "Failure"
fi

What’s my (external) IP address?

curl -s -H 'Accept: application/json' ipinfo.io \
      | fgrep  '"ip":'                          \
       | tr -dc '[0-9].'

File name extraction

filename=$(basename "$fullfile")
extension="${filename##*.}"
filename="${filename%.*}"

Run in same directory

#! /bin/bash
#
cd $(dirname "$0")

But this won’t work if there are spaces in the directory spec.