Most other shells have aliases of this kind (command aliases). However, zsh also has global aliases, which are substituted anywhere on a line. Global aliases can be used to abbreviate frequently-typed usernames, hostnames, etc.
% alias -g me=pfalstad gun=egsirer mjm=maruchck
% who | grep me
pfalstad ttyp0 May 24 03:39 (mickey.Princeton)
pfalstad ttyp5 May 24 03:42 (mickey.Princeton)
% fm gun
Login name: egsirer In real life: Emin Gun Sirer
Directory: /u/egsirer Shell: /bin/sh
Last login Thu May 23 19:05 on ttyq3 from bow.Princeton.ED
New mail received Fri May 24 02:30:28 1991;
unread since Fri May 24 02:30:27 1991
% alias -g phx=phoenix.princeton.edu warc=wuarchive.wustl.edu
% ftp warc
Connected to wuarchive.wustl.edu.
Here are some more interesting uses.
% alias -g M='| more' GF='| fgrep -f ~/.friends'
% who M # pipes the output of who through more
% who GF # see if your friends are on
% w GF # see what your friends are doing
alias -g gp='|grep '
Add this to your user's ~/.gitconfig under [alias] to make it globally available:
lsch = "!f() { git diff --name-status -r "HEAD~$1"; }; f"
You can invoke this to retrieve all affected files in the last 7 commits like so:
$ git lsch 7
Nouvel alias :)
cleanq = "/foreach query /unquery";
Pour créer un 'alias' dans firefox, pratique !
For example, the link http://www.youtube.com/watch?v=HXi-8nLK_dc
Bookmark the page and edit it.
Edit the link so you keep the "http://www.youtube.com/watch?v=" chunk, but replace the video ID with "%s" so it becomes "http://www.youtube.com/watch?v=%s"
Give the bookmark a keyword such as "yt"
Test by typing "yt HXi-8nE65JshkU" into the Firefox address bar.