from small one page howto to huge articles all in one place
 

search text in:





Poll
Which filesystem do you use?






poll results

Last additions:
using iotop to find disk usage hogs

using iotop to find disk usage hogs

words:

887

views:

187378

userrating:

average rating: 1.7 (102 votes) (1=very good 6=terrible)


May 25th. 2007:
Words

486

Views

250586

why adblockers are bad


Workaround and fixes for the current Core Dump Handling vulnerability affected kernels

Workaround and fixes for the current Core Dump Handling vulnerability affected kernels

words:

161

views:

138046

userrating:

average rating: 1.4 (42 votes) (1=very good 6=terrible)


April, 26th. 2006:

Druckversion . pdf icon
You are here: System->Tips and Tricks

Alias, Setting command aliases

The alias command allows you to make new shortcuts and synonyms for commonly used comands. The basic usage is:

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='ll'  
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/; }

Another way for aliases with variables

If you dont like to use a function, if you need variables, try the following to change to the last working directory:

alias cdo="cd \"\$OLDPWD\""

Note: it is important, that there are ONLY double quotes in the expression above, no single quotes like in the other examples!

Creating aliases on shell startup

You can have your aliases created anytime you open an instance of a shell. If you are using bash, edit your ~/.bashrc file and add one alias per line. Once you save and close the file, run this to load your new aliases immediately:

source ~/.bashrc

Otherwise, the new aliases will load whenever you open a new instance of the shell.

Another place to put your aliases if you want them to be system-wide for all users is in /etc/bashrc. To load those aliases, add this line to ~/.bashrc

source /etc/bashrc

From gentoo-wiki.com


rate this article:
current rating: average rating: 1.2 (1369 votes) (1=very good 6=terrible)
Your rating:
Very good (1) Good (2) ok (3) average (4) bad (5) terrible (6)

back





Support us on Content Nation
rdf newsfeed | rss newsfeed | Atom newsfeed
- Powered by LeopardCMS - Running on Gentoo -
Copyright 2004-2020 Sascha Nitsch Unternehmensberatung GmbH
Valid XHTML1.1 : Valid CSS : buttonmaker
- Level Triple-A Conformance to Web Content Accessibility Guidelines 1.0 -
- Copyright and legal notices -
Time to create this page: 64.2 ms