Recent History


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Recent History
# 1  
Old 10-30-2011
Recent History

Could some let me know the command used to view the commands that I have entered 2 days ago. I am able to perform a command fc -l but its yielding me only last 10 recent events. I need to know the history of the commands that i have entered 2 days ago. Is there anyway that I can get the information that I am requesting for ?

Thanks
# 2  
Old 10-30-2011
What you have available to see via fc or shell built-in "history" command depends on the HISTSIZE variable. If HISTSIZE is set to 100, the history will only have the last 100 commands that you have executed. Depending on how many commands you execute per day, your history might not take you back very far.

Echo the value of HISTSIZE to see the number that the shell is keeping for you, and add the +nnn option (where nnn is a number) to see more than 10 commands. For example:

Code:
fc -l +300

should show the last 300 lines
# 3  
Old 10-30-2011
Quote:
Originally Posted by agama
What you have available to see via fc or shell built-in "history" command depends on the HISTSIZE variable. If HISTSIZE is set to 100, the history will only have the last 100 commands that you have executed. Depending on how many commands you execute per day, your history might not take you back very far.

Echo the value of HISTSIZE to see the number that the shell is keeping for you, and add the +nnn option (where nnn is a number) to see more than 10 commands. For example:

Code:
fc -l +300

should show the last 300 lines
Thanks for such a prompt response.
How can i view the HISTSIZE. When I am trying to hit the cmd
$echo HISTSIZE - displays nothing.

And fc -l +300 displays the following
ksh: +300: not found
# 4  
Old 10-30-2011
HISTSIZE is a shell variable, so this command is needed (you were close):

Code:
echo $HISTSIZE


The message from Kshell is odd. What version are you running? (run the command echo ${.sh.version} to find out. It should give you something like Version JM 93u 2011-02-08 and if it doesn't (or gives you an error) you have a pretty old version of Kshell installed.

In recent versions of Kshell, fc is an alias for hist which is a built-in command. The Kshell doc doesn't mention support for +n, however it is working for me in all of the versions I have installed, the oldest is from 2009.

My gut feeling on this is that your Kshell is old and the in built command doesn't support +n.
# 5  
Old 10-30-2011
Code:
echo $HISTSIZE

--ahamed

---------- Post updated at 08:04 AM ---------- Previous update was at 08:02 AM ----------

Check vi ~/.profile or vi ~/.bashrc depending on your shell

--ahamed
# 6  
Old 10-30-2011
You might try this:

Code:
cat -v $HISTFILE|sed 's/\^.//g'

Which should list all of the commands in the hist file stripping away any non-printable characters that Kshell adds.


It also occurred to me that your history might be deleted each time you log in, or might be placed into a different file for each login session that you have. Might make finding the right file, if it still exists, a bit of a challenge.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. What is on Your Mind?

The Great History of UNIX (1969-1999) | 30 Years of UNIX History | YouTube Video

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

2. UNIX for Dummies Questions & Answers

History to Another file [local user history , but root access]

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

3. UNIX for Advanced & Expert Users

History to Another file [local user history , but root access]

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

4. UNIX for Dummies Questions & Answers

How to review the history and the commands that has been done in this history?

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

5. UNIX for Advanced & Expert Users

vi recent command history

How do you get your recent vi command history to show up? I keep randomly getting like my previous 5 commands and can't figure out how I'm doing it. I think it has something to do with the shift key and another button. (6 Replies)
Discussion started by: cokedude
6 Replies

6. Shell Programming and Scripting

Getting the most recent file

Hi people, Please some help over here. I have logs in a directory, in which I need to get the most recent file in order to put it within other command. The format of the files are loadfiles20090308094339_41 loadfiles20090308094418_42 loadfiles20090308095457_43... (4 Replies)
Discussion started by: cgkmal
4 Replies

7. Shell Programming and Scripting

how to get the most recent date value

I have a set of values like this and sometimes more source5local_02Dec2008 source5local_01Nov2008 source5local_05Sep2008 I need to retrieve the string with the most recent date if I cut the date value from each of these strings is there any means to compare them (3 Replies)
Discussion started by: codeman007
3 Replies

8. Shell Programming and Scripting

To keep only the most recent files

Hi all, I'm running on a Sun Solaris machine. I would only want to keep the last 2 most recent files on 1 of my directory. Below shows my script, but it is incomplete. For the ?? part I do not know how to continue. please help:confused: DIR=/tmp/abc OUTPUT=/tmp/output.out... (1 Reply)
Discussion started by: *Jess*
1 Replies

9. Shell Programming and Scripting

getting the most recent file

Hi, I have files coming in every day with that days timestamp like: nameyyyymmddhhmmss.ext. I need the most recent one and so i am using cat `ls -t name*|head -1 ` > temp i am sorting the files in the decending order and am copying the most recent one into a temp file. It works at times... (3 Replies)
Discussion started by: anujairaj
3 Replies
Login or Register to Ask a Question