Link to home
Start Free TrialLog in
Avatar of Jason Yu
Jason YuFlag for United States of America

asked on

can't see command history in linux

I have a oracle db server set up with a user called "oracle". when I run "history" command it gives me nothing. Is there a way to enable history for this user?

[oracle@palmdale:/home/oracle]history
1       history | grep OSWatcher
2       history
3       ls -alth
[oracle@palmdale:/home/oracle]cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
Avatar of Jason Yu
Jason Yu
Flag of United States of America image

ASKER

the shell this user uses is ksh.


[oracle@palmdale:/home/oracle]cat /etc/passwd | grep oracle
oracle:x:500:500::/home/oracle:/bin/ksh
[oracle@palmdale:/home/oracle]
SOLUTION
Avatar of jmcg
jmcg
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of omarfarid
omarfarid
Flag of United Arab Emirates image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I don't have .profile under the oracle home folder:

$ ls -alth
total 24K
-rw-------  1 oracle oinstall   44 May 19 20:06 .sh_history
drwx------. 2 oracle oinstall 4.0K May 19 20:03 .
drwxr-xr-x. 5 root   root     4.0K May 14 23:49 ..
-rw-r--r--. 1 oracle oinstall   18 Jul  9  2013 .bash_logout
-rw-r--r--. 1 oracle oinstall  176 Jul  9  2013 .bash_profile
-rw-r--r--. 1 oracle oinstall  124 Jul  9  2013 .bashrc
$
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
In fact, the oracle user has two profile files. One is .bash_profile, the otehr is .profile. what is the difference between these two files?

[oracle@palmdale:/home/oracle]ls -alth | grep profile
-rw-r--r--   1 oracle oinstall   222 Sep 18  2014 .bash_profile
-rw-r--r--   1 oracle oinstall  1.5K Jan 30  2007 .profile
[oracle@palmdale:/home/oracle]cat /etc/passwd | grep oracle
oracle:x:500:500::/home/oracle:/bin/ksh
[oracle@palmdale:/home/oracle]
Here is the content of the .profile.

export PATH LIBPATH ORACLE_HOME
PS1='[$LOGNAME@$PWD]'
if [ -s "$MAIL" ]           # This is at Shell startup.  In normal
then echo "$MAILMSG"        # operation, the Shell checks
fi                          # periodically.

set history 100
if [ -t 0 ]; then
   stty intr ^C
fi
if [ -s "$MAIL" ]           # This is at Shell startup.  In normal
then echo "$MAILMSG"        # operation, the Shell checks
fi                          # periodically.
if [ -z "$REMOTEHOST" ]
then
DISPLAY=`hostname`:0.0; export DISPLAY
else
DISPLAY="$REMOTEHOST":0.0; export DISPLAY
fi
#DISPLAY=localhost:1; export DISPLAY
#xhost + localhost

ORACLE_BASE=/usr/orasw; export ORACLE_BASE
export NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1
export NLS_DATE_FORMAT="DD-MON-YYYY HH24:MI:SS"
#ORACLE_TERM=xterm; export ORACLE_TERM
LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib
#LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/network/lib:$ORACLE_HOME/jdbc/lib:/usr/local/lib
export LD_LIBRARY_PATH
export TERM=vt100
. /home/oracle/.db102
#. /home/oracle/.db10103
PATH=/usr/bin:/bin:/usr/ccs/bin:/usr/ucb:/usr/local/bin:$ORACLE_HOME/bin:/usr/X11R6/bin:/usr/bin/X11:$HOME/bin:/usr/java/j2sdk1.4.2_06/bin:.
export PATH
alias l='ls -atl | more'
alias h=history
alias greenwin='xterm -sb -bg aquamarine&'
alias bluewin='xterm -sb -bg lightblue&'
alias print_small='qprt -z1 -s lineprinter -p17 -P5SI_OPS_1'
#alias sid='echo $ORACLE_SID'
stty erase ^?
set -o vi
umask 022
export ORACLE_TERM=xterm
export CVUQDISK_GRP=oinstall
export TEMP=/tmp
export TMPDIR=/home/tmpdir
~

Open in new window

ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial