Basics: Use of alias at OS level in SAP
This is not very technical information, but I have seen still lot of basis folks working on some flavor of Unix do know adequate about aliases provided by SAP and if any fix command is being used frequently then add them to the alias list to make work more simpler.
Lets see, which aliases are provided by SAP in NetWeaver based environment.
Alias | OS command |
cdAS | ‘cd /usr/sap/$SAPSYSTEMNAME/ASCS[0-9][0-9]’ |
---|---|
cdD | ‘cd /usr/sap/$SAPSYSTEMNAME/DVEBM*[0-9][0-9]’ |
cdDi | ‘cd /usr/sap/$SAPSYSTEMNAME/D[0-9][0-9]’ |
cdexe | ‘cd $_DEF_EXE2’ |
cdG | ‘cd /usr/sap/$SAPSYSTEMNAME/G[0-9][0-9]’ |
cdglo | ‘cd /usr/sap/$SAPSYSTEMNAME/SYS/global’ |
cdJ | ‘cd /usr/sap/$SAPSYSTEMNAME/J[0-9][0-9]’ |
cdJC | ‘cd /usr/sap/$SAPSYSTEMNAME/JC[0-9][0-9]’ |
cdpro | ‘cd /usr/sap/$SAPSYSTEMNAME/SYS/profile’ |
cdput | ‘cd /usr/sap/$SAPSYSTEMNAME/put’ |
cdS | ‘cd /usr/sap/$SAPSYSTEMNAME/SCS[0-9][0-9]’ |
cdT | ‘cd /usr/sap/$SAPSYSTEMNAME/TRX[0-9][0-9]’ |
dir | ‘ls -l’ |
h | ‘history’ |
hostname | ‘hostname -s’ |
l | ‘ls -abxCF’ |
pd | pushd |
pop | popd |
Pwd | ‘/bin/pwd’ |
Su | rlogin `hostname` -l |
These aliases are case sensitive, and if there will be more than one directory at the destination satisfying the regular expression [0-9][0-9]
For example if we have D00 and D10 then the command cdDi will not yield a result.
Similarly below are the aliases provide by SAP for HANA server
Alias | OS Command |
---|---|
cdexe | ‘cd /usr/sap/$SAPSYSTEMNAME/SYS/exe/run’ |
cdglo | ‘cd /usr/sap/$SAPSYSTEMNAME/SYS/global’ |
cdhdb | ‘cd /usr/sap/$SAPSYSTEMNAME/HDB[0-9][0-9]’ |
cdins | ‘cd /usr/sap/$SAPSYSTEMNAME/SYS/global/hdb/install’ |
cdpro | ‘cd /usr/sap/$SAPSYSTEMNAME/SYS/profile’ |
cdpy | ‘cd /usr/sap/$SAPSYSTEMNAME/HDB[0-9][0-9]/exe/python_support’ |
dir | ‘ls -l’ |
h | ‘history’ |
l | ‘ls -abxCF’ |
pd | pushd |
pop | popd |
Pwd | ‘/bin/pwd’ |
Su | rlogin `hostname` -l |
If we want to know where these alias has been defined, go to home directory of <sid>adm user.
Execute this $> grep alias .*
You’ll see that approximately 4 hidden environment files are there in which these aliases are defined.
.sapenv.sh
.sapenv.csh
.sapenv_<hostname>.sh
.sapenv_<hostname>.csh
.sapenv.csh | .sapenv.sh |
---|---|
alias cdexe ‘cd $_DEF_EXE2’ alias cdpro ‘cd /usr/sap/$SAPSYSTEMNAME/SYS/profile’ alias cdglo ‘cd /usr/sap/$SAPSYSTEMNAME/SYS/global’ |
alias cdexe=’cd $_DEF_EXE2′ alias cdpro=’cd /usr/sap/$SAPSYSTEMNAME/SYS/profile’ alias cdglo=’cd /usr/sap/$SAPSYSTEMNAME/SYS/global’ |
What is the difference between .csh and .sh file?
It depends on what your <sid>adm user uses are shell.
you can execute below command to know:
grep <sid>adm /etc/passwd
example
$> grep q1sadm /etc/passwd
q1sadm:x:437840:5922::/home/q1sadm:/bin/csh
This means that files with .csh will be used.
If I need to add my own aliases, In above scenario I will edit file .sapenv_<hostname>.csh
for dialog instance
alias cdW ‘cd /usr/sap/$SAPSYSTEMNAME/D[0-9][0-9]/work’
for Primary application instance
alias cdW ‘cd /usr/sap/$SAPSYSTEMNAME/DVEBM*[0-9][0-9]/work’
With this done, we need to log-out and log back in with <sid>adm, and execute cdW and it will take us directly to the work directory.
We can also add customer specific paths which are most commonly used to store backup files or installation files etc.
I know it was not a deep technical knowledge, but what I have seen playing with aliases needs to be done, its there for our help.
Thanks, for my other blogs please click on the below link
"cdtrace" is very useful one too.
Bhai !!!
You know the pulse as always 🙂
Thank you for this. Was always curious to know this in a simpler way like this.
Nice blog, cdDi only work on the Dialog Instance.
In the Dialog instance:
sishr9999:hpradm 20> cdDi
sishr9999:hpradm 21> pwd
/usr/sap/HPR/D03
In the PAS instance:
sishr8888:hpradm 15> cdDi
cdDi: Command not found.
sishr8888:hpradm 16>