MTC logo MTC logo Midlands Technical College
Prospective StudentsEnrolled StudentsFaculty & StaffCommunity Partners
About
Academics
Continuing Education
Distance Learning
Student Forms
Library
Class Schedule
News & Updates
Calendar
Directory
Site Map
Ask MTC
MTC Jobs Bookstore
Home
navigation
 
Search

 

About MTC Academics Continuing Education Distance Learning Student Forms Library Class Schedule News & Updates Calendar Directory Site Map Ask MTC MTC Jobs Bookstore Home


CPT 247


Quick Reference

Exercise

Shellscript1

 

Setting up the History Mechanism

The history mechanism "remembers" the most recent commands you have issued, and allows you to repeat those commands quickly.

In csh and tcsh shells, you need to specify how many commands are to be remembered; otherwise only the single most recent command will be retained.

KSH shell remembers 128 commands while BASH retains 500 commands.

Set the number of commands to be recorded.

    set history = 15        for csh and tcsh

    HISTORY = 15        for KSH and BASH

Run the history command.

    history

Repeat the most recent command on the list.

    !!            for csh, tcsh, or bash

    r            for ksh

Repeat a command by number.

    !7            for csh, tcsh, or bash

    r 7            for ksh (need the space between r and the number)

Repeat a command by entering the first letter(s) of the command line.

    !p            for csh, tcsh, or bash

    r p            for ksh (need the space between r and the letter)