Skip to content

Linux Command History

November 7, 2012

List your command history:


$ history

Clear command history:


$ history -c

Execute Last Command:


$ !!

Execute Specific Command from List:

After executing the history command, you will see a list of all the commands you’ve executed with a number next to it. Bellow is the command you would use to execute a specific command from that list. All you would have to do is include the number next to that command as an argument.


$ ![number next to the command]

Example:

[user@1111111111 usr]$ history
8 cd /usr/bin/
9 cd ..
10 echo “test”
11 history

[user@1111111111 usr]$ !10
echo “test”
test

Advertisements

From → Guide

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: