Skip to content

Bash history plus comment

wordpress meta

title: 'Bash History Plus Comment'
date: '2019-03-25T08:15:21-05:00'
status: publish
permalink: /bash-history-plus-comment
author: admin
excerpt: ''
type: post
id: 1334
category:
    - Bash
tag: []
post_format: []

If you like using Control-R in bash to find previous commands here is a useful tip. You can add a comment to a command and then when you use Control-R searching by typing you can find it by your comment. Example I use apt update. Run command including your comment (shell will ignore the comment of course). Then when Control-R searching type your string you used in the comment.

```  # apt update ; apt upgrade #quickupdate
</div>Now hit Control-R and type to search "quick".

<div class="wp-block-syntaxhighlighter-code ">```

(reverse-i-search)`quick': apt update ; apt upgrade #quickupdate