Giter Club home page Giter Club logo

pw's Introduction

pw

A simple wrapper for package managers written in bash.

pw aims to make use of different package managers easier by wrapping them to a consistent interface.

Install

  • as root with curl:
curl -L https://raw.githubusercontent.com/hth2/pw/master/pw.sh -o /usr/local/bin/pw.sh
echo 'source /usr/local/bin/pw.sh' >> /etc/bash.bashrc
echo 'source /usr/local/bin/pw.sh' >> /etc/profile
  • as root with wget:
wget https://raw.githubusercontent.com/hth2/pw/master/pw.sh -O /usr/local/bin/pw.sh
echo 'source /usr/local/bin/pw.sh' >> /etc/bash.bashrc
echo 'source /usr/local/bin/pw.sh' >> /etc/profile
  • as root with wget:
wget https://raw.githubusercontent.com/hth2/pw/master/pw.sh -O /usr/local/bin/pw.sh
echo 'source /usr/local/bin/pw.sh' >> /etc/bash.bashrc
  • as regular user:
curl -L https://raw.githubusercontent.com/hth2/pw/master/pw.sh -o ~/.pw.sh
echo 'source ~/.pw.sh' >> ~/.bashrc

Update

  • this command will try to fetch the latest version of pw.sh from github
pw-self-update

Usage examples

Let's say we are on a debian-like system. Instead of running apt-get and the likes, we would use the following commands (for most common tasks):

pw-update             # update package information by 'apt-get update'
pw-install vim        # install vim by 'apt-get install vim'
pw-remove vim         # uninstall vim by 'apt-get remove vim'
pw-uninstall vim      # ditto'
pw-search vim         # search for packages containing vim in name by 'apt-cache search --names-only abc'
pw-search-desc vim    # search for packages containing vim in description by 'apt-cache search abc'
pw-info vim           # show info about package vim by 'apt-cache show abc'
pw-file file          # show files installed by package vim by  'dpkg -L vim'
pw-own /usr/bin/pinky # show which package owns a particular file by 'dpkg -S /usr/bin/pink'
pw-list               # list all installed packages by 'apt list --installed'

What is the benefit of doing so, instead of using apt directly? For me the benefits are:

  • when I am on system with another package manager (yum, homebrew, zypper), the above commands also work.
  • Commands are easy to remember thanks to consistent, sensible naming: command like pw-own /usr/bin/pinky (which package owns file /usr/bin/pinky?) is easier to remember than dpkg -S /usr/bin/pinky (unless you like to read man dpkg)
  • Commands are easy to type thanks to out-of-the-box auto-completion; no need to mess around with my bash/zsh setup. Just type e.g. pw-<Tab> to see all commands.
  • Easy installation, so that when I need pw, it can by installed with a quick copy-and-paste action. I find this very convenient whenever I am inside a VPS or docker container and need to do something quickly.

Links

pw's People

Contributors

hth2 avatar

Stargazers

Janek avatar

Watchers

 avatar

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.