Compilation of some useful fish shell functions. Lots of shortcuts for common actions.
fish_prompt.fish Creates a clean, easy-on-the eyes prompt, as follows:
c: Used to clear the console and scroll buffer (needed on some terminal emulators like Konsole).
svim: Shortcut for sudo vim.
golo: Shortcut for sudo su
f: Shortcut for find <dir: default='.'> | xargs grep <string> -
- Usage:
f /usr/lib fish
cpmp: Copy file or directory (and sub dirs) to target and make parent directories if necessary.
- Usage:
cpmp ~/mypic.png ~/Images/Me
mvmp: Move file or directory to target and make parent directories if necessary.
- Usage:
mvmp ~/mydir ~/new/path/to/mydir - Note: Adding a slash (/) to the end of the target will create a new dir of that name (if it doesn't exist) and copy the source to the new dir.
rmrf: Shortcut for rm -rf. Of course, use with caution!
z: Quick and smart archive handling (depends on dtrx)
- Usage:
z [-opts] file.ext
Extracts any archive with options acceptable to dtrx (see: dtrx --help)
Example:z -vo test.tar.bz2 z [-v] input [output]
Compresses input file/directory, optionally verbosely, to output.tar.bz2. If output is omitted, it will create an archive with the name input.tar.bz2.
Example:z -v test test2
This will create a tar bz2 compressed archive name test2.tar.bz2
bu: Create a backup of item (file or directory) to item.bak.
sign: GPG Sign a text document, outputing result as <filename.ext>.signed
- Usage:
sign filename.ext
sedr: sed -E compliant in-place recursive regex replace.
- Usage:
sedr [dir] regex
Where dir is the top-level directory, is optional and defaults to CWD.
Example:sedr testing s/foo/bar/g
This will recurse the directory testing, replacing all instances of foo with bar.
search: Search for packages by keyword(s) in apt's cache.
- Usage:
search fish | grep installed
show: Show package details.
ins: Install new package.
rem: Remove package(s). Supply only --auto to autoremove packages no longer needed.
Simply clone the repo locally and copy its contents into ~/.config/fish/functions.
You can also create ./config/fish/functions as a soft link that points to the git repo directory. This way you can pull down updates and have any updates additions reflected immediately.
