Difference between revisions of "Bash: alias"

From wikieduonline
Jump to navigation Jump to search
Line 39: Line 39:
 
  alias [[awswhoiam]]="[[aws iam get-user]]"
 
  alias [[awswhoiam]]="[[aws iam get-user]]"
  
  [[viprofile]] () { vi ~/.bash_profile }
+
  #[[viprofile]] () { vi ~/.bash_profile }
  
 
== Related terms ==
 
== Related terms ==

Revision as of 11:27, 10 August 2022

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

  • Execute alias to display your aliases
alias trim="awk ' {\$1=\$1} 1 '"
source <(kubectl completion zsh)
source <(k9s completion zsh)
alias k="kubectl"

alias g="grep"
alias gi="grep -i"
alias gv="grep -v"
alias la="ls -la"
alias NF="awk '{print \$NF}'"
alias srcprofile="source ~/.bash_profile"
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 viawsconfig="vi ~/.aws/config"

alias awswhoiam="aws iam get-user"
#viprofile () { vi ~/.bash_profile }

Related terms

See also

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