Coder Social home page Coder Social logo

fish-shell-utility-functions's Introduction

Fish Shell Utility Functions

Compilation of some useful fish shell functions. Lots of shortcuts for common actions.

Shell Prompt, Clear (for Konsole) & Sudo VIM

fish_prompt.fish Creates a clean, easy-on-the eyes prompt, as follows:

Prompt

c: Used to clear the console and scroll buffer (needed on some terminal emulators like Konsole).

svim: Shortcut for sudo vim.

File System

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

String Manipulation

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.

Apt Shortcuts

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.

Installation

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.