Interesting and useful commands available using the BASH shell on Linux.

Posted: November 5, 2012. At: 7:43 PM. This was 5 years ago. Post ID: 4799

This is an interesting command to view your command history when you are using Bash.

[[email protected] Desktop]$ hash
hits command
3 /usr/bin/sudo
1 /bin/ls
[[email protected] Desktop]$

This command is a Bash shell built-in command. If you are using the tcsh or zsh shells; this command will not be available to you. As shown below; you may also use the history command to show the last # of commands; in this case the last 10 commands executed on the Bash command-line.

[[email protected] Desktop]$ history 10
    3  sudo apt-get update
    4  sudo apt-get upgrade
    5  hash
    6  cd Desktop/
    7  ls -hula
    8  hash
    9  history 10
   10  history 20
   11  history 2
   12  history 10

This Linux command will return the IP address of a hostname. In this case the IP address of Google.

[[email protected] Desktop]$ gethostip 4A7DED64

You can also use the ping command to get this information but it is good to cover all the bases when discussing Linux commands.

Here is a tutorial on how to add a new user to an Ubuntu system with the command-line.

Some useful tricks for the Linux command-line using the find command and backticks:

How to check the status of your laptop battery and CPU temperature with the Linux command-line:

Some miscellaneous BASH shell tricks that will amaze your friends:

No comments have been made. Use this form to start the conversation :)

Leave a Reply