It's usually in a file called .sh_history in the root directory, unless it's been relocated via the HISTFILE variable (echo $HISTFILE). Is it possible that you're not seeing it because it's a hidden/dot file? Do a ls -la | pg in your root directory and you should find it there. I'm assuming you're using ksh here? Cheers.
i guess it's bourne shell...
when i do a #echo $HISTFILE it simply gives a blank line as result.....
where do i define that? Alos I 'su' into root... is that playing a rule? thnx
Sorry - Bourne shell doesn't support command histories. You could start up a ksh session in your .profile if you don't want to make ksh your default, though the latter is not recommended. HTH.
what I don't understand, is that the .sh_history file is filled up regulary with commands I use as logged in with MY user account.... but an su to root and no history anymore.... i'm a bit lost....
sorry, didn't crossed, but as i'm not that used to it, i don't see any help in putting ksh into the profile.... can you explain just a bit more? I'm confused at the end, because the .sh_history file gets updated when i'm logged in as USER, but as soon as I use su to root, i have no clue how see any history file... now if you tell me putting in ksh intoe the root's profile, the i understand.... just, where's the root's profile?
thnx for help -
Your user login probably uses ksh by default (try echo $SHELL when logged in as user). Putting ksh in your .profile (which can be found under your root directory - use ls -la .profile in /) will invoke ksh when you log in but will still allow you to log in if ksh isn't available for some reason. That will then create a .sh_history file for you. Hope this helps. Cheers.
Grasping at straws here, but is it possible that userXY's shell is set in .profile to ksh? Do a grep for ksh in the .profile of the user's home directory. I just remembered that $SHELL keeps the value of the shell set in /etc/passwd even if it is changed later, so in this case echo $SHELL would give /usr/bin/sh in any case. Post back with any info. Cheers.
The main point which I'm lost with is that the USERXY works fine with the history file... I checked again... the only problem remains when using "su root"... hmmmm, i'd have another question on that point then: How do I set the SHELL variable once su'd to root? And if SHELL set, how to include it the way it would execute on each 'su' to root?
Hehe, I see that even simple question can become a bit complex
Anyway, back to it. I hadn't noticed before that you seem to be using su root rather than su - root. The latter construct picks up root's .profile and any other variables appropriate to root, the first won't. To set the shell variable once logged in as root, you can probably do an export SHELL=<path to ksh>. That won't necessarily change your shell, however, but you can issue a ksh to do that. Let us know how you get on.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.