Git Product home page Git Product logo

win-sudo's Introduction

win-sudo

If we open msysgit as administrator, we can use it as if we were root. However, it is often easier to open without administrator privileges.

Well, Git comes with Bash emulator and you can use *nix commands. "sudo" and "apt-get" are not such - there are tools, programs if you like which obviously you don't have.

Say no to these problems! Install win-sudo and use sudo and su as on Linux.

No more "Why must I open context menu and use a separate window?" questions.

screenshot

(disclaimer: the video is a bit outdated. You should include s/ subdirectory of the repo to PATH instead of repo root. But you better check Installation section)

Installation

curl -s https://raw.githubusercontent.com/imachug/win-sudo/master/install.sh | sh

Usage

sudo

sudo command accepts path to program and then argument list.

$ sudo pip install gevent
Collecting gevent...

You will be prompted for UAC acception (if enabled) and then a new session will be spawned as a sub-shell.

su

su accepts no arguments and runs bash shell. You can exit by typing exit.

$ su
# exit
$

Why win-sudo?

  1. No need for installation: download and use.
  2. Native: no Go, Python, etc.
  3. Open-source: no viruses.
  4. Small: easy to contribute and understand.

Known issues

winpty

Some windows commands (such as cmd) don't work fine. So:

$ sudo cmd
Microsoft Windows [Version 10.0.15036]
(c) Microsoft Corporation, 2017. All right reserved.

C:\Users\Ivanq>echo 1 <--
echo 1 <--
1

C:\Users\Ivanq>

The command is prompted twice. Though the same happens when calling just cmd, not sudo cmd.

To fix this, run sudo winpty cmd instead. (but you will have to run sudo winpty cmd //c "echo 1" instead of sudo cmd /c "echo 1")

Job support

win-sudo doesn't support jobs, so when running su or sudo bash you may get:

bash: cannot set terminal process group (7152): Operation not permitted
bash: no job control in this shell

This is harmless, so you can ignore this warning.

win-sudo's People

Contributors

bizxta avatar davgit avatar demiantinkiel avatar demonixcraft avatar gucong3000 avatar michaelchanwork avatar purplesyringa avatar ricardordzg avatar riedel 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.