Creating an Alias

Creating an Alias

Post by Todd Pasters » Sat, 19 Apr 2003 22:44:35



I am VERY new to UNIX so please help me with what is probably very
simple.

I want to create an alias for a command but when I do it only persists
during my current session.  How can I goe the alias to save so I can
use it later?

Thanks MUCH.

 
 
 

Creating an Alias

Post by Alexis Huxle » Sat, 19 Apr 2003 23:17:08


Quote:> I want to create an alias for a command but when I do it only persists
> during my current session.  How can I goe the alias to save so I can
> use it later?

What's your shell? If you're not sure, run: 'finger $LOGNAME' and that
should contain a bit that says 'Shell: <somethingorother>'.

Alexis
http://dione.no-ip.org/~alexis/

 
 
 

Creating an Alias

Post by Kevin Rodger » Sun, 20 Apr 2003 01:01:26



> I want to create an alias for a command but when I do it only persists
> during my current session.  How can I goe the alias to save so I can
> use it later?

Define it in a file that the shell reads when it starts up.  Read the man page

for your shell to find out what file(s) it uses.

--

 
 
 

Creating an Alias

Post by Todd Pasters » Sun, 20 Apr 2003 02:05:00


My shell is bin/ksh

> > I want to create an alias for a command but when I do it only persists
> > during my current session.  How can I goe the alias to save so I can
> > use it later?

> What's your shell? If you're not sure, run: 'finger $LOGNAME' and that
> should contain a bit that says 'Shell: <somethingorother>'.

> Alexis
> http://dione.no-ip.org/~alexis/

 
 
 

Creating an Alias

Post by Alexis Huxle » Sun, 20 Apr 2003 04:23:54


Quote:>> > during my current session.  How can I goe the alias to save so I can
>> > use it later?

>> What's your shell? If you're not sure, run: 'finger $LOGNAME' and that

> My shell is bin/ksh

Then you should put then in the .profile file in your home directory.
Here is an alias to make 'll' actually run 'ls -l':

        alias ll='ls -l'

If you are running xterm's or some other sort of terminal and the
alias does not appear to work, then make sure that the xterm is
run's the shell as a login shell. For an xterm this means running
'xterm -ls' instead of just 'xterm'.

Supposedly using the '-x' option to the alias builtin command will
make the alias available to subshells, which would obviate the need
for running xterm with '-ls', but it doesn't work with pdksh, which
is all I have access to.  If that doesn't make any sense then you
don't need to know it :-)

More info can be found in the 'Aliases' section of the ksh man page.

Alexis
http://dione.no-ip.org/~alexis/

 
 
 

Creating an Alias

Post by Barry Kimelma » Sun, 20 Apr 2003 23:04:47


[This followup was posted to comp.unix.shell]



Quote:> I am VERY new to UNIX so please help me with what is probably very
> simple.

> I want to create an alias for a command but when I do it only persists
> during my current session.  How can I goe the alias to save so I can
> use it later?

> Thanks MUCH.

Under ksh you can put the definition for an alias in your ".profile" file
(which resides in your home directory). You might even want to consider
putting all your alias definitions in a file named ".alias" in your home
directory and then have that file "processed" by your ".profile" file
every time you login. The line to insert into your ".profile" file to
process your ".alias" file is as follows :

. $HOME/.alias

--
---------

Barry Kimelman
Winnipeg, Manitoba, Canada

 
 
 

1. Problem with creating an alias

Hi all,
I'm trying to create an alias for a command which prints the size of
the current dir (and subdirectory).

This one works:
ls -laR . | awk '{total += $5}; END { print total}'

but wrapped into alias it doesn't work:
alias sizedir="ls -laR . | awk '{total += $5}; END { print total}'"

bash-2.05$ sizedir
awk: syntax error near line 1
awk: illegal statement near line 1
awk: illegal statement near line 1

Does anybody knows how to insert a command like this into alias?
Thanks a lot
Francesco

2. adding slice

3. Creating an alias

4. synch card for x86 2.4?

5. create an alias to list directory name

6. Dtterm and dtpad scrolling peoblems (solaris7-sparc)?

7. How to create an alias with sendmail?

8. argv[0] in login shell

9. Creating an Alias for an exisiting user

10. Need To Create E-Mail Aliases

11. Creating Host Aliases In DNS Config Files

12. How do you create multiple aliases???

13. how to create an alias