Navigatrix is a community project that relies on user donations of time, money, expertise, and enthusiasm.
Your donation frees up additional resources and moves us forward.
Please consider how you will make your contribution for the development of Navigatrix.
Click here to help with a donation.

Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Alias is another way to say Cool
PostPosted: 19 Sep 2013, 12:04 

Joined: 04 Nov 2010, 20:51
Posts: 1057
This is a bit geeky but I'm learning the command line...not that I want to, but it makes life easier and therefore a good thing to learn.

It's a little confusing at first, but it's monkey see monkey do and pretty soon it starts to make sense. The hard part for me is remembering 8 gajillion things. I spend all that time learning something and a few weeks and a thousand keystrokes later I can't remember the exact syntax...or I do, because I have entered it so many times, but it's long and tedious to type.

I use sudo apt-get install and then a package name to download and install <package>. I read some guy created an alias command to do this...gimme....gimme <package>; and it would download and install <package>.

Cool...also known as a bit geeky. If you don't want to do this, you can stare at the sun. Aliases are cool. Try it.

Open/create an alias file
medit ~/.bash_aliases
Paste this in and save the file
# Apt-related aliases
alias gimme="sudo apt-get install"            # Install new software
Characters after the # are ignored comments the alias starts with alias.

The next time you start a terminal and the next time you want to install a package just tell the the machine to gimme libreoffice enter your password. You will have Libreoffice. How cool is that?

If you think it's ok, but you're more interested in practicalities such as resizing those recent pictures you took because the slow internet connection means a lifetime of uploading pictures so large recipients can see your nose hair.
alias newsize="mkdir smaller && mogrify -path smaller -resize 60x60% -quality 60 *.jpg"
All jpegs in that directory will have copies reduced to 60% and put into a subdirectory call smaller just by typing newsize.

But when you think it can't get any better than this. An alias for making cool is that?

Open your alias file and paste in this:
###### ea - alias for editing aliases
# When setting up a new aliases file, or having creating a new file.. About every time after editing an aliases file, I source it. This alias makes editing alias a
# bit easier and they are useful right away. Note if the source failed, it will not echo "aliases sourced".
# Substitute medit for your favourite editor.
alias ea='medit ~/.bash_aliases; source ~/.bash_aliases && echo "aliases sourced  --ok."'
Now when you just gotta have the keystroke saving pseudonym enter ea and the text editor with the proper file opens. You add your flashy new alias command; close the text editor and it will tell you if the alias will work and it will be ready for use without restarting the terminal.

Need to fix or amend an alias? Just enter ea

See I told you it was cool.

Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Credits © 2010 - 2018