Missing period files in ksh

Hi Guys :slight_smile:

while trying to set the paths for Oracle, sqlplus etc. I have been trying to find dot files (.profile or .kshrc or .bashrc or .cshrc or .login or .bash_profile or similar files) to append new paths so that I can connect to oracle from a shell script (RedHat 6.3 with KSH shell). But I am not able to find out any of above files.

Could someone please help me on how come none of these files are present there at my home directory :confused: and what shall I do in this case :wall:

How have you been trying to find them?
Any of the following commands would show you all files in the current directory with names starting with a period:

ls -d .*
printf '%s\n' .*

The following command will list all files in the current directory:

ls -a

And, the following command will list all regular files in the file hierarchy rooted in the current directory:

find . -type f

Note that files like .profile , .kshrc , .bashrc , .cshrc , .login , and .bash_profile do not exist in every directory; they only appear in a user's home directory.

Thanks for the commands but I had tried all these options (obviously in home directory) but there is no sign of .profile or .login files. These are the only files coming as result of ls -d .* ->
. .. .bash_history .sh_history .snapshot

I have been thinking about creating new profile file but I'm scared if it overwrote any of the existing paths so don't want to take chances.
On top of it, still confused why these files are not available and how the shell is working properly. Is there something which I am not aware of..!

Depending on how your system admin set up your account not all or even any of those files will exist. The shell does NOT need them!
Give it a try: create the one for your shell containing a single command like echo "my profile" and login. If that works, try sth like PATH=$PATH":newpathelement" and check the PATH variable afterwards.

ksh does not use a .kshrc file, but the environment variable ENV.
Create a .kshrc file with a 1st line

echo hello .kshrc

and put the following in the .profile:

#ksh reads this startup file:
ENV=$HOME/.kshrc; export ENV

You will find that each interactive ksh reads the .kshrc first; a ksh login shell reads .kshrc after .profile.

Are you sure you're using ksh ? To get a .bash_history file, you had to have used bash as an interactive shell at some time.

If you look at the man page for your shell on your system, you'll probably find a section on startup files or initialization files. There is probably something like /etc/profile that contains common initiaization settings created for all ksh users on your system by your system's administrator. If you need more specialized settings or want to override the defaults you sysadmin created, then you need to create your own $HOME/.profile file.

It is a bit more complicated than that. It depends on if the shell is a login or an interactive shell. From the current ksh93 manpage: