Creating a folder path alias in Unix/Linux !!!
In unix/linux navigating through a long folder path repetitively is bit painful task and takes a bit time when you have large number of severs to manage and perform administration task.
In such situation creating folder path alias is the best way to create abbreviated shortcuts and change folder path quickly without navigating through whole path.
In this very simple article instruction will be given how to create folder alias for a particular folder path and change directory easily without navigating to whole path.
Below are the steps required to create folder alias-
1) List out the long folders path which you need to navigate frequently
2) Write down the abbreviated name for each long folder path
3) Update .bashrc and .profile file
4) Load the .profile file for particular os user.
5) Use the abbreviated value to cd to that long folder path
For example purpose, I have listed out below long most used folders path for implementation –
Abbreviated value Long folder path
Long folder path
Folder alias can be updated either directly in .profile or .bashrc file for a particular os user. The test environment where I have implemented this I have created folder alias inside .bashrc file located inside particular os user home folder.
So, e.g. sample os user name is ‘oracle’ the .bashrc file must exist at this location /home/oracle/. If .bashrc file does not exist then admin can create this file as well using vi editor.
Add below entries into .bashrc file
alias aserver='cd ~/../../u01/app/oracle/admin/domains/aserver/prd_domain
alias mserver='cd ~/../../u01/app/oracle/admin/domains/mserver/prd_domain
alias fmw='cd ~/../../u01/app/oracle/product/fmw
alias cluster='cd ~/../../u01/app/oracle/admin/domains/cluster
alias alog='cd ~/../../u01/app/oracle/admin/domains/aserver/domain/servers/AdminServer/logs
alias mlogs='cd ~/../../u01/app/oracle/admin/mserver/domains/servers
alias logs='cd ~/../../u01/app/oracle/admin/cluster/logs
Now, update .profile file for same user to load .bashrc file
Now load the .profile file for ‘oracle’ user.
Use putty to login using oracle user, after successful login, it will land ‘oracle’ user home directory, run below command
Once you run the above command, oracle user profile will be loaded which will set all the folders path alias.
Now, we can use the abbreviated value to access particular folder.
e.g. to access this path ‘/u01/app/oracle/product/fmw’ just type this abbreviated value ‘fmw’ as per below snap.