i changed the directory using cd $HOME but i dont see any .profile files under that directory. am i missing it? or it can be under some other directory? is it required to have it?

No, it is not required to have and depends on the shell you're using. For example bash uses .bash* prefixed files:

sk@sk:~$ ls -al .ba*
-rw------- 1 sk wheel 148196 Sep 24 14:18 .bash_history
-rw-r----- 1 sk wheel    509 May  9  2005 .bash_profile
-rw-r----- 1 sk wheel   1093 Oct 15  2004 .bashrc

There is also global profiles for most shells:

sk:/etc# ls -al bash.bashrc
-rw-r--r-- 1 root root 1127 Mar  4  2005 bash.bashrc

You can also just cd to return to your home directory:

sk@sk:/var/lib$ cd
sk@sk:~$

i use korn shell, ksh

Here is the ksh login logic:

If the shell is invoked by exec(2), and the first character of argument zero ($0) is -, then the shell is assumed to be a login shell and commands are read from /etc/profile and then from either .profile in the current directory or $HOME /.profile, if either file exists. Next, for interactive shells, commands are read from the file named by performing parameter expansion, command substitution, and arithmetic substitution on the value of the environment variable ENV if the file exists. If the -s option is not present and arg and a file by the name of arg exits, then it reads and executes this script. Otherwise, if the first arg does not contain a /, a path search is performed on the first arg to determine the name of the script to execute. The script arg must have execute permission and any setuid and setgid settings will be ignored. If the script is not found on the path, arg is processed as if it named a built-in command or function. Commands are then read as described below; the following options are interpreted by the shell when it is invoked:

Files used:

/etc/passwd
/etc/profile
/etc/suid_profile
$HOME /.profile
/tmp/sh*
/dev/null

ksh man page

i cant add to your reputation for today, i will tomorrow.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.