Aliases

From blag.wiki.aktivix.org

Jump to: navigation, search

If you use the bash shell frequently the alias feature can be used as a "shortcut" for common commands that you use alot. So instead of typing out a whole list of commands, you just hit the alias.

For example root has to update the packages alot

apt-get update && apt-get dist-update

Simply add a line with this syntax in your file ~/.bashrc with your editor of choice.

alias your-alias='some command(s)'

Note that there is no space between the quote marks.

Here are a few examples....

Root can use this alias to update the system

alias japt='apt-get update && apt-get dist-update && apt-get clean'

From now now on he just types 'japt' and all of the above are run.

These should be in your ~/.bashrc already.

alias l.='ls -d .* --color=tty'
alias ll='ls -l --color=tty'
alias ls='ls --color=tty'

Use these to get a confirmation when you move or remove a file. The shell will ask you for confirmation.

alias mv='mv -iv'
alias rm='rm -iv'

These are ones that I use. I tend to use these comands alot

alias elx='elinks'
alias fx='firefox'
alias fxg='firefox http://google.com'
alias fxgl='firefox http://google.com/linux'
alias fxj='firefox http://jayeola.org'
alias lx='lynx -accept_all_cookies'
alias lxbf='lynx -accept_all_cookies http://forums.blagblagblag.org'
alias lxg='lynx -accept_all_cookies http://google.com'
alias lxgl='lynx -accept_all_cookies http://google.com/linux'
alias lxj='lynx -accept_all_cookies http://jayeola.org'

This one is particularly handy - get a list of commmands related to some term

alias wtf='man -k'

usage

wtf hardware

the shell gives you.....

hwclock              (8)  - query and set the hardware clock (RTC)
irqbalance           (1)  - distribute hardware interrupts across processors on a multiprocessor system
kudzu                (8)  - detects and configures new and/or changed hardware on a system
lshw                 (1)  - list hardware
rngd                 (8)  - Check and feed random data from hardware device to kernel random device


You don't need to reboot for these changes to take effect. Make sure that you save ~/.bashrc and then run

source ~/.bashrc in any open terminals
Personal tools