Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
 
Reply to this topicStart new topic
> Alias Command, Saving Alias Command Variables
veris2040
post Jan 7 2004, 04:37 AM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 8
Joined: 7-January 04
Member No.: 2,094



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
Go to the top of the page
 
+Quote Post
Nutx
post Jan 9 2004, 10:30 AM
Post #2


Whats this Lie-nix Thing?
*

Group: Members
Posts: 2
Joined: 9-January 04
Member No.: 2,107



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
Go to the top of the page
 
+Quote Post
veris2040
post Jan 9 2004, 09:18 PM
Post #3


Whats this Lie-nix Thing?
*

Group: Members
Posts: 8
Joined: 7-January 04
Member No.: 2,094



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.
Go to the top of the page
 
+Quote Post
hughesjr
post Jan 10 2004, 02:35 PM
Post #4


Its GNU/Linuxhelp.net
*******

Group: Admin
Posts: 3,433
Joined: 25-July 03
From: Corpus Chrsiti, TX, USA
Member No.: 1,151



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'


--------------------
Johnny Hughes
hughesjr@linuxhelp.net
Enterprise Alternatives: CentOS, WhiteBoxEL
Favorite Workstation Distros (in order): CentOS, Gentoo, Debian Sarge, Ubuntu, Mandrake, FedoraCore, Slackware, SUSE
Favorite Server Distros (in order): CentOS, WhiteBoxEL, Debian Sarge, Slackware, Mandrake, FedoraCore, Gentoo, SUSE
Go to the top of the page
 
+Quote Post
veris2040
post Jan 10 2004, 05:36 PM
Post #5


Whats this Lie-nix Thing?
*

Group: Members
Posts: 8
Joined: 7-January 04
Member No.: 2,094



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.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 17th October 2017 - 07:28 PM