Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

in what file can i find the variable "aliasesé

Status
Not open for further replies.

haneo

Programmer
Jan 2, 2002
274
CA
In RedHat i can find alias in the user directory and change the color of ls output for exemple.

But in the slackware i can't find any file having this variable !!!

Can some one help me, because i am very newbie with the slack distro !
 
Are you refering to shell aliases? For example, lines like:
alias 'dir'='ls -l'
Slackware does not provide an alias file - you have to write your own. Fortunately, this is not difficult.
The alias command is a shell command like any other, and can be run from the command line, from ~/.bash_profile, ~/.bashrc, or any other script you want to run. Here's how I set up my aliases, in case it helps.
1) Using your favorite text editor, create a ~/.bash_alias file. Put your aliases here. For example:
alias 'xterm'='xterm -ls'
alias 'vi'='gvim'
alias 'ls'='ls -la'
2) In your ~/.bash_profile, add the following
Code:
if [ -e $HOME/.bash_alias ]
then
   source $HOME/.bash_alias
fi
Next time you log in, the aliases in ~/.bash_alias will be in effect. If you want them to take effect immediately, just type
source ~/.bash_alias
and you're all set. Hope that helps!
 
Thanks AdaHacker for your help.
In my slackware i have no ~/.bash_profile, ~/.bashrc ~/.bash_alias

I have create the ~/.bash_profile and ~/.bash_alias

With no success :-(
 
The system wide configuration file for directory colors is /etc/DIR_COLORS. You can change them there
 
man bash:
--rcfile file
Execute commands from file instead of the standard personal initialization file ~/.bashrc if the shell is interactive (see INVOCATION below).
 
man dircolors:
DESCRIPTION
dircolors is a program to generate a setup for the color version of GNU ls. The setup consists of an LS_COLORS environment variable and a set of aliases. For sh and ash, which lack aliases, shell functions are substituted. The dircolors command will generally be run from the user's .profile, .cshrc or equivalent file, or the system-wide equivalents.
 
CONFIGURATION FILE
If a filename is specified on the command line, it will be used to generate the setup, if not, the file .dir_colors in the users home directory will be used. If that file does not exist either, the system-wide file of /etc/DIR_COLORS will be used.
 
haneo,
Slackware keeps the default bash login script in /etc/profile. Just copy /etc/profile to ~/.bash_profile and edit that file. Note that if you find it easier, you can also add your aliases directly to your ~/.bash_profile. It's a little messier, but it works just as well.
As Sky1953 noted, aliases for ls colors are setup by the dircolors command. In addition to the system defaults in /etc, you can also use the ~/.dir_colors (I think) to configure this. Not that it's the config file, not the actual alias, that determines what colors are used. Check the man page for more detailed information.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top