Reputation: 15
Hi I'm trying to implement a shell on linux and I'm suppose to line up the last 10 commands in the shell's history.
I'm using system("cat ~/.bash_history");
command but I dont know how to bring up just last 10 commands.
Thanks in advance
Upvotes: 0
Views: 285
Reputation: 1729
Try tail command and -n is number of last lines,
system("tail -n 10 ~/.bash_history");
Upvotes: 1