Help - Search - Members - Calendar
Full Version: Alias Command
Linuxhelp > Support > Technical Support
veris2040
Hi I've been using the Alias command to shorten some of my favorite commands (from windows) and shortening some directories that I want to have faster access to.

For instance:

alias cls clear
alias docs cd /home/user/Documents

I'm using Mandrake 9.2 with tsch as my login shell. Unfortunately these settings aren't permanent and I would like to know how to have them apart of how I use Linux for a day to day basis. I'm about two months into using Linux since I decided to Dual-boot it with Windows Xp and hope that I can start using it as reguarly as windows.

Any responce on this subject will be appreciated
-Veris
Nutx
Hi, Veris!

I'm running RedHat 9.1, but I think Mandrake is not that different. Try this:

You must edit file .bash/profile
Any instructions written there will be always executed when you log in as root.

Although, if you want to create aliases for commands as a user, you must edit home/user/.bashrc (where "user" is your username)

In both cases, changes will be permanent.

( I suggest you to create a copy of your .bashrc before doing any changes: this will afford the system any problem because of the editing. Just rename old copy as .bashrc is something goes wrong)

Here is my customized bash as user "Nutx":
................................................................................
....................................
# .bashrc

# Mis alias y funciones (my aliases and functions)

# Alias de lista (listing alias)
alias l="ls -la"

# Cambio del prompt ( changing the prompt message)

PS1="Dime, Nutx: "

# Alias de exit (changing commando for exit)

alias chof="exit"

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
................................................................................
......

I hope this will be useful
veris2040
Thanx for the reply and your help. I was unsuccessful with getting the commands to work by editing the .bashrc file mainly because I use tsch instead of bash for my login shell.
hughesjr
the file you want to edit is:

.cshrc

or

.tcshrc

either should work...the commands will be in this format:

alias rm 'rm -i'
alias cp 'cp -i'
alias mv 'mv -i'
veris2040
So it works now, thanx. So now's the part where I make a how-to for people with the same problem.

The following Instructions are for storing user created commands to replace or simplify long directory's and for people who are use to windows command prompt commands. These directions are only for people using Mandrake 9.2



for bash users

1) open the file .bashrc into your favorite text editor
2) under the heading "# User alias" enter the command aliases that you want to use in your konsole

Aliases should be created as followed: alias user given alias="command or directory in quotes"

3) save the file
4) completely logout of your account the commands should be active now.


for tsch or csh users

1) "cd" into the directory "/etc" cd /etc
2) Login into root
3) open the file csh.cshrc into your favorite text editor
4) under any of the "#" headings enter the command aliases that you want to use in your konsole
Aliases should be created as followed: alias user given alias 'command or directory in single quotes'
5) save the file
6) completely logout of your account the commands should be active now.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.