LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-08-2008, 03:07 PM   #1
concoran
Member
 
Registered: Jun 2001
Location: 28N,82W
Distribution: XP,Ubuntu 9
Posts: 473

Rep: Reputation: 30
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?
 
Old 03-08-2008, 03:21 PM   #2
mrclisdue
Senior Member
 
Registered: Dec 2005
Distribution: Slackware
Posts: 1,134

Rep: Reputation: 277Reputation: 277Reputation: 277
to view previous commands:

$ history

to create a file:

$ history >> filename


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


cheers,

Last edited by mrclisdue; 03-08-2008 at 03:23 PM.
 
Old 03-08-2008, 03:23 PM   #3
vaalu
Member
 
Registered: Jun 2007
Posts: 54

Rep: Reputation: 15
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
 
Old 03-08-2008, 04:05 PM   #4
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
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.
 
Old 03-08-2008, 04:41 PM   #5
concoran
Member
 
Registered: Jun 2001
Location: 28N,82W
Distribution: XP,Ubuntu 9
Posts: 473

Original Poster
Rep: Reputation: 30
Thanks folks. It works.
 
Old 07-12-2011, 08:21 AM   #6
shravankumar.bbc
LQ Newbie
 
Registered: Mar 2010
Posts: 9

Rep: Reputation: 0
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
 
Old 07-12-2011, 09:00 AM   #7
SL00b
Member
 
Registered: Feb 2011
Location: LA, US
Distribution: SLES
Posts: 375

Rep: Reputation: 112Reputation: 112
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
 
  


Reply

Tags
history, terminal



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
In Solaris(command Line ), How to get the previous commands? kcarun Solaris / OpenSolaris 22 10-19-2012 03:49 AM
making a script that opens terminal and enter commands into that terminal Cinematography Linux - General 8 12-16-2008 10:34 AM
Clear previous commands in Terminal Hitboxx Fedora 4 07-12-2006 07:20 AM
going through previous bash commands corrupts console text? juanbobo Linux - Software 1 08-30-2005 10:24 AM
Can ash recall previous commands? Scerj Linux - General 0 06-06-2001 02:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration