music
OSdata.com: programming text book 

OSdata.com

command history

summary

    This subchapter looks at command history in a UNIX (and Linux) BASH shell.

    Command history is used to recall recent commands and repeat them with modifications.

free book on UNIX/Linux System Administration

Teach Yourself UNIX/Linux System Administration and Shell Programming

free computer programming text book project

table of contents
If you like the idea of this project,
then please donate some money.
more information on donating

Google

command history

    This subchapter looks at command history in a UNIX (and Linux) BASH shell.

    Command history is used to recall recent commands and repeat them with modifications.

    You will find that you are often repeating a few common commands over and over with variations in the options and arguments (such as file names). Having the ability to recall a previous example and make a few changes will greatly save on typing.

arrow keys

    Pushing the Up Arrow key will bring back previously typed commands one at a time (from most recently typed to the first typed).

    Pushing the Down Arrow key will move from the oldest to the newest commands one at a time.

    The commands brought back by the Up Arrow and Down Arrow keys will appear after the current prompt.

    You can press the ENTER or RETURN key to immediately run any selected command.

    After using the Up Arrow or Down Arrow keys, your cursor is at the end of the line. You can use the DELETE key to remove old arguments and then start typing in new ones.

    Note that holding down the CONTROL key and pressing the p key at the same time will take you to the previous command just like the Up Arrow key. This is written ^p.

    Holding down the CONTROL key and pressing the n key at the same time will take you to the next command just like the Down Arrow key. This is written ^n.

    Pressing the META key (or on some systems pressing the ESCAPE key), then releasing it, then typing the less than < key will take you to the beginning of the command history. Pressing the META key (or on many modern systems pressing the ESCAPE key or ESC key), then releasing it, then typing the greater than > key will also move to the end (most recent) command history. These are written M-< and M->.

editing a line

    As mentioned above, when you use command history, the cursor is at the end of the recalled command.

    Either the Left Arrow or ^b (CONTROL-B) will go one character backward (towards the beginning of line).

    Either the Right Arrow or ^f (CONTROL-F) will go one character forward (towards the end of line).

    Typing inside a line will place characters in front of the cursor. The character inside the cursor remains unchanged.

    Using the DELETE key will delete the character in front of the cursor. The character inside the cursor remains unchanged.

    ^k (CONTROL-K) will delete everything from the cursor to the end of the line.

    ^d (CONTROL-D) will delete the character inside (under) the cursor.

    M-b will move you one word back (towards beginning of line). In this case, a word is a collection of characters, usually separated by a space character.

    M-f will move you one word forward (towards end of line).

    ^e (CONTROL-E) will move to the end of the line and ^a (CONTROL-A) will move to the beginning of the line.

    Once you have edited your command, use the RETURN or ENTER key to run the new command. You can use the ENTER or RETURN key from anywhere in the command line. You do not have to be at the end of the command line.


comments, suggestions, corrections, criticisms

please contact us

your name:
email address:
phone number:
message:

free music player coding example

    Coding example: I am making heavily documented and explained open source code for a method to play music for free — almost any song, no subscription fees, no download costs, no advertisements, all completely legal. This is done by building a front-end to YouTube (which checks the copyright permissions for you).

    View music player in action: www.musicinpublic.com/.

    Create your own copy from the original source code/ (presented for learning programming).


return to table of contents
free downloadable college text book
free downloadable system administrator and shell programming book

view text book
HTML file

Because I no longer have the computer and software to make PDFs, the book is available as an HTML file, which you can convert into a PDF.

previous page next page
previous page next page

free book on UNIX/Linux System Administration

Teach Yourself UNIX/Linux System Administration and Shell Programming

free computer programming text book project

Building a free downloadable text book on computer programming for university, college, community college, and high school classes in computer programming.

If you like the idea of this project,
then please donate some money.

send donations to:
Milo
PO Box 1361
Tustin, California 92781

Supporting the entire project:

    If you have a business or organization that can support the entire cost of this project, please contact Pr Ntr Kmt (my church)

more information on donating

Some or all of the material on this web page appears in the
free downloadable college text book on computer programming.


Google


Made with Macintosh

    This web site handcrafted on Macintosh computers using Tom Bender’s Tex-Edit Plus and served using FreeBSD .

Viewable With Any Browser


    †UNIX used as a generic term unless specifically used as a trademark (such as in the phrase “UNIX certified”). UNIX is a registered trademark in the United States and other countries, licensed exclusively through X/Open Company Ltd.

    Names and logos of various OSs are trademarks of their respective owners.

    Copyright © 2012, 2013 Milo

    Created: July 3, 2012

    Last Updated: August 21, 2013


return to table of contents
free downloadable college text book
free downloadable system administrator and shell programming book

previous page next page
previous page next page