4359 links
  • Arnaud's links
  • Home
  • Login
  • RSS Feed
  • ATOM Feed
  • Tag cloud
  • Picture wall
  • Daily
Links per page: 20 50 100
  • An Introduction to the Z Shell - Aliasing

    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 '

    May 15, 2019 at 9:56:53 PM GMT+2 - permalink - archive.org - http://zsh.sourceforge.net/Intro/intro_8.html
    zsh alias
Links per page: 20 50 100
Shaarli - The personal, minimalist, super fast, database-free, bookmarking service by the Shaarli community - Help/documentation