HISOTRY Command In linux there is a very useful command to show that have been recently used.
The command is simply called history, In other way you can also looking at your .bash_history in your home folder.
Usage
First, connect to your server via SSH.
Let's start with the simple command:
[root@skymet ~]# history 
If you want to see last used command used in own console so you can just use it history . 
[root@skymet ~]# history
   10  mkdir may
   11  ls
   16  ls  | grep 'Rajasthan'  
   17  mv 'Rajasthan' may/ 
   18  ls
   19  cd may/
   20  ls
   21  cd ..
   22  ls
   23  mv |  grep | 'Rajasthan' may/
   42  cd ..
   43  ls
   44  scp -r May_2017/ root@192.168.103.66:/media1/common/rajasthan_csv/uploaded_csv
   45  exit
   46  ssh root@192.168.103.66
   47  clear
   48  cd
   49  clear
   50  ssh root@192.168.103.86
   51  clear
   52  exit
More ways to use the command
you wish to view the history one page at a time
[root@skymet ~]# history | less 
If you want to view just the last ten commands, you can use the following:
[root@skymet ~]# history  |  tail 
if you want to view the last 30 commands.
[root@skymet ~]#history 30 
No comments:
Post a Comment