Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13
I read through the content on how to make permanent alias on computer. I added alias in .bashrc file. But after log out then log in, it still could not ...
  1. #1
    Just Joined!
    Join Date
    Dec 2006
    Posts
    7

    how to make permanent alias on nodes?

    I read through the content on how to make permanent alias on computer. I added alias in .bashrc file. But after log out then log in, it still could not remember that. What i should do? Is there anything else i could try? thanks a lot.

  2. #2
    Linux Guru anomie's Avatar
    Join Date
    Mar 2005
    Location
    Texas
    Posts
    1,692
    I added alias in .bashrc file. But after log out then log in, it still could not remember that.
    Well, that should work. Maybe you could post the exact alias command you put in ~/.bashrc.

  3. #3
    Just Joined!
    Join Date
    Dec 2006
    Posts
    7
    Hi, in fact, i did that. In .bashrc file, i added following things:
    alias rupme='echo `hostname -s` `uptime`'
    alias rupall=rcom rupme

    then saved it then logged out. But when i logged in again, it could not work.

  4. #4
    Linux Guru anomie's Avatar
    Join Date
    Mar 2005
    Location
    Texas
    Posts
    1,692
    Does the rupme alias at least work? If you typed it just like that (no typos), it looks correct.

    The rupall alias will not work. First, you need to single-quote the two commands. Second, what is rcom? A command or another alias?

    After logging in, type the alias command without arguments. It'll show you which aliases are currently in place for you.

  5. #5
    Just Joined!
    Join Date
    Dec 2006
    Posts
    7
    well, rcom is the command used for controlling nodes connected to main computer. I used single quote when writing alias command, but i did not write it correctly in posting news in this forum. Sorry for my mistake. But anyway, it could not work. It has no memory. There was once i asked my advisor who suggested that it could be related to my system. The nodes used system a little different from my main computer.

  6. #6
    Linux Guru anomie's Avatar
    Join Date
    Mar 2005
    Location
    Texas
    Posts
    1,692
    I should have asked this earlier, but what shell are you using? echo $SHELL

    Doing an alias with the csh-based shells is a little different.

    Also, could you post the results of the alias command and the exact contents of your ~/.bashrc file?

  7. #7
    Just Joined!
    Join Date
    Dec 2006
    Posts
    7
    I forgot to past the content after i used rupall alias on my main computer just now. It is like following:
    bash: rupme: command not found
    bash: rupme: command not found
    bash: rupme: command not found


    Could it help by any way?

  8. #8
    Linux Guru anomie's Avatar
    Join Date
    Mar 2005
    Location
    Texas
    Posts
    1,692
    Could it help by any way?
    Sure - it demonstrates that there is no alias for 'rupme' and no command called that either.

    Could you post your ~/.bashrc file?

  9. #9
    Just Joined!
    Join Date
    Dec 2006
    Posts
    7
    One thing i found is that, i could not use echo $shell on my main computer or nodes for it responded blank. The following is the content of .bashrc file:

    # .bashrc

    # User specific aliases and functions

    # Source global definitions
    if [ -f /etc/bashrc ]; then
    . /etc/bashrc
    fi

    # configuration file - MASTER NODE ONLY
    # Environmental variables

    CVS_RSH="ssh"
    CVSREAD="read"
    CVSROOT=":ext:zhangl@***.***.***.***:/home/cvs"

    export CVS_RSH CVSREAD CVSROOT
    export CUPS_SERVER=strada.***.***.***

    alias uptodate='cvs status . | grep status | grep -v "Up-to-date"'

    # Aliases for use on all machines.

    alias ls='ls --color=tty -F'
    alias dir='ls -al'
    alias dirss='ls -alF | grep "/"'
    alias new='ls -alFt | head'

    alias strada='ssh -X strada'
    alias rupme='echo `hostname -s` `uptime`'
    alias rupall='rcom rupme'
    alias cp='cp -i'
    alias grep='grep -i'
    alias mv='mv -i'
    alias rm='rm -i'

    I don't know if it can help.

  10. #10
    Linux Guru anomie's Avatar
    Join Date
    Mar 2005
    Location
    Texas
    Posts
    1,692
    It's strange, yanyan. The alias
    Code:
    alias rupme='echo `hostname -s` `uptime`'
    is syntactically legit .

    Let me ask a different question: Do the commands hostname -s and uptime work from the command line?

    P.S. (bash, sh) env variables are generally upper case. You need to use echo $SHELL

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...