Skip to content

Windows Subsystem for Linux shell scripts to make life easier working from a terminal

License

Notifications You must be signed in to change notification settings

OpusProjectus/WSL-Scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Windows Subsystem for Linux shell scripts for day-to-day use

wsl-scripts

Windows Subsystem for Linux script-collection (in progress)
I designed these to make life easier working from a terminal, in Windows, from a bash terminal.
These scripts are made for use in, foremost, a Debian WSL system. Any distribution derived from Debian (E.g Ubuntu) should work just as well.

Each script will contain a description, instructions and extra information that will be useful for users with little to no experience using Linux, or specifically, Linux-based shell terminals on a Windows system.

I make it a priority to ensure these scripts lack any features that can be damaging to less experienced users; in other words - feel free and safe to try 'em out, even if you don't really know what you're doing - thus if you find anything to the contrary, let me know so I can correct it.

Enjoy


Latest additions

pathfind

HOW TO USE:
A simple script that doesn't use anything other than bash and grep. It will look where a command is located with the full path shown, while supporting wildcard on both sides work too, e.g: example below.

Example output 1:

$ pathfind *top
/usr/bin/htop
/usr/bin/top

Example output 2:

$ pathfind *cry*
/usr/bin/decryptdir
/usr/bin/crypt
/usr/bin/mcrypt
/usr/bin/ccencrypt
/usr/bin/cryptdir
/usr/bin/ccdecrypt
/usr/bin/ccrypt

It will only show results for files that are:

  1. found with-in your $PATH
  2. flagged as executable (doesn't differ from scripts or binaries)

grep-ip

Grep-ip added, it's exactly what it sounds like! From the help parameter:

You can use it as a command, or, together with your own parameters. You can read more about possible parameters supported in grep in the manual. (man grep)

This means it works as grep (or egrep) and you can add additional parameters, as long as they are supported by grep. It will automatically find and color (if not -o given) all IPv4 addresses found in the stdout.

Example output:

$ ifconfig | grep-ip -o
172.31.92.59
255.255.240.0

explorer.sh

With this script in your user $PATH you can simply use the command:

$ explorer.sh 

or

$ explorer.sh /mnt/c/Users

This will launch an instance (Open a new Explorer window) at the working directory you are currently in, or, (if) a directory were supplied.

HOW TO USE:
If no parameter is given Windows Explorer will simply open up in the directory you are currently in. If you are in /mnt/c/ it will use the wslpath function and explorer will open in C:
If you give a path as parameter, for example:

$ explorer.sh ~/bin/

Windows Explorer will launch in your Linux user home directory bin/ folder (/home/user/bin)

IMPORTANT NOTICE:
Make sure you make this file executable by running the:

chmod  x explorer.sh

If you want it to work without typing the full path to where you're storing it, make sure it's stored in a directory included in your $PATH.

FOR BEGINNERS:
I recommend creating a directory in your $HOME directory and include it in your $PATH by editing your .bashrc and adding:

if [ -d ~/bin ]; then
    export PATH=$PATH:~/bin
fi

About

Windows Subsystem for Linux shell scripts to make life easier working from a terminal

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages