0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【macで短縮コマンド】シェル、エイリアス機能を使う

Posted at

macで短縮キーの作成

最近、laradockを使い始めて長いコマンドを打つことが多くなり、短縮できないかとリサーチしました。結果として、シェル、エイリアスという機能を使う事で達成できました。

この記事を読んで達成できること

laradockコマンドで
git clone https://github.com/Laradock/laradock.gitの実行

laraworkコマンドで
docker-compose exec --user=laradock workspace /bin/bashの実行

macのバージョン

macOS catalina 10.15.3

どのシェルを使っているか確認してください。

最新のmacバージョンではzshを使っているようです。

% echo $SHELL
/bin/zsh

使えるシェルの一覧を確認できます。

% cat /etc/shells
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.

/bin/bash
/bin/csh
/bin/dash
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh

エイリアスへの登録

.zshrcを開きます

% vim ~/.zshrc

エイリアスを登録

alias 短縮キー="短縮キーとして登録したい内容"の形で記載します。

.zshrc
alias laradock='git clone https://github.com/Laradock/laradock.git'
alias larawork='docker-compose exec --user=laradock workspace /bin/bash'

反映します。

% source ~/.zshrc

終了です、お疲れ様でした。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?