The abbr command in the Fish shell is used to create or modify an abbreviation, which is a shortcut for a longer command or sequence of commands. For example, you can use the abbr command to create an abbreviation for a frequently used command, such as ls -l:
$ abbr ll 'ls -l'
Now, every time you type ll in the Fish shell, it will be expanded to ls -l. You can also use the abbr command to create an abbreviation for a sequence of commands by enclosing the commands in quotes and separating them with semicolons:
$ abbr update 'sudo apt update; sudo apt upgrade'
Now, typing update in the Fish shell will execute the two commands sudo apt update and sudo apt upgrade in sequence. To view the list of all abbreviations currently defined in the Fish shell, you can use the abbr command with no arguments:
$ abbr
For more information about the abbr command and its usage, you can consult the Fish shell documentation or run the command man abbr to view the abbr manual page.
abbr Command Examples in fish-shell
1. Add a new abbreviation:
$ abbr --add {{abbreviation_name}} {{command}} {{command_arguments}}
2. Rename an existing abbreviation:
$ abbr --rename {{old_name}} {{new_name}}
3. Erase an existing abbreviation:
$ abbr --erase {{abbreviation_name}}
4. Import the abbreviations defined on another host over SSH:
$ ssh {{host_name}} abbr --show | source