GNU/Linux Command – FC

fc — Process the command history list.

FC utility used to fetch the commands from the shell command history to list, edit and re-execute. The order in the history may differ due to the number. So FC will list the commands based the time, due to this, irrespective of the number, order will maintained. NOTE: Some of the examples will try to re-execute your commands. So use it very carefully.

$ fc -- Open the last command in a editor for editing. The modifiedcommand will executed once you exit the editor. $ fc -e emacs -- Same as above. But open it in my favorite editor. $ fc -l -- Only list the commands. $ fc -l 20 40 -- List only commands from 20 to 40. $ fc -lr 20 40 -- List it in reverse order. $ fc -ln 20 40 -- Don't show the numbers in the output. $ fc 20 40 -- Open for editing and on exit, execute the commandsone by one. $ fc -s 20 40 -- Re-execute the commands with-out opening forediting.
Read: man fc

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: