Create an alias for a command

Solved
ramsesthebest Posted messages 81 Registration date   Status Member Last intervention   -  
 waouh -
Hello community,
I want to create a shortcut or alias for a command. Specifically, I want the command "telnet localhost 2500" to execute when I type "t".

Thank you in advance for your responses.

9 answers

  1. jipicy Posted messages 40842 Registration date   Status Moderator Last intervention   4 898
     
    Hello,

    Just type in a terminal:
    alias t='telnet localhost 2500'
    and to make it permanent, add this line to your ".bashrc".

    ;-))
    --
    Z'@+...che.
    JP : Zen, my Nuggets ! ;-) Knowledge is only good if shared.
    46
  2. jipicy Posted messages 40842 Registration date   Status Moderator Last intervention   4 898
     
    In your "/home/toi".
    Type:
    ls -a ~
    and you should see it.
    You can also use "locate .bashrc" to locate it...

    ;-))
    --
    Z'@+...che.
    JP : Zen, my Nuggets ! ;-) Knowledge is only good if it is shared.
    16
  3. ramsesthebest
     
    Thank you for worrying about me, I'm actually on FC5.
    There must have been an issue on my end because everything is working perfectly now.

    Thanks again to everyone and long live CCM.
    6
  4. ramsesthebest Posted messages 81 Registration date   Status Member Last intervention   12
     
    Apparently, I jumped the gun a bit :(
    I typed the alias in the command line and it’s okay.
    I then added it to the .bashrc file
    but when I restart the machine and type t, I get this message:

    ~]# t
    Trying 127.0.0.1...
    telnet: connect to address 127.0.0.1: Connection refused
    telnet: Unable to connect to remote host: Connection refused

    I don’t understand.
    4
  5. ramsesthebest Posted messages 81 Registration date   Status Member Last intervention   12
     
    Le fichier .bashrc se trouve généralement dans le répertoire personnel de l'utilisateur. Pour le trouver, vous pouvez ouvrir un terminal et utiliser la commande suivante :

    ```
    nano ~/.bashrc
    ```

    ou

    ```
    vi ~/.bashrc
    ```

    Cela ouvrira le fichier .bashrc si celui-ci existe.
    3
  6. jipicy Posted messages 40842 Registration date   Status Moderator Last intervention   4 898
     
    Heu... which distribution are you on?
    During the first attempts in the command line, were you also logged in as "root"?

    Because depending on the daemon that handles "telnet" (inet.d or xinet.d) and their respective configuration files, it might be that telnet on localhost is forbidden... ;-\

    So check that...

    --
    Z'@+...che.
    JP : Zen, my Nuggets ! ;-) Knowledge is only good when shared.
    2
  7. ramsesthebest Posted messages 81 Registration date   Status Member Last intervention   12
     
    Okay thanks, I found it and added the line in the file.
    It's really nice of you.
    Thanks again for everything.
    0
  8. ramsesthebest Posted messages 81 Registration date   Status Member Last intervention   12
     
    I think the problem is more on my side because I can no longer execute the command directly.
    I'm trying to see and then I'll come back :(
    0
  9. waouh
     
    make cd to go to the current user's home

    edit .bashrc

    there you go !!
    0