Touch dat1 dat2 110 cd etc 109 date to display the

This preview shows page 183 - 187 out of 390 pages.

touch dat1 dat2 110 cd /etc 109 date $ To display the most recent cd command to the most recent date command, enter the following command: $ history cd date 110 cd /etc/ 109 date $ Oracle University and MULTIREDE INFORMÁTICA S.A use only THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
Displaying the Command History 6-20 Solaris™ 10 Operating System Essentials Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision C.1 Note – The Korn shell stores command history in a file specified by the HISTFILE variable. The default file is the ~/.sh_history file. You can use the HISTSIZE variable to specify the number of commands to store in this buffer. If this variable is not set, then the shell stores the most recent 128 commands. Using the r Command The r command is an alias built into the Korn shell that enables you to repeat a command. To repeat the cal command using the r command, enter the following command: $ cal February 2009 S M Tu W Th F S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 $ r cal February 2009 S M Tu W Th F S 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 $ Oracle University and MULTIREDE INFORMÁTICA S.A use only THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
Displaying the Command History Using Commands Within the Shell 6-21 Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision C.1 To re-execute a command by line number, use the r command followed by the respective line number. For example: $ history ... 109 date 110 cd /etc 111 touch dat1 dat2 112 ps -ef 113 history $ r 112 ( output of the ps -ef command omitted ) You can also use the r command to re-execute a command beginning with a particular character, or string of characters. To re-run the most recent occurrence of a command that begins with the letter “ c ” enter the following command: $ r c cd /etc $ To re-run the most recent occurrence of the ps command, enter the following command: $ r ps ps -ef ( output of the ps -ef command omitted ) You can use the r command to repeat a previous command, perform a simple edit of a command-line and run the newly modified command. For example, to repeat the most recent occurrence of a command beginning with the letter “ c ” and replace dir1 with dir2 , enter the following sequence of command: $ history ... 121 cd 122 cat dante 123 ls 124 cd ~/dir1 125 cal $ r c cd ~/dir1 $ r dir1=dir2 cd ~/dir2 Oracle University and MULTIREDE INFORMÁTICA S.A use only THESE eKIT MATERIALS ARE FOR YOUR USE IN THIS CLASSROOM ONLY. COPYING eKIT MATERIALS FROM THIS COMPUTER IS STRICTLY PROHIBITED
Displaying the Command History 6-22 Solaris™ 10 Operating System Essentials Copyright 2009 Sun Microsystems, Inc. All Rights Reserved. Sun Learning Services, Revision C.1 Editing and Re-running Previously Executed Commands You can edit previously executed commands and re-run these commands using a shell in-line editor.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture