0
0

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 1 year has passed since last update.

Linux aliasについて(自分用メモ

Posted at

bashにはコマンドにエイリアス(別名)を付けられる機能があり、複雑で長いコマンドや必須のオプションの入力が省略可。


●エイリアスの設定はaliasコマンドを使用。



alias [エイリアス名='コマンド']

コマンドが2語以上になる場合は、シングルクォート(’)かダブルクォート(")で括ることに注意。



例)コマンドラインから「rm」と入力すると「rm -i」コマンド(対話式の削除)が実行されるよう設定する場合


$ alias rm='rm -i'


※エイリアスの前に「¥」「\」をつけることで、一時的にエイリアスを無効にできる。

また、現在登録されているエイリアスを確認するには、aliasコマンドを引数無しで実行。



●登録したエイリアスを削除するには、「unalias」コマンドを使う。

unalias [-a] [エイリアス名]



例)エイリアス「rm」を削除する場合


$ unalias rm



オプション「-a」を指定すると、登録されている全てのエイリアスが削除されます。この場合、引数のエイリアスは無視される。

0
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?