Creating aliasses in Linux

Standaard

An alias in Linux gives you the possibility to shorten your command’s syntax.

For example, if you need to enter following code in your terminal to compile less code to css:

node less-watch-compiler.js less css

You can shorten this so you only need to enter the following code in your terminal:

less-watch-compiler less css

How do we do that? Simple, just follow the steps below:

  • Open /etc/profile in an editor
    • sudo nano /etc/profile
  • Add the following rule to your /etc/profile file
    • alias your-short-command-name=”the/command/directory/command parameter1 parameter2 …”
  • Exit and save your /etc/profile file
  • Execute “source /etc/profile”
  • That’s it

Based on the above example, I’ve added the next rule to /etc/profile:

alias less-watch-compiler=”node /Location/to/the/tool/Dead-Simple-LESS-Watch-Compiler/less-watch-compiler.js”

Advertenties

Geef een reactie

Vul je gegevens in of klik op een icoon om in te loggen.

WordPress.com logo

Je reageert onder je WordPress.com account. Log uit / Bijwerken )

Twitter-afbeelding

Je reageert onder je Twitter account. Log uit / Bijwerken )

Facebook foto

Je reageert onder je Facebook account. Log uit / Bijwerken )

Google+ photo

Je reageert onder je Google+ account. Log uit / Bijwerken )

Verbinden met %s