Skip to content

Instantly share code, notes, and snippets.

@neyhart
Forked from gdellicarpini/aliases_centos.md
Created November 1, 2019 11:39
Show Gist options
  • Save neyhart/1a800f49f46b9193c36d12723a1453fa to your computer and use it in GitHub Desktop.
Save neyhart/1a800f49f46b9193c36d12723a1453fa to your computer and use it in GitHub Desktop.
Add permanent aliases in Linux CentOS

Aliases for all users

  • Create a file in /etc/profile.d/ directory

      - myAlias.sh
    
  • Define the alias in the file

      alias gotoserver1="ssh [email protected]"
    
  • Give right permission to the file

      chmod 755 myAlias.sh
    
  • Restart SSH session exiting terminal and opening a new one (or use source /etc/profile.d/myAlias.sh)

Alias for a specific user

  • To create an alias permanently add the alias to your .bashrc file

      sudo vi ~/.bashrc
    
  • And then add your alias at the bottom

      alias ls="ls -l"
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment