LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices



Reply
 
Search this Thread
Old 01-04-2005, 01:57 PM   #1
ilnli
Member
 
Registered: Jul 2004
Location: Pakistan
Distribution: Slackware 10.0, SUSE 9.1, RH 7, 7.3, 8, 9, FC2
Posts: 413

Rep: Reputation: 32
alias


In which file the aliases are defined for the shell?
cause where I run
alias
i can see that there are many alias by default defined but in which file they are defined I don't know that.
can any body tell me that in which file these aliases are defined in slackware 10.0 cause I have to remove an alias from that file.
 
Old 01-04-2005, 02:37 PM   #2
busbarn
Member
 
Registered: Feb 2002
Location: Denver, CO US
Distribution: Arch
Posts: 453

Rep: Reputation: 30
in your .bashrc

(home/usrname/.bashrc)
 
Old 01-04-2005, 02:38 PM   #3
hussar
Member
 
Registered: Oct 2003
Location: Heidelberg, Germany
Distribution: Slackware 11.0; Kubuntu 6.06; OpenBSD 4.0; OS X 10.4.10
Posts: 345

Rep: Reputation: 30
Do you mean aliases for email addresses that are used as short cuts for addressing emails? Or, do you mean aliases that are shorthand versions of longer commands?

The first type are often stored in an .alias or .aliases file in your home directory (could also be without the leading dot - alias or aliases). It depends somewhat on what you are using as an email client and how the client is configured.

Assuming you are using the bash shell, aliases that are command shortcuts are often found in the .bashrc, .bash_profile or .profile files in your home directory. Look for something like "alias name=command".
 
Old 01-04-2005, 02:43 PM   #4
ilnli
Member
 
Registered: Jul 2004
Location: Pakistan
Distribution: Slackware 10.0, SUSE 9.1, RH 7, 7.3, 8, 9, FC2
Posts: 413

Original Poster
Rep: Reputation: 32
no i don't mean alias for email address I mean alias for the bash shell.

"busbarn" i don't have any (home/usrname/.bashrc)
directory i am on slackware 10.0
 
Old 01-04-2005, 02:45 PM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
"usrname" isn't literal. he means you need to put the username in place of "usrname". also the file is hidden. it is more than likely there already.
 
Old 01-04-2005, 02:56 PM   #6
hussar
Member
 
Registered: Oct 2003
Location: Heidelberg, Germany
Distribution: Slackware 11.0; Kubuntu 6.06; OpenBSD 4.0; OS X 10.4.10
Posts: 345

Rep: Reputation: 30
ilnli, in your home directory, do a `ls -a` and you will see one of .bashrc, .bash_profile or .profile. If you don't have any of these, then the alias you are looking for may be in /etc/profile. To change that file, you will probably have to be root.
 
Old 01-06-2005, 01:54 PM   #7
ilnli
Member
 
Registered: Jul 2004
Location: Pakistan
Distribution: Slackware 10.0, SUSE 9.1, RH 7, 7.3, 8, 9, FC2
Posts: 413

Original Poster
Rep: Reputation: 32
[CODE]

root@DARKSTAR:/etc# alias
alias d='dir'
alias dir='/usr/bin/ls $LS_OPTIONS --format=vertical'
alias ls='/usr/bin/ls $LS_OPTIONS'
alias mc='. /usr/share/mc/bin/mc-wrapper.sh'
alias v='vdir'
alias vdir='/usr/bin/ls $LS_OPTIONS --format=long'
root@DARKSTAR:/etc#
root@DARKSTAR:~# ls -a
./ .gstreamer-0.8/ .xine/ ls
../ .gtkrc-1.2-gnome2 .xinitrc ls.log
.DCOPserver_DARKSTAR_:0@ .kde/ .xinitrc-backup minicom.log
.DCOPserver_DARKSTAR__0 .kderc .xmms/ mouse.html
.ICEauthority .links/ CORE_IMPACT_3.3.rar network.html
.Xauthority .local/ Desktop/ out
.bash_history .mcop/ SuSE.Linux.9.1.professional.CD1of5.by.Kiffer.iso out.log
.config/ .mcoprc a.out* packages.html
.fonts.cache-1 .mozilla/ booting.html pakaims.edu
.fonts.conf .netwatch.1.0a drivers/ ppp.html
.fullcircle/ .qt/ gaim-1.1.1.tar.gz.part raptor_chown.c*
.gaim/ .recently-used hsfmodem-7.18.00full/ rootdir.html
.gconf/ .sane/ hsfmodem-7.18.00full-1.i386.rpm.zip slack\ startup.html
.gconfd/ .ssh/ hsfmodem-7.18.00full.tar.gz* stats/
.gkrellm2/ .thumbnails/ hsfmodem-doc-7.18.00full-1.noarch.rpm.zip telnet
.gnome/ .toprc init.html users.html
.gnome2/ .viminfo loadlin16c.txt x.html
.gnome2_private/ .vimrc loadlin16c.zip
root@DARKSTAR:~#

root@DARKSTAR:/etc# ls -a
./ genpowerd.conf isapnp.gone.sample my-medium.cnf scrollkeeper.conf
../ gimp/ issue my-small.cnf securetty
.pwd.lock gnome-vfs-2.0/ issue.net nail.rc security/
DIR_COLORS gnome-vfs-mime-magic joe/ named.
 
Old 01-06-2005, 01:54 PM   #8
ilnli
Member
 
Registered: Jul 2004
Location: Pakistan
Distribution: Slackware 10.0, SUSE 9.1, RH 7, 7.3, 8, 9, FC2
Posts: 413

Original Poster
Rep: Reputation: 32
Code:
root@DARKSTAR:/etc# alias
alias d='dir'
alias dir='/usr/bin/ls $LS_OPTIONS --format=vertical'
alias ls='/usr/bin/ls $LS_OPTIONS'
alias mc='. /usr/share/mc/bin/mc-wrapper.sh'
alias v='vdir'
alias vdir='/usr/bin/ls $LS_OPTIONS --format=long'
root@DARKSTAR:/etc#
root@DARKSTAR:~# ls -a
./                        .gstreamer-0.8/    .xine/                                            ls
../                       .gtkrc-1.2-gnome2  .xinitrc                                          ls.log
.DCOPserver_DARKSTAR_:0@  .kde/              .xinitrc-backup                                   minicom.log
.DCOPserver_DARKSTAR__0   .kderc             .xmms/                                            mouse.html
.ICEauthority             .links/            CORE_IMPACT_3.3.rar                               network.html
.Xauthority               .local/            Desktop/                                          out
.bash_history             .mcop/             SuSE.Linux.9.1.professional.CD1of5.by.Kiffer.iso  out.log
.config/                  .mcoprc            a.out*                                            packages.html
.fonts.cache-1            .mozilla/          booting.html                                      pakaims.edu
.fonts.conf               .netwatch.1.0a     drivers/                                          ppp.html
.fullcircle/              .qt/               gaim-1.1.1.tar.gz.part                            raptor_chown.c*
.gaim/                    .recently-used     hsfmodem-7.18.00full/                             rootdir.html
.gconf/                   .sane/             hsfmodem-7.18.00full-1.i386.rpm.zip               slack\ startup.html
.gconfd/                  .ssh/              hsfmodem-7.18.00full.tar.gz*                      stats/
.gkrellm2/                .thumbnails/       hsfmodem-doc-7.18.00full-1.noarch.rpm.zip         telnet
.gnome/                   .toprc             init.html                                         users.html
.gnome2/                  .viminfo           loadlin16c.txt                                    x.html
.gnome2_private/          .vimrc             loadlin16c.zip
root@DARKSTAR:~#

root@DARKSTAR:/etc# ls -a
./                  genpowerd.conf        isapnp.gone.sample      my-medium.cnf          scrollkeeper.conf
../                 gimp/                 issue                   my-small.cnf           securetty
.pwd.lock           gnome-vfs-2.0/        issue.net               nail.rc                security/
DIR_COLORS          gnome-vfs-mime-magic  joe/                    named.conf             serial.conf
HOSTNAME            gnopernicus-1.0/      ld.so.cache             networks               services
X11/                gpm-root.conf         ld.so.conf              nntpserver             sgml/
a2ps-site.cfg       gpm-syn.conf          lftp.conf               nscd.conf              shadow
a2ps.cfg            gpm-twiddler.conf     lilo.conf               nsswitch.conf          shadow-
acpi/               group                 localtime               ntp/                   shells
adjtime             gshadow               localtime-copied-from@  ntp.conf               skel/
apache/             gtk/                  login.access            pango/                 slackware-version
asound.state        gtk-2.0/              login.defs              passwd                 smartd.conf
bonobo-activation/  hardwareclock         logrotate.conf          passwd-                sound/
cron.daily/         host.conf             logrotate.d/            pcmcia/                ssh/
cron.hourly/        hosts                 lpd.conf                pear.conf              ssl/
cron.monthly/       hosts.allow           lpd.perms               pine.conf              stunnel/
cron.weekly/        hosts.deny            magic@                  ppp/                   syslog.conf
csh.login           hosts.equiv           magic.mime@             printcap               termcap
cups/               hotplug/              mail/                   printcap-lprng-sample  termcap-BSD
dev.d/              hotplug.d/            mdadm.conf              profile                termcap-Linux
dhclient.conf       hsfmodem/             mediaprm                profile.d/             timezone
dhcpc/              identd.conf           minicom.users           proftpd.conf           udev/
dhcpd.conf          im_palette-small.pal  minirc.dfl              protocols              updatedb.conf
dialogrc            im_palette-tiny.pal   modprobe.conf           radiusclient/          vga/
dnsmasq.conf        im_palette.pal        modules.conf            random-seed            warnquota.conf-sample
esd.conf            imrc                  modules.conf.old        rc.d/                  wgetrc
fb.modes            inetd.conf            modules.conf~           resolv.conf            xml/
fdprm               inittab               motd                    rmt@                   ytalkrc
file/               inputrc               mtab                    rndc.key               zprofile@
fonts/              ioctl.save            mtools.conf             rpc
fstab               iproute2/             mutt/                   samba/
ftpusers            irssi.conf            my-huge.cnf             sane.d/
gconf/              isapnp.conf.sample    my-large.cnf            screenrc
root@DARKSTAR:/etc#
root@DARKSTAR:/etc# cat profile
# /etc/profile: This file contains system-wide defaults used by
# all Bourne (and related) shells.

# Set the values for some environment variables:
export MINICOM="-c on"
export MANPATH=/usr/local/man:/usr/man:/usr/X11R6/man
export HOSTNAME="`cat /etc/HOSTNAME`"
export LESSOPEN="|lesspipe.sh %s"
export LESS="-M"

# If the user doesn't have a .inputrc, use the one in /etc.
if [ ! -r "$HOME/.inputrc" ]; then
  export INPUTRC=/etc/inputrc
fi

# Set the default system $PATH:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games"

# For root users, ensure that /usr/local/sbin, /usr/sbin, and /sbin are in
# the $PATH.  Some means of connection don't add these by default (sshd comes
# to mind).
if [ "`id -u`" = "0" ]; then
  echo $PATH | grep /usr/local/sbin 1> /dev/null 2> /dev/null
  if [ ! $? = 0 ]; then
    PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH
  fi
fi

# I had problems using 'eval tset' instead of 'TERM=', but you might want to
# try it anyway. I think with the right /etc/termcap it would work great.
# eval `tset -sQ "$TERM"`
if [ "$TERM" = "" -o "$TERM" = "unknown" ]; then
 TERM=linux
fi

# Set ksh93 visual editing mode:
if [ "$SHELL" = "/bin/ksh" ]; then
  VISUAL=emacs
#  VISUAL=gmacs
#  VISUAL=vi
fi

# Set a default shell prompt:
#PS1='`hostname`:`pwd`# '
if [ "$SHELL" = "/bin/pdksh" ]; then
 PS1='! $ '
elif [ "$SHELL" = "/bin/ksh" ]; then
 PS1='! ${PWD/#$HOME/~}$ '
elif [ "$SHELL" = "/bin/zsh" ]; then
 PS1='%n@%m:%~%# '
elif [ "$SHELL" = "/bin/ash" ]; then
 PS1='$ '
else
 PS1='\u@\h:\w\$ '
fi
PS2='> '
export PATH DISPLAY LESS TERM PS1 PS2

# Default umask.  A umask of 022 prevents new files from being created group
# and world writable.
umask 022

# Set up the LS_COLORS and LS_OPTIONS environment variables for color ls:
if [ "$SHELL" = "/bin/zsh" ]; then
 eval `dircolors -z`
elif [ "$SHELL" = "/bin/ash" ]; then
 eval `dircolors -s`
else
 eval `dircolors -b`
fi

# Notify user of incoming mail.  This can be overridden in the user's
# local startup file (~/.bash.login or whatever, depending on the shell)
if [ -x /usr/bin/biff ]; then
 biff y
fi

# Append any additional sh scripts found in /etc/profile.d/:
for profile_script in /etc/profile.d/*.sh ; do
  if [ -x $profile_script ]; then
    . $profile_script
  fi
done
unset profile_script

# For non-root users, add the current directory to the search path:
if [ ! "`id -u`" = "0" ]; then
 PATH="$PATH:."
fi

root@DARKSTAR:/etc#
look there is no place where alias are defined but why do I have those aliases?
 
Old 01-07-2005, 12:57 AM   #9
ilnli
Member
 
Registered: Jul 2004
Location: Pakistan
Distribution: Slackware 10.0, SUSE 9.1, RH 7, 7.3, 8, 9, FC2
Posts: 413

Original Poster
Rep: Reputation: 32
any other?
 
Old 01-07-2005, 09:58 AM   #10
hussar
Member
 
Registered: Oct 2003
Location: Heidelberg, Germany
Distribution: Slackware 11.0; Kubuntu 6.06; OpenBSD 4.0; OS X 10.4.10
Posts: 345

Rep: Reputation: 30
You can try the bash built-in "unalias."

Quoting from the bash manpages published online at this URL http://www.die.net/doc/linux/man/man1/bash.1.html:

alias [-p] [name[=value] ...]
Alias with no arguments or with the -p option prints the list of aliases in the form alias name=value on standard output. When arguments are supplied, an alias is defined for each name whose value is given. A trailing space in value causes the next word to be checked for alias substitution when the alias is expanded. For each name in the argument list for which no value is supplied, the name and value of the alias is printed. Alias returns true unless a name is given for which no alias has been defined.

unalias [-a] [name ...]
Remove each name from the list of defined aliases. If -a is supplied, all alias definitions are removed. The return value is true unless a supplied name is not a defined alias.
 
Old 01-07-2005, 10:10 AM   #11
hussar
Member
 
Registered: Oct 2003
Location: Heidelberg, Germany
Distribution: Slackware 11.0; Kubuntu 6.06; OpenBSD 4.0; OS X 10.4.10
Posts: 345

Rep: Reputation: 30
One other question. Is the alias only active when you are root, or is it also active when you are logged in under your normal non-root account?
 
Old 01-07-2005, 12:41 PM   #12
Gronau
LQ Newbie
 
Registered: Dec 2004
Location: Gronau
Distribution: Slackware, gentoo, crux
Posts: 1

Rep: Reputation: 0
aliase are only active if the user source a file with aliases (~/.bashrc, ~/.zshrc, /etc/profile...). If your user-account has such file you can use aliases as well.
 
Old 01-08-2005, 09:27 AM   #13
AdaHacker
Member
 
Registered: Oct 2001
Location: Brockport, NY
Distribution: Kubuntu
Posts: 384

Rep: Reputation: 31
ilnli, the various 'ls' aliases you're seeing are set by the
Code:
eval `dircolors -b`
command run in /etc/profile. This command sets all the environment variables for coloring ls output in addition to setting afew aliases. The mc alias is set by by the /etc/profile.d/mc.sh script which is run by the
Code:
for profile_script in /etc/profile.d/*.sh ; do
  if [ -x $profile_script ]; then
    . $profile_script
  fi
done
section in /etc/profile. This one can be turned off by making /etc/profile.d/mc.sh non-executable.
 
Old 01-08-2005, 11:29 PM   #14
vonst
Member
 
Registered: May 2004
Location: Wash DC Metro Area
Distribution: Slackware 11
Posts: 108

Rep: Reputation: 15
Wow, I remember those aliases from a long time ago. I think I kept one of them... BUT, I forget where I erased them from. I inserted a "source ~/.alias" line into my /etc/profile line and it loads the whole profile list *I* built.

SOP loads your system from both the /etc/ directory and your /home/xxx directory. I suggest doing a "grep vdir *" and "grep vdir .*" in both directories. "vdir" is pretty unique and should pop up a file name that is keeping it.

--vonSt
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Alias question (2 commands for one alias) gflores Linux - Newbie 3 01-21-2006 01:40 AM
ip alias mindcry Linux - Networking 0 10-16-2003 08:41 PM
using alias intruptz Linux - General 5 09-17-2003 05:32 AM
alias booyah Slackware 3 05-06-2003 04:17 PM
alias nobu Slackware 5 01-11-2003 02:09 PM


All times are GMT -5. The time now is 11:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration