AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.

 View Only
  • 1.  Question about alias command in AIX

    Posted Tue November 17, 2009 04:55 PM

    Originally posted by: Jeremy UCSDMC


    I'm new to the alias command and others use it very successfully at our organization. I see we have a bunch of alias defined already for root and would like to know where I define these if anyone knows. Is there a file that I can edit to add each alias command? Here is what root has currently and it isn't in his .profile or in any file that other websites have pointed me to. Help?

    • ROOT on mc-erel ***
    /usr/bin -> alias
    autoload='typeset -fu'
    babin='cd /usr/tivoli/tsm/client/ba/bin'
    bld='csession bld -U "BLD" "^%ZdALTE"'
    ccon=/usr/bin/ccontrol
    cds='cd /nfs/scripts'
    clshowsrc='/usr/es/sbin/cluster/utilities/clshowsrv -v'
    command='command '
    disable_user='chuser account_locked=true login=false'
    dscli='/opt/ibm/dscli/dscli -cfg /opt/ibm/dscli/profile/ucsd_dscli.profile'
    ec=/epic/bin/epiccontrol
    ecd='csession ecd -U "ECD" "^%ZdALTE"'
    em=/epic/bin/epicmenu
    functions='typeset -f'
    grep=/usr/bin/grep
    ha_pass='/usr/es/sbin/cluster/cspoc/fix_args nop cl_chpasswd -cspoc -f -r'
    has='/usr/es/sbin/cluster/utilities/clshowsrv -v'
    hash='alias -t -'
    history='fc -l'
    htail='tail -f -n 100 /var/hacmp/log/hacmp.out'
    ibd='csession ibd -U "IBD" "^%ZdALTE"'
    integer='typeset -i'
    itst='csession itst -U "ITST" "^%ZdALTE"'
    local=typeset
    ls=/usr/bin/ls
    mdrc='csession mdrc -U "PRD"'
    mdrp='csession mdrp -U "PRD"'
    mdrv='csession mdrv -U "PRD"'
    mtrn='csession mtrn -U "MTRN" "^%ZdALTE"'
    nohup='nohup '
    pq='pcmpath query'
    prd='csession prd -U "PRD" "^%ZdALTE"'
    pskill='ps -o %u:%p:%a -ef'
    psup='csession psup -U "PSUP" "^%ZdALTE"'
    r='fc -e -'
    reset_user='chsec -f /etc/security/lastlog -a "unsuccessful_login_count=0" -s'
    restart_ssh='stopsrc -s sshd; startsrc -s sshd'
    rlt='csession rlt -U "RLT" "^%ZdALTE"'
    rm='rm -i'
    shd='csession shd -U "PRD" "^%ZdALTE"'
    stop='kill -STOP'
    suspend='if [ ${0#-} = $0 ] ; then kill -STOP $$; else dspmsg -s 1 ksh.cat SUS
    PEND "suspend: cannot suspend login shell
    "; fi '
    trn='csession trn -U "TRN" "^%ZdALTE"'
    tst='csession tst -U "TST" "^%ZdALTE"'
    tstail='tail -f -n 100 /usr/tivoli/tsm/client/ba/bin/dsmsched.log'
    ttail='tail -f -n 100 /usr/tivoli/tsm/client/ba/bin/dsmerror.log'
    type='whence -v'
    vi=/usr/bin/vi

    • ROOT on mc-erel ***
    /usr/bin ->


  • 2.  Re: Question about alias command in AIX

    Posted Tue November 17, 2009 06:07 PM

    Originally posted by: The_Doctor


    usually you'll find the "alias" commands set up in your > $HOME/.kshrc < file.

    and the ENV variable in your .profile will read something like --> export ENV=$HOME/.kshrc

    there are probably other methods, but the above is what I generally consider the accepted practice.

    hope that helps


  • 3.  Re: Question about alias command in AIX

    Posted Tue November 17, 2009 06:09 PM

    Originally posted by: The_Doctor


    sorry for the strike out.....

    the file should read ---> $HOME/.kshrc


  • 4.  Re: Question about alias command in AIX

    Posted Tue November 17, 2009 08:17 PM

    Originally posted by: Jeremy UCSDMC


    Thanks for the quick response. However, I'm striking out on finding that file for any user account. What directory is it located in? Also, I'm looking at all of the .profiles for root and my user account and do not see that there is an entry specifying that. Here is my .profile and they are not in here yet they work for me when I type alias, they come up:

    PATH=/epic/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin
    export PATH
    if # This is at Shell startup. In normal
    then echo "$MAILMSG" # operation, the Shell checks
    fi # periodically.

    ##########################################################
    1. UCSD Specific Entries
    ##########################################################

    set -o vi

    1. Prompt
    HN=`uname -n`
    export PS1='
    $USER@$HN
    $PWD -> '

    PATH=$PATH:/epic/bin
    LANG=en_US
    export LANG

    1. Aliases
    alias rm="rm -i"

    1. Pick Up Purpose Driven profile
    if ; then
    echo "\nSourcing TSM .profile..."
    . /.profile.tsm
    elif ; then
    echo "\nSourcing NIM .profile..."
    . /.profile.nim
    elif ; then
    echo "\nSourcing Old TSM/NIM .profile...\n"
    . /.profile.tsm_old
    else
    echo "\nSourcing Epic .profile..."
    . /.profile.epic
    fi


  • 5.  Re: Question about alias command in AIX

    Posted Wed November 18, 2009 02:49 AM

    Originally posted by: Montecarlo


    Hi Jeremy,
    2 points
    1. When I was in field support I was extremely wary of customers with root ailases. I believe that it is bad practice to modify the behavior of the root account in any way. I've seen it cause problems (trivial to serious) when people unaware of the modifications used the root account for support or problem determination purposes. If you must have aliases, set them in your own account then su root (without the '-'). This will give you root privilege with your own environment settings.
    2. If you can't find the aliases in root's profile they may have been set in /etc/profile or somewhere similar. Once again, this is not a practice I'm fond of. I accept that modification of the environment is necessary for specific processes or tasks but question whether all users of the system require the same modification.
    Regards, Simon


  • 6.  Re: Question about alias command in AIX

    Posted Wed November 18, 2009 07:09 AM

    Originally posted by: nh4aix


    Looks to me like you should look in each of the purpose driven files:

    Pick Up Purpose Driven profile
    if ; then
    echo "\nSourcing TSM .profile..."
    . /.profile.tsm
    elif ; then
    echo "\nSourcing NIM .profile..."
    . /.profile.nim
    elif ; then
    echo "\nSourcing Old TSM/NIM .profile...\n"
    . /.profile.tsm_old
    else
    echo "\nSourcing Epic .profile..."
    . /.profile.epic
    fi

    each of those is being sourced into the current environment ...

    You could also try a brute force search... would recommend it for off-production hours...
    for i in `find /
    do
    grep autoload $i # or one of the other more unique alias names...
    done

    Good Luck,
    joe


  • 7.  Re: Question about alias command in AIX

    Posted Tue November 24, 2009 07:36 PM

    Originally posted by: Jeremy UCSDMC


    Thanks, I have figured it out. I spoke with a staff member and since we are running a captive login menu, it spawns another shell session and we can't really setup alias commands in the same way if at all. I configured a menu item on the captive login menu to run the unix command I need for general users of the system. Thanks for all of the great answers!

    -J