music |
| | 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.
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
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).
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.
Names and logos of various OSs are trademarks of their respective owners.