How To Create Aliases?

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
tyndallc

How To Create Aliases?

Post by tyndallc »

I am wondering how you would go about creating aliases. What I would like to be able to do is have the option of launching certain programs from a terminal session. I know that in Debian 5 you just had to edit the .bash_aliases file as well as the .bashrc file. How do you go about setting this up in Mint. I am running version 6.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
emorrp1

Re: How To Create Aliases?

Post by emorrp1 »

I'm pretty sure that Mint doesn't load .bash_aliases by default. You could put a "source .bash_aliases" line in .bashrc, but I've found it easier to just add the aliases right to .bashrc, as Mint also doesn't add any bloat to this file either.
tyndallc

Re: How To Create Aliases?

Post by tyndallc »

How would I go about editing the .bashrc file. I am fairly new to linux and not exactly sure what I would need to put in the bashrc file.
emorrp1

Re: How To Create Aliases?

Post by emorrp1 »

ok, no problem, you can edit/create the file using the gedit text editor. You can find it under Accessories-->Text Editor, try opening the ~/.bashrc file (don't forget to enable hidden files in the file selector using Ctrl+H) don't worry if it isn't there, as I don't think Mint has it by default so just create the new file and save with the file-name .bashrc (or run "gedit .bashrc" from the terminal to do the same thing")

To actually create aliases all you need to do is add a line to the file like:

Code: Select all

alias ls='ls --color=auto'
To add multiple aliases just add one per line. Save the file, and re-open the terminal (or a new tab) and try out the new command.
tyndallc

Re: How To Create Aliases?

Post by tyndallc »

thank you very much, works perfectly.
Locked

Return to “Beginner Questions”