Creating global alias

Posted on 2006-04-06
Medium Priority
Last Modified: 2013-11-17
How do you create permanent aliases for all users in 5.2?

I want these two:

PDC # alias ccllive='cd /...... bla ....../livescripts'
PDC # alias ccltest='cd /...... bla ....../testscripts'

I created the aliases under root, but the users can't run the aliases.
Question by:JohnLucania
LVL 14

Assisted Solution

sjm_ee earned 400 total points
ID: 16391987
"alias" is a shell command. If you want a shell command to be excuted by all users when they login, then you can put it in /etc/profile. But settings made by alias are not replicated in child processes. Also, not all users have to use the same shell. So the general answer to your question will be somewhat complicated. You would have to create a .profile for each user which the user cannot change pointing to a similarly protected korn shell profile which sets the aliases. If I have time I will experiment and post back if I find the way.

Author Comment

ID: 16392764
For each user, do you mean this?

PDC # vi .profile
".profile" 9 lines, 254 characters


export PATH

if [ -s "$MAIL" ]           # This is at Shell startup.  In normal
then echo "$MAILMSG"        # operation, the Shell checks
fi                          # periodically.
alias ccllive='cd /...bla.../livescripts'
alias ccltest='cd /...bla.../testscripts'


Assisted Solution

arkoak earned 400 total points
ID: 16393140
create another *.rc file in the root directory with execute permissions.
now add this file to be executed in all users .profile file

so whatever you will add in this single *.rc file, that will be effective for all users.

LVL 62

Accepted Solution

gheist earned 1200 total points
ID: 16393632
set aliases in /etc/profile

make sure /etc/profile and ~/.profile are not interactive - cron uses them and will hang on asked input.

Have fun.

for csh (not bask/ksh/sh) you have to include file into users .cshrc file, hope you do not have such users.

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses
Course of the Month12 days, 19 hours left to enroll

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question