Giter Club home page Giter Club logo

unix-pwsh's Introduction

Contents


Personal PowerShell Configuration ๐Ÿ–ฅ๏ธ

Welcome to my personal PowerShell profile repository! ๐ŸŽ‰ This collection of PowerShell scripts is designed to bring a touch of the Linux command-line experience to Windows systems. ๐ŸงBy implementing popular Linux commands like cat, grep, and more, you can enjoy a more familiar and powerful command-line environment. ๐Ÿ› ๏ธ

Feel free to use, fork, and customize these scripts to enhance your own command-line experience. ๐Ÿ”ง Developed for personal use, but feel free to use, fork, and customize this as you like. ๐Ÿš€

Note: Loading this profile may take 2-4 seconds, in the future, support for local cache will be implemented.

Disclaimer: โš ๏ธ

Never directly inject any code from the World-Wide-Web into your devices, that you have not read through and verified it's safe!

TL:DR

  • Paste this into your Powershell and afterwards into your $PROFILE, with the command notepad $PROFILE:
iex (iwr "https://raw.githubusercontent.com/CrazyWolf13/unix-pwsh/main/Microsoft.PowerShell_profile.ps1").Content

Features ๐ŸŒŸ

  • Bash-like Shell Experience: Mimics Unix shell functionality, bringing familiarity to Windows PowerShell. ๐Ÿง
  • Oh My Posh Integration: Enhances the user interface with stylish prompts and Git status indicators. โšก
  • Deferred Loading: Improves function loading time for a smoother experience. ๐Ÿ•’
  • Automatic Installation: The scripts automatically install necessary modules and components on first execution. ๐Ÿ› ๏ธ

Showcase ๐ŸŒŸ

Here is an image, how the finished config looks like, but this can be easily changed, via OhMyPosh. However, this preview is not so meaningful, as most of the visual configuration is done by OhMyPosh. Showcase

Components Installed ๐Ÿ› ๏ธ

  • Terminal-Icons Module: Enhances terminal UI with icons. ๐ŸŽจ
  • Powershell-Yaml: Facilitates configuration with a YAML file, saving time. ๐Ÿ“
  • PoshFunctions: Essential functions for PowerShell. โš™๏ธ
  • FiraCode Nerd Font: Installs a stylish font for code readability. ๐Ÿ…ฐ๏ธ
  • Oh My Posh: Provides customizable prompt themes. ๐ŸŽจ

Configuration ๐Ÿ“

  • The configuration file is located at: ~/pwsh_custom_config.yml. This file stores all the configuration variables, facilitating faster loading by eliminating the need to check for installed elements every time.

  • All configurable options, including module installation preferences and feature toggles, are centralized within this YAML file. This centralized approach streamlines the initialization process, ensuring a quicker and more efficient startup experience. ๐Ÿš€

Usage ๐Ÿš€

  • To activate this configuration:
  1. Paste in this command: iex (iwr "https://raw.githubusercontent.com/CrazyWolf13/unix-pwsh/main/Microsoft.PowerShell_profile.ps1").Content.
  2. The PowerShell profile is automatically created and the profile injected into, if it does not exist. If it exists, manually place the snippet provided above at the top of the PowerShell profile.
  3. Edit the profile easily by typing notepad $PROFILE into PowerShell. ๐Ÿ› ๏ธ
  4. Make sure to point Windows Terminal to pwsh instead of powershell, as pwsh is the open-sourced 7.x.x version of PowerShell (PowerShell Core). ๐Ÿ”„
  5. Enjoy the enhanced PowerShell experience! ๐ŸŽ‰

Supported Linux Commands ๐Ÿง

The PowerShell profile includes aliases and functions that mimic common Linux commands, providing a familiar environment for users accustomed to Linux shell environments. Here are some of the supported Linux commands:

  • sudo: Runs a command with elevated privileges, similar to the sudo command in Linux.
  • cd: Changes the current directory. PowerShell equivalent: Set-Location.
  • ls: Lists the contents of a directory. PowerShell equivalent: Get-ChildItem.
  • dirs: Lists directories recursively.
  • sed: Stream editor for filtering and transforming text.
  • which: Locates a command.
  • export: Sets environment variables. PowerShell equivalent: Set-Item.
  • pgrep: Searches for processes by name. PowerShell equivalent: Get-Process.
  • grep: Searches for patterns in files.
  • pkill: Terminates processes by name.
  • head: Displays the beginning of a file.
  • tail: Displays the end of a file.
  • unzip: Extracts files from a zip archive. PowerShell equivalent: function expand-archive.
  • du: Displays disk usage statistics.
  • ll: Lists files in a directory.
  • df: Displays disk space usage. PowerShell equivalent: Get-Volume.
  • reboot: Reboots the system.
  • poweroff: Shuts down the system.
  • cd...: Changes the directory to the parent's parent directory.
  • cd....: Changes the directory to the parent's parent's parent directory.
  • md5: Computes the MD5 hash of a file.
  • sha1: Computes the SHA1 hash of a file.
  • sha256: Computes the SHA256 hash of a file.
  • uptime: Displays system uptime.
  • ssh-copy-key: Copies SSH public keys to a remote server.
  • explrestart: Restarts Windows Explorer.
  • expl: Opens File Explorer at the currenct location.
  • Get-PubIP: Retrieves the public IP address.
  • Get-PrivIP: Retrieves the private IP address.
  • gitpush: Also known as lazy-git, pulls, adds all, commits the message after gitpush and then pushes.
  • ptw: Send text/files pipe output to a wastebin server, important: contact me via issue for this.

Contributing ๐Ÿค

  • Feel free to fork, modify, and contribute improvements or additional features.
  • For any issues, questions, or help, please create an issue in the repository. ๐Ÿ’ฌ
  • Huge thanks to fsackur for the awesome Deferred-loading guide:

https://fsackur.github.io/2023/11/20/Deferred-profile-loading-for-better-performance

Personalization ๐ŸŽจ

  • Customize the scripts according to personal preferences or specific system requirements.
  • To use a forked version, update the githubUser variable to point to your own forked repository.
  • To make your own name appear on the Welcome Screen, just fork this repo and edit the main file located in the pwsh folder and edit the variable $name to your own name.
  • To insert your own OhMyPosh config, just fork the repo and change the URL in the main file to your own.

License ๐Ÿ“œ

This project is licensed under the MIT License.


Developed by CrazyWolf13 with โค๏ธ

unix-pwsh's People

Contributors

crazywolf13 avatar

Stargazers

 avatar Calvin Gonzales avatar Ajay Mamtora avatar Alicia Sykes avatar  avatar Jeff Jerousek avatar  avatar Andrew Pong avatar [@mikespon] avatar

Watchers

Lucian avatar  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.