Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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 korn shell. When I tried to put 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 at 3:37

2 Answers 2

.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

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

Your Answer

 
discard

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.