1 # Common Aliases Plugin
3 This plugin creates helpful shortcut aliases for many commonly used commands.
5 To use it add `common-aliases` to the plugins array in your zshrc file:
8 plugins=(... common-aliases)
15 | Alias | Command | Description |
16 | ----- | ------------ | --------------------------------------------------------------------------- |
17 | l | `ls -lFh` | List files as a long list, show size, type, human-readable |
18 | la | `ls -lAFh` | List almost all files as a long list show size, type, human-readable |
19 | lr | `ls -tRFh` | List files recursively sorted by date, show type, human-readable |
20 | lt | `ls -ltFh` | List files as a long list sorted by date, show type, human-readable |
21 | ll | `ls -l` | List files as a long list |
22 | ldot | `ls -ld .*` | List dot files as a long list |
23 | lS | `ls -1FSsh` | List files showing only size and name sorted by size |
24 | lart | `ls -1Fcart` | List all files sorted in reverse of create/modification time (oldest first) |
25 | lrt | `ls -1Fcrt` | List files sorted in reverse of create/modification time(oldest first) |
26 | lsr | `ls -lARFh` | List all files and directories recursively |
27 | lsn | `ls -1` | List files and directories in a single column |
31 | Alias | Command | Description |
32 | ----- | --------------------- | ------------------------------------------------------------------------------- |
33 | rm | `rm -i` | Remove a file |
34 | cp | `cp -i` | Copy a file |
35 | mv | `mv -i` | Move a file |
36 | zshrc | `${=EDITOR} ~/.zshrc` | Quickly access the ~/.zshrc file |
37 | dud | `du -d 1 -h` | Display the size of files at depth 1 in current location in human-readable form |
38 | duf\* | `du -sh` | Display the size of files in current location in human-readable form |
39 | t | `tail -f` | Shorthand for tail which outputs the last part of a file |
41 \* Only if the [`duf`](https://github.com/muesli/duf) command isn't installed.
45 | Alias | Command | Description |
46 | ----- | -------------------------------------------------- | ------------------------------------ |
47 | fd\* | `find . -type d -name` | Find a directory with the given name |
48 | ff | `find . -type f -name` | Find a file with the given name |
49 | grep | `grep --color` | Searches for a query string |
50 | sgrep | `grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS}` | Useful for searching within files |
52 \* Only if the [`fd`](https://github.com/sharkdp/fd) command isn't installed.
56 | Alias | Command | Description |
57 | -------- | ------------------ | ----------------------------------------------------------- |
58 | h | `history` | Lists all recently used commands |
59 | hgrep | `fc -El 0 \| grep` | Searches for a word in the list of previously used commands |
60 | help | `man` | Opens up the man page for a command |
61 | p | `ps -f` | Displays currently executing processes |
62 | sortnr | `sort -n -r` | Used to sort the lines of a text file |
63 | unexport | `unset` | Used to unset an environment variable |
67 These aliases are expanded in any position in the command line, meaning you can use them even at the
68 end of the command you've typed. Examples:
75 $ ls -l /var/log | less
78 Silences stderr output:
83 $ find . -type f 2>/dev/null
86 | Alias | Command | Description |
87 | ----- | --------------------------- | ----------------------------------------------------------- |
88 | H | `\| head` | Pipes output to head which outputs the first part of a file |
89 | T | `\| tail` | Pipes output to tail which outputs the last part of a file |
90 | G | `\| grep` | Pipes output to grep to search for some word |
91 | L | `\| less` | Pipes output to less, useful for paging |
92 | M | `\| most` | Pipes output to more, useful for paging |
93 | LL | `2>&1 \| less` | Writes stderr to stdout and passes it to less |
94 | CA | `2>&1 \| cat -A` | Writes stderr to stdout and passes it to cat |
95 | NE | `2 > /dev/null` | Silences stderr |
96 | NUL | `> /dev/null 2>&1` | Silences both stdout and stderr |
97 | P | `2>&1\| pygmentize -l pytb` | Writes stderr to stdout and passes it to pygmentize |
99 ## File extension aliases
101 These are special aliases that are triggered when a file name is passed as the command. For example,
102 if the pdf file extension is aliased to `acroread` (a popular Linux pdf reader), when running `file.pdf`
103 that file will be open with `acroread`.
107 | Alias | Command | Description |
108 | ----- | ---------- | ---------------------------------- |
109 | pdf | `acroread` | Opens up a document using acroread |
110 | ps | `gv` | Opens up a .ps file using gv |
111 | dvi | `xdvi` | Opens up a .dvi file using xdvi |
112 | chm | `xchm` | Opens up a .chm file using xchm |
113 | djvu | `djview` | Opens up a .djvu file using djview |
115 ### Listing files inside a packed file
117 | Alias | Command | Description |
118 | ------ | ---------- | --------------------------------- |
119 | zip | `unzip -l` | Lists files inside a .zip file |
120 | rar | `unrar l` | Lists files inside a .rar file |
121 | tar | `tar tf` | Lists files inside a .tar file |
122 | tar.gz | `echo` | Lists files inside a .tar.gz file |
123 | ace | `unace l` | Lists files inside a .ace file |
125 ### Some other features
127 - Opens urls in terminal using browser specified by the variable `$BROWSER`
128 - Opens C, C++, Tex and text files using editor specified by the variable `$EDITOR`
129 - Opens images using image viewer specified by the variable `$XIVIEWER`
130 - Opens videos and other media using mplayer