Linux Commands for Beginners--Create Your Own Commands Via alias

 In this part, I will show you how to create your own commands via alias




1.COMMAND:
    alias
  DESCRIPTION:
    The alias command can be useful if you want to create a 'shortcut' to a command.
  SYNOPSIS:
    alias name='command'


 TIPS:
    To see a list of aliases set up on your linux, just type alias at the prompt.


Example:
piniheaven@fish:~/Documents$alias    #list aliases set up on your system
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alF'

alias ls='ls --color=auto'


piniheaven@fish:~/Documents$ aliasMyLs='ls -l'    #create an alias of 'ls -l'
piniheaven@fish:~/Documents$ ls
assemble  C++primer_ex  C++primer_note  Ebook  linux  MyScript  QT_ex  QT_note  tutorial
piniheaven@fish:~/Documents$ MyLs
total 36
drwxrwxr-x  4 piniheaven piniheaven 4096 Aug 22 12:16 assemble
drwxrwxr-x  2 piniheaven piniheaven 4096 Jul 19 14:12 C++primer_ex

......

......

drwxrwxr-x  2 piniheaven piniheaven 4096 Jul 19 00:21 QT_note
dr-xr-xr-x  2 jack       piniheaven 4096 Aug 25 21:42 tutorial



2.COMMAND:

    unalias
  DESCRIPTION:
    unalias command is used to remove an alias (see alias).
  SYNOPSIS:
    unalias commandName


Example:
piniheaven@fish:~/Documents$ unalias MyLs     #unalias Myls command
piniheaven@fish:~/Documents$ MyLs
MyLs: command not found




 











评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值