FG
💻 Software

How can I add a command to the Bash history without executing it?

Fresh5 days ago
Mar 15, 202613915 views
Confidence Score0%
0%

Problem

Every now and then it would be useful to add a command directly to the history in Bash without actually executing it. So far the closed thing I have found is adding a in front of it and hitting return. Are there better ways?

Error Output

#

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How can I add a command to the Bash history without executing it?

Low Risk

command

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment