Every argument that you enter with the minibuffer is saved on a minibuffer history list so that you can use it again later in another argument. Special commands load the text of an earlier argument in the minibuffer. They discard the old minibuffer contents, so you can think of them as moving through the history of previous arguments.
The simplest way to reuse the saved arguments in the history list is
to move through the history list one element at a time. While in the
minibuffer, type M-p (
previous-history-element) to "move
to" the next earlier minibuffer input, and use M-n
next-history-element) to "move to" the next later input.
The previous input that you fetch from the history entirely replaces the contents of the minibuffer. To use it as the argument, exit the minibuffer as usual with RET. You can also edit the text before you reuse it; this does not change the history element that you "moved" to, but your new argument does go at the end of the history list in its own right.
There are also commands to search forward or backward through the
history. As of this writing, they search for history elements that
match a regular expression that you specify with the minibuffer.
previous-matching-history-element) searches older
elements in the history, while M-s
next-matching-history-element) searches newer elements. By
special dispensation, these commands can use the minibuffer to read
their arguments even though you are already in the minibuffer when you
All uses of the minibuffer record your input on a history list, but
there are separate history lists for different kinds of arguments. For
example, there is a list for file names, used by all the commands that
read file names. There is a list for arguments of commands like
query-replace. There are several very specific history lists,
including one for command names read by M-x and one for
compilation commands read by
compile. Finally, there is one
"miscellaneous" history list that most minibuffer arguments use.