2 Methods to Re-run Final Executed Instructions in Linux


Get real time updates directly on you device, subscribe now.

One of many best options of Bash is the command historical past, which shops all instructions a consumer runs, in a historical past file inside his/her dwelling listing (usually /dwelling/$USER/.bash_history). This permits the consumer to simply recall, edit and rerun earlier instructions.

On this article, we’ll reveal methods to re-execute a particular command from the historical past of instructions entered to a shell. That is helpful to keep away from typing the identical instructions again and again.

Usually, to get a command you lately run, you should use the Up arrow keys to retrieve a earlier command. Urgent it always takes you thru a number of instructions in historical past, so you will discover the one you need. Use the Down arrow to maneuver within the reverse path.

Nonetheless, the historical past file could comprise a variety of entries, to re-execute a particular command from the historical past of instructions, you may run the historical past command.

$ historical past

List Last Executed Linux CommandsList Last Executed Linux Commands

Record Final Executed Linux Instructions

Then get the quantity(s) of the command(s) you need to re-execute (if, for instance you need to restart PHP-FPM and examine its standing, it’s worthwhile to re-execute the instructions 997 and 998) as proven.

$ !997
$ !998

Re-excute Previous Commands in LinuxRe-excute Previous Commands in Linux

Re-excute Earlier Instructions in Linux

You may also re-execute beforehand used command (sudo yum replace) with ‘!’ character adopted by just a few of the primary characters (as an example sud or sudo) of that individual command as proven.

$ !sud
$ !sudo

Re-excute Previous Command Using Exclamation MarkRe-excute Previous Command Using Exclamation Mark

Re-excute Earlier Command Utilizing Exclamation Mark

For extra details about Bash historical past, see these following guides:

The Energy of Linux “Historical past Command” in Bash Shell
How one can Clear BASH Command Line Historical past in Linux
Set Date and Time for Every Command You Execute in Bash Historical past
Helpful Linux Command Line Bash Shortcuts You Ought to Know

That’s all! Bash historical past is a cool function that lets you simply recall, edit and rerun earlier instructions. If you already know different methods to re-excute the final exucuted command do share with us within the remark part.


Ask Anything

enableHover: false,
enableTracking: true,
buttons: twitter: by way of: ‘tecmint’,
click on: perform(api, choices)

share: ,
template: ‘

enableHover: false,
enableTracking: true,
urlCurl: ‘https://www.tecmint.com/wp-content/themes/tecmint/js/sharrre.php’,
click on: perform(api, choices)
// Scrollable sharrre bar, contributed by Erik Frye. Superior!
var shareContainer = jQuery(“.sharrre-container”),
header = jQuery(‘#header’),
postEntry = jQuery(‘.entry’),
$window = jQuery(window),
distanceFromTop = 20,
startSharePosition = shareContainer.offset(),
contentBottom = postEntry.offset().prime + postEntry.outerHeight(),
topOfTemplate = header.offset().prime;
shareScroll = perform(){
if($window.width() > 719)
var scrollTop = $window.scrollTop() + topOfTemplate,
stopLocation = contentBottom – (shareContainer.outerHeight() + topSpacing);
if(scrollTop > stopLocation)

else if(scrollTop >= postEntry.offset().top-topSpacing)
else if(scrollTop 1024)
topSpacing = distanceFromTop + jQuery(‘.nav-wrap’).outerHeight();
topSpacing = distanceFromTop;


Source link

Leave A Reply

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More