.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "ALIAS" "1" "Nov 13, 2025" "4.2" "fish-shell" .SH NAME alias \- create a function .SH SYNOPSIS .nf \fBalias\fP \fBalias\fP [\fB\-\-save\fP] \fINAME\fP \fIDEFINITION\fP \fBalias\fP [\fB\-\-save\fP] \fINAME\fP\fB=\fP\fIDEFINITION\fP .fi .sp .SH DESCRIPTION .sp NOTE: This page documents the fish builtin \fBalias\fP\&. To see the documentation on any non\-fish versions, use \fBcommand man alias\fP\&. .sp \fBalias\fP is a simple wrapper for the \fBfunction\fP builtin, which creates a function wrapping a command. It has similar syntax to POSIX shell \fBalias\fP\&. For other uses, it is recommended to define a \fI\%function\fP\&. .sp If you want to ease your interactive use, to save typing, consider using an \fI\%abbreviation\fP instead. .sp \fBfish\fP marks functions that have been created by \fBalias\fP by including the command used to create them in the function description. You can list \fBalias\fP\-created functions by running \fBalias\fP without arguments. They must be erased using \fBfunctions \-e\fP\&. .INDENT 0.0 .IP \(bu 2 \fBNAME\fP is the name of the alias .IP \(bu 2 \fBDEFINITION\fP is the actual command to execute. \fBalias\fP automatically appends \fB$argv\fP, so that all parameters used with the alias are passed to the actual command. .UNINDENT .sp You cannot create an alias to a function with the same name. Note that spaces need to be escaped in the call to \fBalias\fP just like at the command line, \fIeven inside quoted parts\fP\&. .sp The following options are available: .INDENT 0.0 .TP \fB\-h\fP or \fB\-\-help\fP Displays help about using this command. .TP \fB\-s\fP or \fB\-\-save\fP Saves the function created by the alias into your fish configuration directory using \fI\%funcsave\fP\&. .UNINDENT .SH EXAMPLE .sp The following code will create \fBrmi\fP, which runs \fBrm\fP with additional arguments on every invocation. .INDENT 0.0 .INDENT 3.5 .sp .EX alias rmi=\(dqrm \-i\(dq # This is equivalent to entering the following function: function rmi \-\-wraps rm \-\-description \(aqalias rmi=rm \-i\(aq rm \-i $argv end .EE .UNINDENT .UNINDENT .sp \fBalias\fP sometimes requires escaping, as you can see here: .INDENT 0.0 .INDENT 3.5 .sp .EX # This needs to have the spaces escaped or \(dqChrome.app...\(dq # will be seen as an argument to \(dq/Applications/Google\(dq: alias chrome=\(aq/Applications/Google\e Chrome.app/Contents/MacOS/Google\e Chrome\(aq .EE .UNINDENT .UNINDENT .SH SEE MORE .INDENT 0.0 .IP 1. 3 The \fI\%function\fP command this builds on. .IP 2. 3 \fI\%Functions\fP\&. .IP 3. 3 \fI\%Defining aliases\fP\&. .UNINDENT .SH COPYRIGHT fish-shell developers .\" Generated by docutils manpage writer. .