linux下alias命令詳解:定義命令行的別名

功能說明:設置指令的別名。
bash

語  法:alias[別名]=[指令名稱]變量

參  數 :若不加任何參數,則列出目前全部的別名設置。配置

舉    例 :ermao@lost-desktop:~$ aliasfile

                 alias egrep='egrep --color=auto'grep

                 alias fgrep='fgrep --color=auto'配置文件

                  alias grep='grep --color=auto'top

                 alias l='ls -CF'環境變量

                 alias la='ls -A'文件

                 alias ll='ls -alF'co

                 alias ls='ls --color=auto'

說     明:用戶可利用alias,自定指令的別名。若僅輸入alias,則可列出目前全部的別名設置。 

alias的效力僅及於該次登入的操做。若是想永久生效,就把這條寫入到 /etc/bashrc裏面

若要每次登入是即自動設好別名,可在/etc/profile或本身的~/.bashrc中設定指令的別名。

若是想給每一位用戶都生效的別名,請把alias la='ls -al' 一行加在/etc/bashrc最後面,bashrc是環境變量的配置文件 /etc/bashrc,和~/.bashrc 區別就在於一個是設置給全系統一個是設置給單用戶使用.
相關文章
相關標籤/搜索