Cool Bash Tricks for Your Terminal's "Dotfiles"
You may have noticed the recent trend of techies posting their "dotfiles" on GitHub for the world to see. These usually contain shortcuts compatible with Bash terminals to automate convoluted commands that, I'll admit, I needed to Google every single time.
My full dotfiles are posted at this Git repository, but here's a summary of the ones I find most helpful that you can add to your own .bash_profile
or .bashrc
file.
Check your current IP address (IPv4 or IPv6 or both) — uses my ⚡ fast simpip server!
|
|
Check your current local IP address:
|
|
Check, clear, set (Google DNS or Cloudflare DNS or custom), and flush your computer's DNS, overriding your router:
|
|
Start a simple local web server in current directory:
|
|
Test your internet connection's speed (uses 100MB of data):
|
|
Query DNS records of a domain:
|
|
Make a new directory and change directories into it.
|
|
Unhide and rehide hidden files and folders on macOS:
|
|
Force empty trash on macOS:
|
|
Quickly lock your screen on macOS:
|
|
Update Homebrew packages, global NPM packages, Ruby Gems, and macOS in all one swoop:
|
|
Copy your public key to the clipboard:
|
|
Undo the most recent commit in current Git repo:
|
|
Un-quarantine an "unidentified developer's" application blocked by Gatekeeper on macOS's walled prison garden:
|
|
Quickly open a Bash prompt in a running Docker container:
|
|
Pull updates for all Docker images with the tag "latest":
|
|
This odd hack is needed to run any of these aliases as sudo:
|
|
View all of my dotfiles here or check out other cool programmers' dotfiles over at this amazing collection.