Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8090809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T19:50:39+00:00 2026-06-05T19:50:39+00:00

Just a question to improve my bash skills. I always do this: $ history

  • 0

Just a question to improve my bash skills. I always do this:

$ history | grep some_long_command

...
...
123 some_long_command1.........
124 some_long_command2.........
...

I can then run the command the command I found by doing:

!123

However, I often want to do this:

some_long_command1foobar

I.e. change the command before I run it. Can you use bash to run this command instead:

#some_long_command1

so it gets commented.

Then I don’t have to use my mouse to highlight the command, edit it and then run it (I can just use the keyboard – faster).

I suppose I could write a script to do it but there might already be functionality built in somewhere….?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T19:50:41+00:00Added an answer on June 5, 2026 at 7:50 pm

    I’d suggest instead of using the history command, you use ctrl+r and start typing that command. When you press an arrow key as if to go to modify it, it will drop out of autocomplete recognition, and will let you edit before running.

    UPDATE: also, if you want to cycle through the different commands that contain the string you just typed, keep on pressing ctrl+r

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is just a technical question to improve my understanding of OS architecture. I
This isn't a direct question, but more a question on how I can improve
Is there any way to improve ScrollView performance? This is just a theoretical question
This is just a question on how to write my code for a COM
this is just theoretical question. I use JDBC with my Java applications for using
This is just a question is it possible to create a hr tag in
I have just a question... I'm seeing this coding style in various php scripts
Please do not mark it as a dupe of this question just yet: Bold
I was configuring IPtable yesterday. My colleague just asked me this question, and I
Following this question , I've met another problem where the request just doesn't go

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.