Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have these files in my home directory:

drwxr-xr-x    3 meuser staff           256 Oct 12 13:11 .
drwxr-xr-x  102 bin      bin            4096 Sep 30 12:28 ..
-rw-------    1 meuser staff          5349 Oct 11 20:44 .bash_history
-rwx------    1 meuser staff           466 Jun 26 22:12 .profile
-rw-------    1 meuser staff          7074 Oct 12 13:11 .sh_history
drwx------    2 meuser staff           256 Aug 16 15:28 .ssh

My default shell is the Korn shell. When I tried to put an alias into .profile like this:

alias l='ls -lrt'

and tried to run it after relogin:

$ l
ksh: l:  not found.

How to make this alias work?

share|improve this question
What happens when you run . ./.profile? – Mikel Mar 23 '14 at 3:37
Are you typing l in response to your $ shell prompt, or are you typing $l? – G-Man Jun 1 '15 at 10:09

It does work.

The only difference I can see with my own .profile are the double quotes:

alias l="ls -l"

That line works for me in AIX with ksh as the shell.

Regarding the disconection and reconection... are you sure the default shell is ksh? Check your user in /etc/passwd.

share|improve this answer
Note that the question shows an error message coming from ksh. – G-Man Jun 1 '15 at 10:10
@G-Man My "It does work" in the answer means alias works in AIX (Read the title of the question). The rest of the answer explains why it didn't work in his case. – YoMismo Jun 1 '15 at 11:25

.profile is only read at login. Later modifications do not affect the current environment. You have to reload .profile by means of:

  • sourcing the file: . .profile (affects the current shell, not all shells)
  • su -l <user> (new login)
  • logout + login
share|improve this answer
That does not seem to work. I changed my default shell to bash and relogin, and then it worked. So it is somehow related to korn shell. – jrara Oct 12 '13 at 13:16
@jrara Try adding -l to provide an login environemnt. – Marco Oct 12 '13 at 14:28

The .profile is not your shell configuration file, it's your login session settings file. It is only read by the shell started upon login, not other interactive shells started within your login session.

ksh has no dedicated customization file per-se, but it treats the $ENV variable as a path to a customization file for interactive shell sessions.

So you'd add something like:

ENV="$HOME/.kshrc" export ENV

to your ~/.profile and:

alias 'l=ls -lrt'

to your ~/.kshrc.

The change would only take effect at the next login.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.