Creating global alias

Posted on 2006-04-06
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

    "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

    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'

    LVL 8

    Assisted Solution

    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 61

    Accepted Solution

    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

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap ( Version 1.2 2.      Jpcap( Version 0.6 Prerequisite: 1.      GCC …
    FreeBSD on EC2 FreeBSD ( is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
    Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
    In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now