How do I ignore bash shell aliases or functions when running a command without removing alias or function from memory or current shell session on a Linux or Unix-like systems?

An alias  is nothing but shortcut to commands. The alias command allows the user to launch any command or group of commands (including options and filenames) by entering a single word. Aliases are mainly used to abbreviate a system command or add default arguments to a regularly used command.

ADVERTISEMENTS

To view defined aliases the following commands can be used:

Run:

$ alias

My bash aliases:

alias cp='cp -i'
alias l='ls $LS_OPTIONS -lA'
alias ll='ls $LS_OPTIONS -l'
alias ls='ls $LS_OPTIONS'
alias mv='mv -i'
alias rm='rm -i'
alias apt-get='apt-get update && apt-get upgrade'

Bash shell ignore aliases or functions when running a command

Simply use a command called command as follows to ignore aliases or functions. For example, on my system I’ve following aliases set:

alias apt-get='apt-get update && apt-get upgrade'

To ignore apt-get alias, enter:

command apt-get -y install nginx

Ignoring bash aliases and functions

You can also use any one of the following syntax too:

**\**``apt-get -y install apache2

**"**``apt-get``**"**`` -y install htop

Both ** and " symbols allows you to run real apt-get command (or apt command if alias defined) and ignore apt-get/apt alias at the CLI.

#function

Bash Shell Ignore Aliases & Functions When Running Command
2.55 GEEK