Command history, editing, and substitution

  • Shell sessions can be viewed as a conversation. History, expansion, and editing make that dialog more productive.

  • Commands can be reissued, modified, and edited. Examples are shown in Table 10-3.

  • Command substitution allows the result of a command to be placed into a shell variable.

Table 10-3. Shell expansion, editing, and substitution examples

History type





Ctrl-P, previous line


Ctrl-K, kill to end of line


Ctrl-Y, paste (yank) text


VAR=$(command) or VAR='command'

Get LPI Linux Certification in a Nutshell, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.