Results 1 to 6 of 6

Thread: renaming terminal command

  1. #1
    Join Date
    Jun 2014
    Beans
    26

    renaming terminal command

    Hi

    Where could i possible find a list of commands of a terminal? I want to rename one function.
    clear -> cls, as i'm still used to typing windows command CLS to clear the terminal.
    Or is there an actual function to rename a function?

  2. #2
    Join Date
    May 2006
    Location
    Switzerland
    Beans
    2,612
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: renaming terminal command

    Quote Originally Posted by aidas2 View Post
    I want to rename one function.
    clear -> cls
    You could set an alias in your ~/.bashrc configuration file. If you check your home directory there should be a file called ".bashrc".
    Inside that file you could do a line that says e.g.
    Code:
    alias cls='clear'
    Close your terminal and open it again (or start a new session) and it should be active, the command should be working.

  3. #3
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    21,372
    Distro
    Ubuntu Mate 16.04 Xenial Xerus

    Re: renaming terminal command

    Use an alias. Don't rename programs unless you want to break your system. Badly.

    Or perhaps you should rename all the programs you want. Then this learning will be first hand and have greater impact. Most shell programs are in /bin/ or /usr/bin/ Go crazy.

    But really, you should use an alias.

  4. #4
    Join Date
    Jun 2014
    Beans
    26

    Re: renaming terminal command

    Quote Originally Posted by TheFu View Post
    Use an alias. Don't rename programs unless you want to break your system. Badly.

    Or perhaps you should rename all the programs you want. Then this learning will be first hand and have greater impact. Most shell programs are in /bin/ or /usr/bin/ Go crazy.

    But really, you should use an alias.
    You are absolutely right. Could do lots of damage I guess.

  5. #5
    Join Date
    Jun 2014
    Beans
    26

    Re: renaming terminal command

    Quote Originally Posted by scorp123 View Post
    You could set an alias in your ~/.bashrc configuration file. If you check your home directory there should be a file called ".bashrc".
    Inside that file you could do a line that says e.g.
    Code:
    alias cls='clear'
    Close your terminal and open it again (or start a new session) and it should be active, the command should be working.
    Worked perfectly! Thanks

  6. #6
    Join Date
    Aug 2011
    Location
    51.8° N 5.8° E
    Beans
    5,478
    Distro
    Xubuntu 20.04 Focal Fossa

    Re: renaming terminal command

    Quote Originally Posted by scorp123 View Post
    Close your terminal and open it again (or start a new session) and it should be active, the command should be working.
    No need to open a new terminal or start a new session; simply sourcing your .bashrc is enough:
    Code:
    . .bashrc

Bookmarks

Posting Permissions

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