LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Terminal : How to list previous commands? (https://www.linuxquestions.org/questions/linux-newbie-8/terminal-how-to-list-previous-commands-626651/)

concoran 03-08-2008 03:07 PM

Terminal : How to list previous commands?
 
Folks,

In a Terminal : How to list previous commands? More importantly, is it possible to put them in a file?

mrclisdue 03-08-2008 03:21 PM

to view previous commands:

$ history

to create a file:

$ history >> filename


edit: of course, it already exists in a file - .bash_history


cheers,

vaalu 03-08-2008 03:23 PM

it is simple..
type "history" to list the previous commands..
history > output
typing that in the terminal will save the output to a file
also the script command is a useful one to record the terminal activities

type script in the terminal the moment from which you want the activities recorde.then when you are done just type exit.and you will find a file named typesdript in the home directory..that will do

Emerson 03-08-2008 04:05 PM

To re-use previous commands type a few letters from beginning and tap Page-Up. Depending how long is your history - usually 1000 lines - it makes life real easy.

concoran 03-08-2008 04:41 PM

Thanks folks. It works. :)

shravankumar.bbc 07-12-2011 08:21 AM

Re: previous commands
 
Hi friends,

A am using RHEL5.4 and in my server I logined as a root user and i have done some tasks like creating files,
directories deleting directories and before logout as root i entered a command "history -c".
Then what is the procedure to view also those previous commands.

I used a command "lastcomm", but it is not ginving the complete information.
Friends is there any command to view my previous commands

SL00b 07-12-2011 09:00 AM

Apart from reading the dead thread you just resurrected, you could also check the man page, because there's no such argument for the history command.

Code:

man history


All times are GMT -5. The time now is 04:42 AM.