How to list history commands using 'fc' in Linux

In UNIX like Operating System to check the executed command history us can use command called "history" which you may aware but there is another command called “fc”, the command 'fc' (stands for find command) can be used as an alternative to 'history'.
“fc”  is a Bash a built-in command in Unix and  using this we can list only the selected number of last executed commands.
For example, if you want to list only last 10 commands, the syntax will be  "fc -l -20".
Below  is a sample execution:
root@TecGeeks:~# fc -l -10
1548 tree -iLf 1 nagios-4.2.1
1549 ls
1550 ls iso_images/
1551 ls nagios-plugins-2.1.2
1552 tree -iLf 1 nagios-4.2.1
1553 clear
1554 tree -help
1555 man tree
1556 fc -l 3
1557 fc -l -3
root@TecGeeks:~#
How to list history commands using 'fc' in Linux How to list history commands using 'fc' in Linux Reviewed by TecGeeks News on April 27, 2017 Rating: 5

No comments:

Get Your Business Online Now


Powered by Blogger.