---
title: "shell | 今日の学び | OOZOU"
description: "OOZOUチームによる短く実践的なshellのメモ。"
canonical: https://oozou.com/ja/til-topics/shell
locale: ja
---

# shell | 今日の学び

> OOZOUチームによる短く実践的なshellのメモ。

- [BashとZshでシークレット（プライベート）なコマンドを実行する](https://oozou.com/ja/til/run-incognito-private-commands-for-bash-and-zsh-112) ([markdown](https://oozou.com/ja/til/run-incognito-private-commands-for-bash-and-zsh-112.md)) (2020-12-08): コマンドの前にスペースを1つ入れるだけで、~/.bash\_history に保存されなくなります。例： qrencode -o out.png "Some secret text"
- [Homebrewでpostgresデータベースをアップグレードする](https://oozou.com/ja/til/upgrade-postgres-database-with-homebrew-76) ([markdown](https://oozou.com/ja/til/upgrade-postgres-database-with-homebrew-76.md)) (2020-10-22): postgresをアップグレードするには次を実行します
- [Amazon AWS S3 CLI で権限を指定してコピーする](https://oozou.com/ja/til/amazon-aws-s3-cli-copy-with-set-perms-14) ([markdown](https://oozou.com/ja/til/amazon-aws-s3-cli-copy-with-set-perms-14.md)) (2020-10-13): term (または同等のターミナル) を開き、次を貼り付けます：
- [怒りの Docker パージ](https://oozou.com/ja/til/angry-docker-purge-72) ([markdown](https://oozou.com/ja/til/angry-docker-purge-72.md)) (2020-10-13): Docker で No Space left エラーが出たときの力技の解決策がこちらです：
- [同じ名前 + 接尾辞でファイルをバックアップする](https://oozou.com/ja/til/back-up-a-file-with-same-name-prefix-42) ([markdown](https://oozou.com/ja/til/back-up-a-file-with-same-name-prefix-42.md)) (2020-10-13): NOTE: 実際には !#:1 はどのコマンドでも使えます。コマンドに渡された最後の引数を指すからです。
- [Bash のエイリアスと魔法](https://oozou.com/ja/til/bash-aliases-and-magic-46) ([markdown](https://oozou.com/ja/til/bash-aliases-and-magic-46.md)) (2020-10-13): ユーザーフォルダに ~/.aliases という別ファイルを置いています。ここにすべての bash エイリアスを保存しています。エイリアスをよく使い、新しいものを定期的に追加するので、その場で新しいエイリアスを追加できる…
- [IKEA の商品在庫を確認する](https://oozou.com/ja/til/check-for-ikea-item-availability-70) ([markdown](https://oozou.com/ja/til/check-for-ikea-item-availability-70.md)) (2020-10-13): IKEA の商品の再入荷を待っているなら、自動で最新情報を把握できる実用的な解決策があります。このガイドでは、シェルスクリプトを使って IKEA の在庫状況を確認し…
- [シェルスクリプトでコマンドの存在を確認する](https://oozou.com/ja/til/check-if-command-exists-with-shell-script-52) ([markdown](https://oozou.com/ja/til/check-if-command-exists-with-shell-script-52.md)) (2020-10-13): シェルスクリプトでコマンドの存在を確認する
- [独自の git コマンド (エイリアス) を作る](https://oozou.com/ja/til/create-your-own-git-commands-aliases-15) ([markdown](https://oozou.com/ja/til/create-your-own-git-commands-aliases-15.md)) (2020-10-13): git コマンドを短くしたいと思ったことはありませんか？もちろんシェルのエイリアスでも実現できますが、それぞれのエイリアスが何を表すか忘れないように常にコンテキストを含める必要があります。実は git では独自の…
- [Git でマージ済みのブランチを削除する](https://oozou.com/ja/til/delete-already-merged-branchs-in-git-36) ([markdown](https://oozou.com/ja/til/delete-already-merged-branchs-in-git-36.md)) (2020-10-13): egrep -v 'master|develop|foo|bar' のようにして、除外するブランチを増やせます
- [マージ済みの git ブランチを削除する](https://oozou.com/ja/til/delete-merged-git-branches-51) ([markdown](https://oozou.com/ja/til/delete-merged-git-branches-51.md)) (2020-10-13): マージ済みのローカル git ブランチをすべて削除する便利な git コマンドです git branch --merged | egrep -v "(^\\|master|dev)" | xargs git branch -d*
- [Git でローカルファイルをリモートのバージョンと diff する](https://oozou.com/ja/til/diff-a-local-file-with-remote-version-in-git-35) ([markdown](https://oozou.com/ja/til/diff-a-local-file-with-remote-version-in-git-35.md)) (2020-10-13): 以下のコマンドを実行するだけで、リモートとの差分を簡単に取得できます
- [コミットからブランチを見つける](https://oozou.com/ja/til/find-a-branch-based-on-a-commit-53) ([markdown](https://oozou.com/ja/til/find-a-branch-based-on-a-commit-53.md)) (2020-10-13): c198bb715 Make default expired description logic pretty `
- [以前のコミットをリポジトリに強制プッシュする](https://oozou.com/ja/til/force-push-previous-commit-to-repo-44) ([markdown](https://oozou.com/ja/til/force-push-previous-commit-to-repo-44.md)) (2020-10-13): コードをプッシュした後で、以前のコミットを強制プッシュしたい場合は次のように実行できます shell git push origin +commit\sha^:branch\name
- [現在の git ブランチ名を取得する](https://oozou.com/ja/til/get-current-git-branch-name-43) ([markdown](https://oozou.com/ja/til/get-current-git-branch-name-43.md)) (2020-10-13): 現在の git ブランチ名を取得する
- [ファイルの Git 履歴を追う（GUI）](https://oozou.com/ja/til/go-through-a-file-git-history-gui-67) ([markdown](https://oozou.com/ja/til/go-through-a-file-git-history-gui-67.md)) (2020-10-13): ファイルの Git 履歴を追う（GUI）
- [固まった rails を kill する](https://oozou.com/ja/til/kill-rails-that-got-stuck-63) ([markdown](https://oozou.com/ja/til/kill-rails-that-got-stuck-63.md)) (2020-10-13): 特定のポートで動いている rails を kill したい。（私のラップトップでは複数の rails サーバーが動いています。）
- [応答しなくなった SSH セッションを kill する](https://oozou.com/ja/til/kill-unresponsive-ssh-session-65) ([markdown](https://oozou.com/ja/til/kill-unresponsive-ssh-session-65.md)) (2020-10-13): SSH セッションはたまに応答しなくなることがあります。私の場合、ラップトップをスリープさせるとかなり頻繁に起きます。タブごと閉じるのではなく、SSH のエスケープ文字を使ってセッションを kill できます
- [特定のディレクトリを除いてディレクトリ構造を一覧表示する](https://oozou.com/ja/til/list-directory-structure-except-one-or-more-dirs-24) ([markdown](https://oozou.com/ja/til/list-directory-structure-except-one-or-more-dirs-24.md)) (2020-10-13): 1 つか 2 つのディレクトリを除いて、カレントディレクトリの構造を表示したいと思ったことはありませんか？
- [hub を使ってコマンドラインから PR を作成する](https://oozou.com/ja/til/make-a-pr-from-command-line-using-hub-3) ([markdown](https://oozou.com/ja/til/make-a-pr-from-command-line-using-hub-3.md)) (2020-10-13): まず brew で hub をインストールします: brew install hub 次に、以下の例のようなシンプルなコマンドを使います: hub pull-request -m "best pr ever" -b oozou:develop -h feature/awesome-improvements
- [ブランチから不要なコミットを削除する](https://oozou.com/ja/til/remove-unwanted-commit-from-your-branch-34) ([markdown](https://oozou.com/ja/til/remove-unwanted-commit-from-your-branch-34.md)) (2020-10-13): ブランチから不要なコミットを削除する
- [Gitで削除したファイルを復元する](https://oozou.com/ja/til/restore-a-deleted-file-in-git-5) ([markdown](https://oozou.com/ja/til/restore-a-deleted-file-in-git-5.md)) (2020-10-13): Gitで削除したファイルを復元する
- [同じコマンドを異なる入力に対して実行する](https://oozou.com/ja/til/run-same-command-on-different-input-inputs-71) ([markdown](https://oozou.com/ja/til/run-same-command-on-different-input-inputs-71.md)) (2020-10-13): 同じコマンドを異なる入力（複数の入力）に対して繰り返し実行しなければならない場合の方法です。
- [過去のコミットで削除されたファイルを確認する [git]](https://oozou.com/ja/til/see-deleted-files-in-previous-commits-git-60) ([markdown](https://oozou.com/ja/til/see-deleted-files-in-previous-commits-git-60.md)) (2020-10-13): 過去のコミットで削除されたファイルを確認する [git]
- [cURLでSlackにメッセージを送信する](https://oozou.com/ja/til/send-messages-to-slack-using-curl-26) ([markdown](https://oozou.com/ja/til/send-messages-to-slack-using-curl-26.md)) (2020-10-13): Slackでは、Webhooksサービス経由でメッセージを送信できます
- [古いリポジトリをshallow cloneする](https://oozou.com/ja/til/shallow-clone-a-old-repo-2) ([markdown](https://oozou.com/ja/til/shallow-clone-a-old-repo-2.md)) (2020-10-13): 作業するリポジトリでGitの全履歴が必要ない場合は、クローンの深さを指定して、リポジトリの直近x個のリビジョンだけをクローンできます。
- [`host` でドメインの詳細情報を取得する](https://oozou.com/ja/til/use-host-to-get-more-information-about-domains-20) ([markdown](https://oozou.com/ja/til/use-host-to-get-more-information-about-domains-20.md)) (2020-10-13): DNSサーバーからドメインのA/CNAME/MXなどのレコードを調べるのに dig を使っているかもしれません。しかし、手早く概要を知りたいだけなら host を使いましょう。
- [Gitのエイリアス機能を使う ](https://oozou.com/ja/til/using-git-s-aliases-feature-61) ([markdown](https://oozou.com/ja/til/using-git-s-aliases-feature-61.md)) (2020-10-13): Gitでは、configを通じて内部的にエイリアスを作成できます。グローバルconfigは ~/.gitconfig にあるはずです
- [GithubのCIステータスを監視する](https://oozou.com/ja/til/watch-ci-status-on-github-47) ([markdown](https://oozou.com/ja/til/watch-ci-status-on-github-47.md)) (2020-10-13): Githubの hub をインストールしていれば、現在のブランチの ci-status を次のように取得できます。
- [ファイルツリーを一覧表示するZsh関数](https://oozou.com/ja/til/zsh-function-to-list-file-tree-17) ([markdown](https://oozou.com/ja/til/zsh-function-to-list-file-tree-17.md)) (2020-10-13): コマンドラインでディレクトリを移動していると、ディレクトリとサブディレクトリの構造を「ツリー」形式で確認できると便利なことがよくあります。treeのようなツールは数多くありますが…

All notes: [今日の学び](https://oozou.com/ja/til) ([markdown](https://oozou.com/ja/til.md)).

---

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

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