Short Tip: Create a “bash alias” with an argument

I always check for changes in rpm files. Unfortunately, the command to do so needs some typing:

rpm -q --changelog PACKAGENAME|most

(Btw., most is a replacement for less). The best idea would be to have a bash/zsh/whatever alias with an argument. This is unfortunately difficult or even impossible, but it is quite easy to define a simple function:

rpmch () { rpm -q --changelog "$1"|most;}

Copy that string to your .zshrc or .bashrc and you can easily query the changelog of rpm packages with the command


This of course works for other commands as well.

11 thoughts on “Short Tip: Create a “bash alias” with an argument”

  1. Assuming you are using, and putting up with, `most` for the color ability, I suggest adding

    if [[ -x ` which less` ]]
    export LESSCHARSET="utf-8"
        export PAGER="less"
        if [ $terminfo[colors] -ge 8 ]
            export LESS_TERMCAP_mb=$'\E[01;31m'
            export LESS_TERMCAP_md=$'\E[01;31m'
            export LESS_TERMCAP_me=$'\E[0m'
            export LESS_TERMCAP_se=$'\E[0m'
            export LESS_TERMCAP_so=$'\E[01;44;33m'
            export LESS_TERMCAP_ue=$'\E[0m'
            export LESS_TERMCAP_us=$'\E[01;32m'
        export PAGER="more"

    to your RC files

  2. RichH, actually I’m using most because it shows me on which line I am. And it always reminds me how to find the help 🙂
    Anyway, what would happen when i use the commands above?

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.