Hackerss.com

Hackerss.com is a community of amazing hackers

Hackerss is a community for developers, data scientitst, ethical hackers, hardware enthusiasts or any person that want to learn / share their knowledge of any aspect of digital technology.

Create account Log in
Cover image for Show History of Commands - Linux
MaxX
MaxX

Posted on

Show History of Commands - Linux

One shortcut on Linux is that you can show all your previous commands that you already typed on the terminal, you just need to execute the following command:

Command

history
Enter fullscreen mode Exit fullscreen mode

Result

hackerss@www:~# history
 1994  cd kubernetes/
 1995  ls
 1996  cd headless-browser/
 1997  ls
 1998  kubectl delete -f deployment.yml
 1999  kubectl create -f deployment.yml
 2000  kubectl get pods
 2001  history
Enter fullscreen mode Exit fullscreen mode

If you dont remember the exact command that you execute before you can use the history to view what you typed before.

Another good tip is that you dont need to use your mouse to copy and paste the command from the history list. You just need to use '!' + the number of command example:

Execute Command using the id number

!1998
Enter fullscreen mode Exit fullscreen mode

This will execute the command "kubectl delete -f deployment.yml" without need to use the mouse and/or copy paste.

Discussion (0)