Ubuntu Tutorials - Herong's Tutorial Examples - v1.25, by Herong Yang
Shell Session Command History
This section provides a tutorial example on how to use Bash shell command history functionalities.
Another nice feature of Bash is the session command history, which records every command you entered in an interactive session. Using this command history, Bash provides the following functionalities:
Here is an example of how to view and re-run past commands.
herong$ history ... 2002 top 2003 ps -e 2004 ps -e -o pid,euser,%cpu,%mem,rss,drs,trs,sz,vsz,comm 2005 ps -e --sort rss -o pid,euser,%cpu,%mem,rss,drs,trs,sz,vsz,comm 2006 ps -e --sort -rss -o pid,euser,%cpu,%mem,rss,drs,trs,sz,vsz,comm 2007 history herong$ !2006 PID EUSER %CPU %MEM RSS DRS TRS SZ VSZ COMMAND 2330 herong 0.7 5.7 212348 4287442 13 1071864 4287456 gnome-shell 9323 herong 0.2 5.1 189428 4951095 119740 1267709 5070836 atom 9384 herong 0.2 5.1 189284 4976335 119740 1274019 5096076 atom 26649 herong 0.0 4.8 180500 931929 3790 233930 935720 update-manager 2666 herong 0.0 4.4 166892 1344245 946 336298 1345192 gnome-software 23305 herong 0.0 3.7 138136 530617 3790 133602 534408 apport-gtk 20386 herong 0.0 2.3 87556 1514653 4398 379763 1519052 gnome-control-c 9458 herong 0.0 2.1 78364 4620995 119740 1185184 4740736 atom 2202 herong 0.7 1.6 60468 1046175 2308 262121 1048484 Xorg ...
Table of Contents
Introduction to Ubuntu Systems
GNOME - Desktop Interface and Environment
►Shell - The Command-Line Interpreter
What Is Bash (Bourne Again SHell)
Bash Command Line Interpretation Steps
Bash Shell Session Customization
Command Input/Output Redirection
►Shell Session Command History