- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How to add alias in .profile
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2006 09:46 PM
04-19-2006 09:46 PM
How to add alias in .profile
I want to create a alias and put it in .profile. When I alias at command prompt , it works fine , but could not work with .profiel.
Pl. guide me how can i put alias in .profile to taht i can use it.
Thx
sanjeev
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2006 10:00 PM
04-19-2006 10:00 PM
Re: How to add alias in .profile
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2006 10:01 PM
04-19-2006 10:01 PM
Re: How to add alias in .profile
First you need to include the following line in your .profile file.
ENV=$HOME/.kshrc
export ENV
After doing so, edit a file ".kshrc" in your home directory and include your alias lines in the file .kshrc as follows..
alias ll='ls -l'
alias lla='ls -la'
alias ltr='ls -ltr'
alias llh='ls -l . | egrep htm\|html'
After, you do so, log out your current session, and relogin.
Regards,
Senthil Kumar .A
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2006 10:10 PM
04-19-2006 10:10 PM
Re: How to add alias in .profile
It dosen't work.Pl. someone provide solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2006 10:19 PM
04-19-2006 10:19 PM
Re: How to add alias in .profile
alias ll="ls -l"
alias lla="ls -la"
alias ltr="ls -ltr"
but use dubble quote.
grtz. Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2006 10:24 PM
04-19-2006 10:24 PM
Re: How to add alias in .profile
Setting alias in .profile as
alias ll="ls -l"
alias c=clear
should work.
I guess, the problem is that your shell is not updated with new .profile. Better close that session and start a new session or execute the following command;
#. .profile
HTH,
Prabu.S
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2006 10:29 PM
04-19-2006 10:29 PM
Re: How to add alias in .profile
Did you logout and login again ?
Regards,
Senthil Kumar .A
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2006 10:32 PM
04-19-2006 10:32 PM
Re: How to add alias in .profile
Run the .profile file in your session again, to update the environment variables in your shell.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2006 10:39 PM
04-19-2006 10:39 PM
Re: How to add alias in .profile
I tried all, but couldn't work. I find out that problem is with shell as the shell assign to me in passwd file is /bin/sh.However I move from this shell to ksh in .profile, but it seems that when i put alias in .kshrc and then execute this .kshrc in .profile , it is executed by /bin/sh instead of ksh.After login the shell assgined to me is ksh(I swith to ksh in .profile ) so when i execute .kshrc or directly alias , it works. So i think .profile is executed by /bin/sh.
please put your thought on this so that I may sort out this issue.
Regards,
Sanjeev
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2006 11:14 PM
04-19-2006 11:14 PM
Re: How to add alias in .profile
To set alias, refer this link;
http://docs.hp.com/en/B2355-90046/ch18s02.html
HTH,
Prabu.S
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2006 11:30 PM
04-19-2006 11:30 PM
Re: How to add alias in .profile
I checked it, If you are saying is correct then why same alias command which is working fine at command prompt, does not work when i put it in .profile, even when i put in different file and execute this file in .profile, it does not work.
Pl. suggest
Sanjeev gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2006 11:41 PM
04-19-2006 11:41 PM
Re: How to add alias in .profile
Hope this helps!
Regards
Torsten.
__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.
__________________________________________________
No support by private messages. Please ask the forum!
If you feel this was helpful please click the KUDOS! thumb below!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2006 11:42 PM
04-19-2006 11:42 PM
Re: How to add alias in .profile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2006 12:02 AM
04-20-2006 12:02 AM
Re: How to add alias in .profile
If you want to work with ksh, do not put it in .profile, instead change your shell defnition in /etc/passwd file. This could be done by doing the following..
chsh -r files
Use finger command to check whether the change is implemented.
Regards,
Senthil Kumar .A
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2006 12:08 AM
04-20-2006 12:08 AM
Re: How to add alias in .profile
Which is the OS, is it HPUX. If why are you trying to set alias to 'll'. This ll is a command which is equal to 'ls -l': Long list.
Try to alias with some other name like
alias LL='ls -alrt'
Regards,
Sunil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2006 12:17 AM
04-20-2006 12:17 AM
Re: How to add alias in .profile
How are you changing your shell in .profile?
To create an alias for "ll" should perfectly work.
You can check that with
# whence -v ll
this should give you
ll is an alias for ls -alrt
Hope this helps!
Regards
Torsten.
__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.
__________________________________________________
No support by private messages. Please ask the forum!
If you feel this was helpful please click the KUDOS! thumb below!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2006 12:21 AM
04-20-2006 12:21 AM
Re: How to add alias in .profile
I'm writing /usr/bin/ksh in .profile to change the shell and it is perfectly working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2006 12:33 AM
04-20-2006 12:33 AM
Re: How to add alias in .profile
Mark Syder (like the drink but spelt different)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2006 06:20 PM
04-20-2006 06:20 PM
Re: How to add alias in .profile
Edit user '.profile' and add alias. Sample:
# Define rm ALIAS.
alias rm="rm -i"
ran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2006 12:15 AM
04-21-2006 12:15 AM
Re: How to add alias in .profile
while the exported environment variables are inherited from the parent shell by the child shell, the alias definitions are not.
You must define your aliases in a file which is executed *every time* a new shell is started, not only when the user is logging in.
In HP-UX, /bin/sh executes /etc/profile and $HOME/.profile only at login, but if the ENV variable is set, the file described by the ENV variable is executed each time a new shell starts, whether it is a login situation or not.
If you use a setting like:
ENV=$HOME/.profile
export ENV
you must be careful with environment variable settings in .profile.
If you make additions to environment variable values (like PATH), the login shell will work fine, but the child shells may have the addition done twice.
For example, the login shell gets the standard PATH from /etc/profile, then executes something like "PATH=$PATH:/opt/some_application/bin" in .profile. The child shells get the already modified PATH, so if the .profile is executed again, the PATH value will look like "...:/opt/some_application/bin:/opt/some_application/bin". Grandchild shells get the addition done a third time, and so on.
Usually, this is ugly-looking but harmless. But in some situations (and particularly with variables other than PATH and MANPATH) it may cause problems.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2006 02:43 AM
04-21-2006 02:43 AM
Re: How to add alias in .profile
note, that /bin/sh ist NOT the posix shell in Solaris as in HP-UX.
The alias command is not known in the simple Bourne shell.
Next, if you just call
/usr/bin/ksh
in your .profile, the execution of a new process is performed and obviously .profile is NOT reread again - else you would have created an infinite loop.
Any alias calls before would be useless, because ignored or set in another process.
Any aliases after that would be seen only after the termination of ksh.
Try 'exit' in your shell to check this.
Really setup a normal ksh environment via
ENV=$HOME/.kshrc
export ENV
and put your aliases there.
Even better is to change your login shell to ksh. On Solaris with NIS call:
passwd -r nis -e
For other authentication methods (-r files , ...) use the appropriate tag (man passwd).
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2006 11:50 AM
04-21-2006 11:50 AM
Re: How to add alias in .profile
echo "running .profile"
Then login. If you do not see "running .profile" then that's the problem. In HP-UX, if you use a terminal emulator from an Xwindow system, the default behavior is to ignore all profiles, a very bad behavior IMHO. If you are indeed using an Xwindow system to login, read the man page on the Xwindow system where you get your xterm (or dtterm or hpterm). Then look to see if there is an Xwindow resource called loginShell. IF so, you need to set that to true and now your emulator will actually login normally, meaning that /etc/profile and .profile will be run.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2006 09:33 PM
04-21-2006 09:33 PM
Re: How to add alias in .profile
CDE is the same on hpux as it is under Solaris wrt application resources so try running :
dtterm -ls
does the alias work now ?
if yes vi $HOME/.Xresources
add
*loginShell:True
exit CDE and try a dtterm again ?
see man dtterm for details