---
title: "shell | Today I Learned | OOZOU"
description: "Short, practical shell notes from the OOZOU team."
canonical: https://oozou.com/til-topics/shell
locale: en
---

# shell | Today I Learned

> Short, practical shell notes from the OOZOU team.

- [Run incognito/private commands for Bash and Zsh](https://oozou.com/til/run-incognito-private-commands-for-bash-and-zsh-112) ([markdown](https://oozou.com/til/run-incognito-private-commands-for-bash-and-zsh-112.md)) (2020-12-08): Simply put a space before the command and it won't be saved to ~/.bash\_history. E.g.  qrencode -o out.png "Some secret text"
- [Upgrade postgres database with homebrew](https://oozou.com/til/upgrade-postgres-database-with-homebrew-76) ([markdown](https://oozou.com/til/upgrade-postgres-database-with-homebrew-76.md)) (2020-10-22): To upgrade postgres you can run
- [Amazon AWS S3 CLI copy with set perms](https://oozou.com/til/amazon-aws-s3-cli-copy-with-set-perms-14) ([markdown](https://oozou.com/til/amazon-aws-s3-cli-copy-with-set-perms-14.md)) (2020-10-13): Open term (or equivalent) and paste the following:
- [Angry Docker Purge](https://oozou.com/til/angry-docker-purge-72) ([markdown](https://oozou.com/til/angry-docker-purge-72.md)) (2020-10-13): If you receive No Space left error on Docker this the brute force solution:
- [Back up a file with same name + prefix](https://oozou.com/til/back-up-a-file-with-same-name-prefix-42) ([markdown](https://oozou.com/til/back-up-a-file-with-same-name-prefix-42.md)) (2020-10-13): NOTE: Actually you can use !#:1 in every command 'cause that's last argument passed to a command.
- [Bash aliases and magic](https://oozou.com/til/bash-aliases-and-magic-46) ([markdown](https://oozou.com/til/bash-aliases-and-magic-46.md)) (2020-10-13): I have a seperate file in my user folder named ~/.aliases. I use this to store all of my bash aliases. I use aliases a lot and add new ones regularly so I created a bash function to add new aliases…
- [Check for IKEA item availability](https://oozou.com/til/check-for-ikea-item-availability-70) ([markdown](https://oozou.com/til/check-for-ikea-item-availability-70.md)) (2020-10-13): If you're waiting for an IKEA item to restock, here's a practical solution to stay updated automatically. This guide explains how to use a shell script to check IKEA's stock availability and get…
- [Check if command exists with shell script](https://oozou.com/til/check-if-command-exists-with-shell-script-52) ([markdown](https://oozou.com/til/check-if-command-exists-with-shell-script-52.md)) (2020-10-13): Check if command exists with shell script
- [Create your own git commands (aliases)](https://oozou.com/til/create-your-own-git-commands-aliases-15) ([markdown](https://oozou.com/til/create-your-own-git-commands-aliases-15.md)) (2020-10-13): Ever wanted to shorten a git command? You can go with shell alilas for sure but you have to always include context so that you don't forget what each ailas stands for but you can define your own…
- [Delete already-merged branchs in Git](https://oozou.com/til/delete-already-merged-branchs-in-git-36) ([markdown](https://oozou.com/til/delete-already-merged-branchs-in-git-36.md)) (2020-10-13): You can safelist more branches in egrep -v 'master|develop|foo|bar'
- [Delete merged git branches](https://oozou.com/til/delete-merged-git-branches-51) ([markdown](https://oozou.com/til/delete-merged-git-branches-51.md)) (2020-10-13): Handy git command for deleting all local git branches that already merged git branch --merged | egrep -v "(^\\|master|dev)" | xargs git branch -d*
- [Diff a local file with remote version in Git](https://oozou.com/til/diff-a-local-file-with-remote-version-in-git-35) ([markdown](https://oozou.com/til/diff-a-local-file-with-remote-version-in-git-35.md)) (2020-10-13): Easily run the below command and get a diff version from the remote
- [Find a branch based on a commit](https://oozou.com/til/find-a-branch-based-on-a-commit-53) ([markdown](https://oozou.com/til/find-a-branch-based-on-a-commit-53.md)) (2020-10-13): c198bb715 Make default expired description logic pretty `
- [Force push previous commit to repo](https://oozou.com/til/force-push-previous-commit-to-repo-44) ([markdown](https://oozou.com/til/force-push-previous-commit-to-repo-44.md)) (2020-10-13): If you push some code and want to force push a previous commit you can do so with shell git push origin +commit\sha^:branch\name
- [Get current git branch name](https://oozou.com/til/get-current-git-branch-name-43) ([markdown](https://oozou.com/til/get-current-git-branch-name-43.md)) (2020-10-13): Get current git branch name
- [Go through a file Git history (GUI)](https://oozou.com/til/go-through-a-file-git-history-gui-67) ([markdown](https://oozou.com/til/go-through-a-file-git-history-gui-67.md)) (2020-10-13): Go through a file Git history (GUI)
- [Kill rails that got stuck](https://oozou.com/til/kill-rails-that-got-stuck-63) ([markdown](https://oozou.com/til/kill-rails-that-got-stuck-63.md)) (2020-10-13): I'd like to kill rails running w/specific port. (My laptop running several rails servers. )
- [Kill unresponsive SSH session](https://oozou.com/til/kill-unresponsive-ssh-session-65) ([markdown](https://oozou.com/til/kill-unresponsive-ssh-session-65.md)) (2020-10-13): Occasionally an SSH session may become unresponsive. If I put my laptop to sleep this happens fairly often. Rather than killing the tab you can use SSH Escape Characters to kill the session
- [List directory structure except one or more dirs](https://oozou.com/til/list-directory-structure-except-one-or-more-dirs-24) ([markdown](https://oozou.com/til/list-directory-structure-except-one-or-more-dirs-24.md)) (2020-10-13): Ever wanted to display the structure of the current directory except or two directories?
- [make a pr from command line using hub](https://oozou.com/til/make-a-pr-from-command-line-using-hub-3) ([markdown](https://oozou.com/til/make-a-pr-from-command-line-using-hub-3.md)) (2020-10-13): install hub first with brew: brew install hub then use a simple command, like at the example below: hub pull-request -m "best pr ever" -b oozou:develop -h feature/awesome-improvements
- [Remove unwanted commit from your branch](https://oozou.com/til/remove-unwanted-commit-from-your-branch-34) ([markdown](https://oozou.com/til/remove-unwanted-commit-from-your-branch-34.md)) (2020-10-13): Remove unwanted commit from your branch
- [Restore a deleted file in Git](https://oozou.com/til/restore-a-deleted-file-in-git-5) ([markdown](https://oozou.com/til/restore-a-deleted-file-in-git-5.md)) (2020-10-13): Restore a deleted file in Git
- [Run same command on different input/inputs](https://oozou.com/til/run-same-command-on-different-input-inputs-71) ([markdown](https://oozou.com/til/run-same-command-on-different-input-inputs-71.md)) (2020-10-13): If you have to run the same command repetitively over different input/inputs.
- [See deleted files in previous commits [git]](https://oozou.com/til/see-deleted-files-in-previous-commits-git-60) ([markdown](https://oozou.com/til/see-deleted-files-in-previous-commits-git-60.md)) (2020-10-13): See deleted files in previous commits [git]
- [Send messages to Slack using cURL](https://oozou.com/til/send-messages-to-slack-using-curl-26) ([markdown](https://oozou.com/til/send-messages-to-slack-using-curl-26.md)) (2020-10-13): Slack allows you to send messages via the Webhooks service
- [Shallow clone a old repo](https://oozou.com/til/shallow-clone-a-old-repo-2) ([markdown](https://oozou.com/til/shallow-clone-a-old-repo-2.md)) (2020-10-13): If you don't need the full git history for a repo you will be working on you can supply a clone depth to only clone x revisions of the repo.
- [Use `host` to get more information about domains](https://oozou.com/til/use-host-to-get-more-information-about-domains-20) ([markdown](https://oozou.com/til/use-host-to-get-more-information-about-domains-20.md)) (2020-10-13): You might be using dig to find out A/CNAME/MX etc records of a domain from DNS servers. But if you just want to get a quick overview, use host:
- [Using Git's aliases feature ](https://oozou.com/til/using-git-s-aliases-feature-61) ([markdown](https://oozou.com/til/using-git-s-aliases-feature-61.md)) (2020-10-13): Git allows you to create aliases internally through the config. Your global config should be located here ~/.gitconfig
- [Watch CI status on Github](https://oozou.com/til/watch-ci-status-on-github-47) ([markdown](https://oozou.com/til/watch-ci-status-on-github-47.md)) (2020-10-13): When you have Github's hub installed, you can get the ci-status of your current branch like this:
- [Zsh function to list file tree](https://oozou.com/til/zsh-function-to-list-file-tree-17) ([markdown](https://oozou.com/til/zsh-function-to-list-file-tree-17.md)) (2020-10-13): When navigating through directories on the command line, it’s often helpful to see the structure of directories and subdirectories in a "tree" format. While there are plenty of tools out there, such…

All notes: [Today I Learned](https://oozou.com/til) ([markdown](https://oozou.com/til.md)).

---

Contact OOZOU: hello@oozou.com · +66 2544 0000 · https://oozou.com/contact

More for AI agents: https://oozou.com/llms.txt · every page has a markdown twin at its URL plus ".md"
