LinuxCommandLibrary

abbr

Define and expand command abbreviations

TLDR

Add a new abbreviation

$ abbr [[-a|--add]] [abbreviation_name] [command] [command_arguments]
copy

Rename an existing abbreviation
$ abbr --rename [old_name] [new_name]
copy

Erase an existing abbreviation
$ abbr [[-e|--erase]] [abbreviation_name]
copy

Import the abbreviations defined on another host over SSH
$ ssh [host_name] abbr [[-s|--show]] | source
copy

SYNOPSIS

abbr [options] abbreviation expansion

PARAMETERS

add
    Add or define a new abbreviation.

delete
    Delete an existing abbreviation.

list
    List all defined abbreviations.

DESCRIPTION

The `abbr` command, typically implemented as a shell function rather than a standalone executable, is used to define and expand abbreviations in your shell environment. It allows you to create short aliases for longer, more complex commands or phrases. When the shell encounters a defined abbreviation, it's automatically replaced with its expanded form before execution. This can save significant typing and improve command-line efficiency, particularly for frequently used commands or option sequences. The specific syntax and implementation details vary depending on the shell (e.g., Bash, Zsh, Fish), but the core functionality remains the same: a user-defined mapping between a short string (the abbreviation) and a longer string (the expansion). The abbreviation remains active only within the current shell session unless explicitly saved to a configuration file like `.bashrc` or `.zshrc` to persist across sessions. Note: It's typically not a standard Linux utility and is most often implemented as a shell function. The tool typically allows to add, delete and list defined abbreviations.
Check your shell's documentation for exact usage.

CAVEATS

Since `abbr` is often implemented as a shell function, its availability and syntax might differ across shells. It's not a universally available Linux command.

SHELL-SPECIFIC IMPLEMENTATION

The `abbr` command is commonly implemented as a shell function or a shell script, and is often integrated into shell frameworks or plugins. How you use it depends on your specific shell environment. Therefore consult your shell's (e.g. zsh, bash, fish) documentation and settings to check if the `abbr` command is available and how to configure it.

HISTORY

The `abbr` functionality has evolved primarily as a shell scripting feature within various shells like Bash, Zsh, and Fish. It's designed as a practical shortcut for users to reduce typing effort and improve workflow on the command line. There is no central development or official specification. Different shells provide different ways to implement the command.

SEE ALSO

alias(1)

Copied to clipboard