Jan 202013
 

alias.shIf you are a Linux system administrator or you just wish to save a copy of your alias on the net, this is the service for you !
alias.sh is a new project that offer a simple service: allows you to manage all of your aliases online and browse the list of cool aliases submitted by others. From the term of your desktop, or server, you can run a single command to copy all your aliases on your system, or back into your profile should you require them.

You’ll have public alias, that everyone can use and that you can share with friends and followers and private alias, for your use only.




This is a small guide on how to use this cool service:

1) Create an account or login via your existing github or OpenID account, I’ve used my github account.

2) Now start to popolate your public list of aliases, to do this start to browse the submitted public alias, and if you find something that you like just click on “Use alias”, so this for all the aliases you like, for example I’ve choose:

Do sudo to a command, or do sudo to the last typed command if no argument given:

s(){
    if [[ $# == 0 ]]; then
        sudo $(history -p '!!')
    else
        sudo "$@"
    fi
}

Skilled users will notice that this is not an alias, but a function, in fact with alias.sh you can include any bash configuration, not just aliases.

3) Now you can click on the link at the top “my aliases” from this page you’ll see at the bottom the list of your public aliases and instructions on how to get them easily, something like this:

Use the following snippet to copy your alias list into ~/.bash_alises.

wget -q -O - "$@" https://alias.sh/user/1133/alias >> ~/.bash_aliases

if you prefer cURL

curl -s https://alias.sh/user/1133/alias >> ~/.bash_aliases

4) Private aliases, the website as an option to download private aliases, in short instead of getting a public url you’ll find on your profile something like this:

If you want to pull in your private aliases as well you will need to switch in the following URL which includes a secret key. If you share this key, others will be able to see your private aliases.

https://alias.sh/user/1133/alias/key/35461892abc812c2124bd71dac1dca05

This should pull from the server both public and private aliases, to add a private alias your list go to your profile (click the link at the top “my aliases) and click on “Edit” at the bottom of the new page you’ll see a text area where you can write your private aliases.

And this is basically everything you need to know about this website, feel free to browse the alias/functions that others have submit and vote them.


Extra: Directly source in your active bash session

It is also possible to source your alias list directly. While you could technically add this to your ~/.bash_aliases and the aliases are transferred over SSL, this should not be relied upon for production systems.

It’s also recommended limiting the number of attempts to prevent your terminal hanging in case Alias does not respond. The below command defaults to three attempts.

source < (wget -t 3 -q -O - "$@" https://alias.sh/user/1133/alias)

Note for Ubuntu 12.10 and Mint 14 users.

I don’t know why, but in these distributions there isn’t a default ~/.bashrc file, so if you want to use the file ~/.bash_aliases you have to create the file ~/.bashrc and put these lines in it:

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

Possible security issue:

As already wrote I’d not advice to put a cron or anything automatic that pull down from alias.sh anything, instead I’d do it manually to quickly review the code just downloaded, anyway be aware that alais.sh has put some effort to prevent the risks of running unwanted aliases:

  • Public aliases cannot be edited once they’ve been created for security.
  • Aliases are copied down over SSL, preventing man-in-the-middle attacks.

Post sponsored by Create A Site web design company, that provides web designs and SEO to help your business grow.

Popular Posts:

Flattr this!

  2 Responses to “alias.sh puts your Linux shell alias on the clouds”

  1. I wish they had a 2 USD/year subscription fee. That way, I could actually spend time on and use this service without the fear of it disappearing. I do not see any other sustainable business model for this service. With such a specific purpose, collecting a small fee from their users should not be a problem.

    I also have security concerns. Do they guarantee that they will not replace `ls` with `sudo rm -rf /` on day? or offer me terminal based ads?

  2. Sounded really cool, unfortunately it gave an error when I wanted to Save (Edit) mine.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

*