Can I use history command to run previous commands?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Can I use history command to run previous commands?
# 1  
Hi,

I can use history command in unix to view my last 50 commands. But how can I run the previous commands easily? Can history command help?

Firebird
# 2  
!! : to run the previous command
^P : move up through history list, one command at a time. (Up arrow key)
^N : move down (or Down arrow key).
!n : run nth command in history list. where n is a number from your history list.
!n:p : only preview command number n (will not execute the command).
!string : Run most recent command starting with characters in string.
# 3  
Or if you are using ksh, use the 'vi' keys to scroll through.edit your previsou commands.
Hit Escape, then 'k' to scroll back. 'j' to move forward. 'l' to move right, 'h' for left, etc. Almost all the normal vi function keys are available...

 

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #413
Difficulty: Medium
The AT&T 3B1, also known as the PC7300 or UNIX PC, was a desktop workstation computer based on the Motorola MC68010 microprocessor, running an operating system from Convergent Technology (based on Unix System V Release 2).
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Loop to run commands - after the previous instance completed

Hi All, I am trying to call a shell script in a loop. I want my first instance to complete, and then the 2nd instance of the command to start - and so on. eg. I am running this script 30 times. The wrapper script needs business date, from_time,to_time & server_name as inputs. script_name... (2 Replies)
Discussion started by: neil.k
2 Replies

2. UNIX for Advanced & Expert Users

Fc command does not display all commands history of a user

hi, i have an AIX6.1 machine and i modified a user's profile so that it creates history file for each ip address that connects with this user. the reason i did this is because more than 1 person connects with the same user so i want to keep track of command run by all of them. therefore, in the... (5 Replies)
Discussion started by: omonoiatis9
5 Replies

3. UNIX for Dummies Questions & Answers

Want to get list of Linux commands used on specific date through HISTORY command

I want to get list of linux commands used on Jan 01 2014 with the help of HISTORY command or some other linux commands,. Kindly help. (3 Replies)
Discussion started by: karthick nath
3 Replies

4. Shell Programming and Scripting

commands History

how to list all commands history for a username during a certain time ? Maany Thanks (2 Replies)
Discussion started by: Sara_84
2 Replies

5. Shell Programming and Scripting

history commands

Hi Guys, I am running RHEL5, I am trying to find out the history of the cammands that were executed on my server. I have files that are missing I just want to find out what happened to them. I used history | more but I can't find anything related to my query. I also checked... (1 Reply)
Discussion started by: Phuti
1 Replies

6. 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

7. UNIX for Dummies Questions & Answers

Command to run multiple commands from a file.

I need a command, which could run mutliple commands from a file. Let's say, I have mv fileA1 fileB1 mv fileA2 fileB2 ..... mv fileA20 fileB20 I put these commands in a file, then I need a command to run the file as a whole so that I don't need to type 20 times... Anyone tell me how to... (8 Replies)
Discussion started by: kaixinsjtu
8 Replies

8. Solaris

Can history commands show what time command executed

On Solaris 8 and 10 is there a way history command can show what time a particular command was executed. Pls reply. Thanks (2 Replies)
Discussion started by: Tirmazi
2 Replies

9. Linux

history of commands

I would like to log all the commands I type (on the terminal) to a file. The command "history" does this only for current terminal only. I typically keep around 10 terminals open. Thanks, j Note: I do not have root access. (2 Replies)
Discussion started by: superuser84
2 Replies

10. Solaris

History commands

Dear What's the command to be executed to retreive all history commands for a specific user? (1 Reply)
Discussion started by: abu_hassan
1 Replies

Featured Tech Videos