Basic Commands -history
Here,we discuss about a new and important command named “history”.
history
Just,simply write “history” in the terminal and see the result.
It showed the entire commands which we are used from the initial stage of installing the linux to upto date.
This will brings us the previous commands to know the steps if we have any issues facing in re-usability of an application.
history | head
history | tail
| head ==> denotes the first 10 commands which we used.
| tail ==> denoted the last 10 commands we used.
history 50
The number 50 denotes the last 50 commands.We can pass any numbers.
!127
‘!’ ==> brings the command to perform that particular action now.For eg:-
127 git push -u origin master
In my history the 127th command i use to push some files to git master branch.This number is called as “Event Number“.
if i pass the above command,it perform the action on the 127th line what is previously declared.
history -d 920
-d ==> denotes deletion.
If you want to delete a particular command in the history.Use the above command line and recheck once again the history,you will see the result.
history -c
-c ==> indicates clear entire history.
It will remove your entire command history.User cannot recover this.
IMP : Be aware for using this command.
NOTE:–
Linux store every 1000 commands as default.
If you crossed above 1000 commands,it takes 1000 from your current line.
For eg:
1005 ls
i use ls command as my 1005th one.
Linux stores from 5 – 1005 as the default.
If we use “history | head“
It displays 5 – 15 as the first 10 commands.
We can modify it’s default value at any time.
Read the manual for additional commands in the history family.