Announcement

Collapse
No announcement yet.

(Linux help) alias an ip address

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Najim
    replied
    well follow what Schahzad mentioned by creating a small script & then
    type "cd" (you will not see any output, & it will give u the prompt again)& then type "pwd". Keep note of the output of pwd command, it should be

    /home/UR-USER-ID
    /export/UR-USER-ID

    lets say its

    /home/shahzadqu

    open ur .profile file or .bash_profile (depending upon the shell u use).

    Add these lines

    PATH=$PATH:/home/shahzadqu
    export PATH

    press : & type wq! after that.

    Relogin, & u dont have to force start ur script. Just type the script name.

    Leave a comment:


  • schahzad
    replied
    host :bind

    means
    System first try to resolve the name to ip from host file and if it didnt found it lll tyr bind (DNS) to find the ip address of foo.

    If you dont any any entery in both places it wont let you do that.
    if problem is only "every time".Then better to use script

    shell$ vi footelnet
    (it ll open a new file press i to insert)

    telnet ur.ip.address

    (press escape key and then wq! to write and quite from file)

    this ll creat a file with name footelnet whicl ll have a line

    telnet ur.ip.address

    jnow u need to make this file executeable.

    shell$ chmod 755 footelnet

    you are done, now every time u just need to

    shell$ ./footelnet
    it ll do what u want.Also u can copy this file to /usr/bin/ to access from any where if this script is in /usr/bin/ you can type any where

    shell$ footelnet

    and it ll do same thing.

    Please let us know if u doesnt understand any thing in up procedure.hopes its what u need

    Leave a comment:


  • shahzadqu
    replied
    thanks for the replies Umar Talib and soft_friend

    the problem with editing /etc/hosts file is that i dont' have permissions to do so. im a user on the system, not root. by the way, i didnt' even know i could do that, thanks

    and wut u suggested soft_friend, that doesn't work. I tried both (alias in .bashrc and introduce a variable) and they both didn't work. i get an error
    telnet: foo: Temporary failure in name resolution
    foo: Host name lookup failure

    thanks though guys,

    any other suggestions?

    Leave a comment:


  • soft_friend
    replied
    If you use a bash shell ,set a alias in your "~/.bashrc " file.
    or /etc/bashrc or /etc/profile in case of some hard distributions like slackware.
    just write
    alias foo="blah blah"

    no need to write "set"


    or introduce a variable
    write the line in your ~/.bashrc

    export foo="blah blah"

    Leave a comment:


  • Lucid Chaotic
    replied
    tell me why you wouldn't use foo as an alternate hostname, i.e. use the /etc/hosts file for designating another name for that client ??

    Leave a comment:


  • shahzadqu
    started a topic (Linux help) alias an ip address

    (Linux help) alias an ip address

    Hi Linux gurus,

    I am trying to set an alias to an ip address so that i dont' have to type the damn ip address everytime i want to ftp to it, but im having trouble in it. this is wut i do

    $ set alias foo='123.45.678.90'

    and then i do

    $ telnet foo

    it does different things. sometimes it would tell me that foo is not a hostname, other times it would try to connect to some other ip, and then othertimes it would login into my machine and ask me for the password and even though thats not where i wanna go, if i enter my password, it reports "bad password"

    then i tried

    $ set alias foo='telnet 123.45.678.90'

    i get the error

    bash: foo:command not found

    any help guys??

    thanks
Working...
X