172
13.12.2 A: Using More Command History
If you type history, you'll see a numbered list flash by, showing you the previous 500 commands
you've used.
You probably don't need to see all of the last 500 commands, so the command history 20 might be
useful. This way, only the previous 20 commands you'd typed will display (you can use any number
with this command).
Other Shortcuts
Here are other command history shortcuts which may be useful to you:
•
"Bang, bang": Typing !! (called "bang bang") executes the last command in the history.
•
"Bang number": Typing ! number (as in !302) will execute the command which is numbered
302 in the history file.
•
"Bang string": Typing ! string (as in !rpm) will execute a command with the most recent
matching string from the history file.
•
[Up arrow]
through previous commands in your history list (the down arrow will move you forward through
the commands) until you find the command you want. Press
as if you had typed it on the command line.
13.13 Forgotten Password
13.13.1 Q: Using Linux Single
Help! I can't remember my root password. How do I log in now?
13.13.2 A: Use Single-User Mode
You can log in with single-user mode and create a new root password.
Reboot your computer. If you are currently set up to log in to X rather than a console, you will need
to press
[Ctrl]-[X]
single-user mode. Some of the filesystems will be mounted, and you will find a bash# prompt when
you've entered single-user mode (note that this prompt will look somewhat different than the prompt
you're accustomed to).
Now, you can change root's password by typing
bash# passwd root
and
: At the shell prompt, you can simply press the up arrow to move back
[ down arrow]
when prompted. When you see the boot: prompt, type linux single to enter
Chapter 13:Frequently Asked Questions
to execute the command, just
[Enter]
Need help?
Do you have a question about the LINUX 7.2 and is the answer not in the manual?
Questions and answers