Странице

Ознаке

петак, 22. март 2013.

Alias in Linux

Basic usage:
alias newcommand='yourcommand -arguments'
If you want to start aterm according to your preferences with the command term, do something like:
alias term='aterm -ls -fg gray -bg black'
If you want a quick alias like ll for a more informative file listing:
ls -al --color=yes
Starting alias without any options lists the current aliases:
alias
alias ls='ls -la'
alias ls -al --color=yes
alias term='aterm -ls -fg gray -bg black'
Use unalias to remove an alias.
unalias term
You can also make aliases for existing commands. If you want ls to show colors by default, do:
alias ls='ls --color=yes'
These aliases can be put in your login script (.bash_profile or .profile depending on what shell you are using).

Alias with variables
You can not make aliases with variables. But you can make functions, having a function in your .profile/.bashrc will work just like an alias. To use ssh to copy files to a location on a server you can use
sendpic () { scp $* mina@foo.bar.ca:/www/misc/Pictures/; }

Нема коментара:

Постави коментар

Напомена: Само члан овог блога може да постави коментар.