Difference between revisions of "Bash: alias"

From wikieduonline
Jump to navigation Jump to search
 
(55 intermediate revisions by 7 users not shown)
Line 4: Line 4:
 
* Execute <code>alias</code> to display your aliases
 
* Execute <code>alias</code> to display your aliases
  
  alias [[trim]]="awk ' {\$1=\$1} 1 '"
+
  touch [[~/.bash_aliases]]
 
alias g="grep"
 
alias gi="grep -i"
 
alias gv="grep -v"
 
  
alias la="ls -la"
 
 
alias NF="awk '{print \$NF}'"
 
 
alias [[sourceprofile]]="[[source]] ~/[[.bash_profile]]"
 
alias [[zsourceprofile]]="source [[.zprofile]]"
 
 
alias p8="ping 8.8.8.8"
 
 
alias mp="[[multipass]]"
 
alias mp_l="[[multipass list]]"
 
alias mp_la="[[multipass launch]]"
 
alias mp_launch="[[multipass launch]]"
 
alias mp_find="[[multipass find]]"
 
alias mp_f="[[multipass find]]"
 
alias mpc="multipass connect"
 
 
 
alias [[viconfig]]="vi ~/[[.ssh/config]]"
 
 
alias [[awswhoiam]]="[[aws iam get-user]]"
 
  
 
== Related terms ==
 
== Related terms ==
* [[shell functions]]
+
* [[Shell functions]]
 
* <code>[[ifconfig]]</code> and [[IP]] alias address
 
* <code>[[ifconfig]]</code> and [[IP]] alias address
 
* <code>[[.bashrc and .bash profile]]</code>
 
* <code>[[.bashrc and .bash profile]]</code>
 
* <code>[[source]]</code>
 
* <code>[[source]]</code>
 
* <code>[[aws list all]]</code>
 
* <code>[[aws list all]]</code>
* <code>[[suaws]]</code> alias
+
* <code>[[suaws]]</code> [[Bash shell functions|function]]
 
* <code>[[.zprofile]]</code>
 
* <code>[[.zprofile]]</code>
 
* <code>[[viprofile]]</code>
 
* <code>[[viprofile]]</code>
 
* [[Append a space]]
 
* [[Append a space]]
 +
* <code>[[bash]]: [[compdef]]: [[command not found]]</code>
 +
* <code>[[shopt -s expand_aliases]]</code>
 +
* <code>[[export -f]]</code>
 +
* <code>  sed s/'^'/'\<code\>'/ | sed s/'$'/'\<\/code\>'/    </code>
  
 
== See also ==
 
== See also ==

Latest revision as of 09:25, 13 February 2024

alias does not accept parameters but a function can be called just like an alias, according to official documentation "for almost every purpose, shell functions are preferred over aliases" [1]

Examples[edit]

  • Execute alias to display your aliases
touch ~/.bash_aliases


Related terms[edit]

See also[edit]

  • https://www.gnu.org/software/bash/manual/bash.html#Aliases
  • Advertising: