Tales From A Lazy Fat DBA

Den of an Oracle DB Performance freak & a fan of PostgreSQL & Cassandra …. \,,/

  • Likes

    • 152,499
  • Archives

  • Categories

  • Subscribe

  • Advertisements
  • Prashant Dixit is the FatDBA

  • Follow Tales From A Lazy Fat DBA on WordPress.com
  • My Twitter Feeds

    Error: Twitter did not respond. Please wait a few minutes and refresh this page.

  • Disclaimer!

    FatDBA or Oracle ‘Ant’ is an independent web-blog/site.The experiences, Test cases, views, and opinions expressed in this website are my own and does not reflect the views or opinions of my employer.

    This site is independent of and does not represent Oracle Corporation in any way. Oracle does not officially sponsor, approve, or endorse this site or its content.
    Product and company names mentioned in this website may be the trademarks of their respective owners.

Alias (Unix)

Posted by FatDBA on July 23, 2012

Alias:

The alias command allows you to make new shortcuts and synonyms for commonly used commands.

Alias settings resets every time you reboots or switch users in Unix. There are number of ways/methods to permanently save Alias in your machine. Below discussed is one of the most common way to fix alias settings to make them global and always available.

1. Edit your bash profile (If using Bash Shell) and add all alias you want to set.

[root@localhost /]# gedit /etc/bashrc
(Below are excerpts from a live bashrc profile from one of my machine)

# /etc/bashrc

# System wide functions and aliases
# Environment stuff goes in /etc/profile

alias base=’cd /u01/app/oracle’
alias c=’clear’
alias home=’cd /u01/app/oracle/product/10.2.0/db_1′
alias sql=’sqlplus / as sysdba’
alias sid=”echo $ORACLE_SID”

# By default, we want this to get set.
# Even for non-interactive, non-login shells.

2. Add source /etc/bashrc to your ~/.bashrc profile.

[root@localhost /]# gedit ~/.bashrc

Will look like —

# .bashrc
# User specific aliases and functions

alias rm=’rm -i’
alias cp=’cp -i’
alias mv=’mv -i’
source /etc/bashrc

# Source global definitions

 

Enjoy The Shortcuts using ‘alias’ — Below is one of alias used to reach directory – ORACLE_BASE using alias named ‘base’.

[root@localhost ~]# base

[root@localhost oracle]# pwd
/u01/app/oracle
[root@localhost oracle]#

Advertisements

One Response to “Alias (Unix)”

  1. GREAT publish and impressive in turn …will bear a try all the tips..Thanks……

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: