alias  コマンドの別名を登録する

 構文  
$ alias 別名='本来のコマンド'


≪aliasコマンド 説明   ≫

コマンドなどを

別名として登録する。



なお、aliasコマンドのオプションを省略し

alias コマンドを実行した場合は

現在登録してある別名をすべて表示します。

[takuan@localhost ~]$ alias
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias vi='vim'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'


もしくわ  オプション-pでもリストが表示されます。


[takuan@localhost ~]$ alias -p
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias vi='vim'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'



また,nameのみ指定した場合は,指定した別名についての登録状況を表示する。

[takuan@localhost ~]$ alias l.
alias l.='ls -d .* --color=auto'




       alias [-p] [name[=value] ...]
              Alias  with  no  arguments or with the -p option prints the list of
              aliases in the form alias  name=value  on  standard  output.   When
              arguments  are  supplied,  an  alias is defined for each name whose
              value is given.  A trailing space in  value causes the next word to
              be  checked for alias substitution when the alias is expanded.  For
              each name in the argument list for which no value is supplied,  the
              name  and value of the alias is printed.  Alias returns true unless
              a name is given for which no alias has been defined.


 使用例  

[takuan@localhost ~]$ alias la='ls -la'
[takuan@localhost ~]$ la
合計 28
drwx------ 4 takuan takuan 4096 2009-08-23 07:17 .
drwxr-xr-x 6 root   root   4096 2009-08-23 07:17 ..
-rw-r--r-- 1 takuan takuan   18 2008-02-29 23:27 .bash_logout
-rw-r--r-- 1 takuan takuan  176 2008-02-29 23:27 .bash_profile
-rw-r--r-- 1 takuan takuan  124 2008-02-29 23:27 .bashrc
drwxr-xr-x 2 takuan takuan 4096 2008-04-07 05:43 .gnome2
drwxr-xr-x 4 takuan takuan 4096 2009-08-20 22:18 .mozilla
[takuan@localhost ~]$ alias la
alias la='ls -la'


サーバ運用(ランキング)


blogram投票ボタン




サーバ構築(ランキング)を見る。



トラックバック(0)

このブログ記事を参照しているブログ一覧: リナックス コマンド alias  コマンドの別名を登録する

このブログ記事に対するトラックバックURL: http://websky21.com/MT/mt-tb.cgi/826