• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

alias: command not found

by admin

The alias command is used to customize the shell environment by generating command-line aliases. Aliases are shorthand for longer expressions. Using aliases, you can create a short string that represents a longer command with various options and arguments. For example, you can create an alias called myls that executes the ‘ls – al’ command.

The Bash shell maintains a list of aliases that you can view by using the alias command by itself. You can also remove aliases using the unalias command. By default, aliases are only maintained for the current shell and for the user that created them. To have them persist, add the appropriate alias command to .bashrc or .bash_aliases, which is called by .bashrc.

Syntax

The syntax of the alias command is:

# alias [alias name[='command with options']

If you encounter the below error while running the alias command:

alias: command not found

you may try installing the below package as per your choice of distribution:

OS Distribution Command
OS X brew install bash
Debian apt-get install bash
Ubuntu apt-get install bash
Alpine apk add bash
Arch Linux pacman -S bash
Kali Linux apt-get install bash
CentOS yum install bash
Fedora dnf install bash
Raspbian apt-get install bash

alias Command Examples

1. List all aliases:

# alias

2. Create a generic alias:

# alias word="command"

3. View the command associated to a given alias:

# alias word

4. Remove an aliased command:

# unalias word

5. Turn `rm` into an interactive command:

# alias rm="rm --interactive"

6. Create `la` as a shortcut for `ls –all`:

# alias la="ls --all"

Filed Under: Linux

Some more articles you might also be interested in …

  1. How to uninstall ssh software package from Ubuntu
  2. reflector Command Examples in Linux
  3. “mount.nfs: access denied by server while mounting” – how to resolve
  4. rpmbuild Command Examples in Linux
  5. script: command not found
  6. ndctl Command Examples in Linux
  7. rtcwake: command not found
  8. aws codecommit: AWS CodeCommit is a managed source control service that hosts private Git repositories
  9. “az storage” Command Examples
  10. How to remove the multipath device after unmapping the storage LUN from server

You May Also Like

Primary Sidebar

Recent Posts

  • csslint: A linter for CSS code
  • csh: The shell (command interpreter) with C-like syntax (Command Examples)
  • csc: The Microsoft C# Compiler (Command Examples)
  • crystal: Tool for managing Crystal source code

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright