Command line history in ubuntu terminal

Here is few command for getting history in ubuntu terminal.

All history:

 history

 Output:
  483  cat /etc/nginx/nginx.conf 
  487  clear
  488  history
  490  which sh
  496  history 10

This will output like this. First part is the process ID and second part is command.

Get only last 10 history

 history 10

Search for history:

 history | grep nginx

Output: 
483  cat /etc/nginx/nginx.conf 

Running Previous Commands:

 !483
 
 Output:
 483  cat /etc/nginx/nginx.conf 

Hope this will help you to save time.

Happy coding 🙂

Advertisements

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