01-25-2009
bash is my default shell.
In case of crash, I only loose the commands entered during the session that crashed.
It looks like a normal behavior because
cat .bash_history contains only commands typed during the previous sessions while
history -a contains commands typed during the current session and
history -w the concatenation of both.
Example:
Quote:
santiago@aldebaran:~$ ssh supernova
santiago@supernova:~$ cat .bash_history
echo hello world
santiago@supernova:~$ echo -e "this will appear in the history\nbecause this session will logout properly"
this will appear in the history
because this session will logout properly
santiago@supernova:~$ logout
Connection to supernova closed.
santiago@aldebaran:~$ ssh supernova
santiago@supernova:~$ cat .bash_history
echo hello world
cat .bash_history
echo -e "this will appear in the history\nbecause this session will logout properly"
santiago@supernova:~$ echo -e "this won't appear in the history\nbecause this session will crash"
this won't appear in the history
because this session will crash
santiago@supernova:~$ skill -KILL -u santiago
Connection to supernova closed.
santiago@aldebaran:~$ ssh supernova
santiago@supernova:~$ cat .bash_history
echo hello world
cat .bash_history
echo -e "this will appear in the history\nbecause this session will logout properly"
santiago@supernova:~$ echo -e "this will appear in the history\nbecause I'll save it before crash"
this will appear in the history
because I'll save it before crash
santiago@supernova:~$ history -w
santiago@supernova:~$ skill -KILL -u santiago
Connection to supernova closed.
santiago@aldebaran:~$ ssh supernova
santiago@supernova:~$ cat .bash_history
echo hello world
cat .bash_history
echo -e "this will appear in the history\nbecause this session will logout properly"
cat .bash_history
echo -e "this will appear in the history\nbecause I'll save it before crash"
history -w
santiago@supernova:~$
8 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
How do I add a history function to my shell? What I mean is if I have used the command: xemacs file.tex, I'd like to be able to type 'x' then use the arrow keys and go through all the commands I've done starting with an 'x'. Thanks! (3 Replies)
Discussion started by: pmasterkim
3 Replies
2. Shell Programming and Scripting
hi there !
i have exactly the same problem like this guy here
https://www.unix.com/shell-programming-scripting/127668-getting-curl-output-verbose-file.html
i am not able to save the curl verbose output..
the sollution in this thread (redirecting stderr to a file) does not work for me.... (0 Replies)
Discussion started by: crabmeat
0 Replies
3. UNIX for Dummies Questions & Answers
Hello every body,
Kindly inform me How Do i find out the time I executed a command previously on UNIX Solaris??
To be more specific and more clear about what i want to know is that I want a command the enables me to know the history and which command i run at this history/time.
FYI I used... (5 Replies)
Discussion started by: ahmedamer12
5 Replies
4. UNIX for Advanced & Expert Users
Hi all,
My need is :
1. To know who , when , which command used.
2. Local user should not delete this information.
I mean , with an example , i can say
i have a user user1
i need to give all the following permissions to user1, :
a. A specific directory other than his home... (3 Replies)
Discussion started by: linuxadmin
3 Replies
5. UNIX for Dummies Questions & Answers
Can anyone tell this:
If two users are logged into the same server from different locations. Is there a way to see the history command of the other user? I tried the history command, but it is showing me only the commands I used.
Thanks in advance for your help.
Iamnew2solaris (1 Reply)
Discussion started by: iamnew2solaris
1 Replies
6. UNIX for Dummies Questions & Answers
Hi all,
My need is :
1. To know who , when , which command used.
2. Local user should not delete this information.
I mean , with an example , i can say
i have a user user1
i need to give all the following permissions to user1, :
a. A specific directory other than his home... (1 Reply)
Discussion started by: sriky86
1 Replies
7. Shell Programming and Scripting
I am trying to modify the "corestat v1.1" code which is in Perl.The typical output of this code is below:
Core Utilization
CoreId %Usr %Sys %Total
------ ----- ----- ------
5 4.91 0.01 4.92
6 0.06 ... (0 Replies)
Discussion started by: Zam_1234
0 Replies
8. What is on Your Mind?
I am pleased to announce this new video in 1080 HD for UNIX lovers honoring thirty years of UNIX history spanning from 1969 to 1999 presented in 150 seconds (two and a half minutes) in 1080 HD, celebrating the 50th anniversary of UNIX.
The Great History of UNIX (1969-1999) | 30 Years of UNIX... (8 Replies)
Discussion started by: Neo
8 Replies