my xfce4 dotfiles
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

125 lines
7.0 KiB

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