Linux First Steps
computer software
Linux First Steps Linux First Steps
Linux First Steps   Home | Site Map | About Us | Products | Services | News | Contact Us | Links Linux First Steps
Linux First Steps Linux First Steps

Copyright © 2009

Linux® Bible


pressing Esc+? (or by pressing Tab twice) at the point where you want to do completion. This
shows the result you would get if you checked for possible completions on
$P
.
$ echo $P<Esc+?>
$PATH $PPID $PS1 $PS2 $PS4 $PWD
$ echo $P
In this case, there are six possible variables that begin with
$P
. After possibilities are displayed, the
original command line returns, ready for you to complete it as you choose.
Command-Line Recall
After you type a command line, that entire command line is saved in your shell's history list. The
list is stored in a history file, from which any command can be recalled to run again. After it is
recalled, you can modify the command line, as described earlier.
To view your history list, use the
history
command. Type the command without options or fol-
lowed by a number to list that many of the most recent commands. For example:
$ history 8
382 date
383 ls /usr/bin | sort -a | more
384 man sort
385 cd /usr/local/bin
386 man more
387 useradd -m /home/chris -u 101 chris
388 passwd chris
389 history 8
A number precedes each command line in the list. You can recall one of those commands using an
exclamation point (!). Keep in mind that when using an exclamation point, the command runs
blind, without presenting an opportunity to confirm the command you're referencing. There are
several ways to run a command immediately from this list, including:
!n
-- Run command number. Replace the
n
with the number of the command line, and
that line is run. For example, here's how to repeat the
date
command shown as com-
mand number 382 in the preceding history listing:
$ !382
date
Thu Oct 26 21:30:06 PDT 2008
!!
-- Run previous command. Runs the previous command line. Here's how you'd
immediately run that same
date
command:
$ !!
date
Thu Oct 26 21:30:39 PDT 2008
52
Linux First Steps
Part I