Commands cheat sheet - Asteski/WinMac GitHub Wiki

WinMac provides new and most of the commonly used MacOS and Linux commands to Windows Terminal (Powershell), as part of Powershell $profile file content.

WinMac commands

  • l, ll, ls, la, ld, lf - show directory content
  • cd, c, cc, ..2, ..3, ..4, ..5 - change directory
  • of, open - function that opens current, specified folder/directory or root folder of specific file in Explorer
  • apt, brew - package manager (winget aliases)
  • find/fi - search for files in current directory recursively
  • history, hist, h - history of commands used in current and older sessions
  • stack - create taskbar stack shortcut
  • run, lnk - run program shortcuts from Programs folder
  • battery - battery info
  • computerinfo, info - shows computer and bios details
  • env/printenv, setenv, rmenv - environment variable management functions
  • random - generate random string
  • user/getuser, adduser, rmuser, passwd - User management
  • test-admin - check terminal session elevation status
  • psversion, version, psver - shows current Powershell version
  • cpy, pst - copy string from Terminal and paste it to Terminal
  • home - go to user home folder
  • desktop, desk - go to desktop folder
  • onedrive - go to OneDrive folder
  • z - jump around recent folders

Linux/MacOS-like commands

New Linux-like commands that are added as part of WinMac:

  • ditto - copy folder content to another folder
  • grep - search strings in files content
  • killall, kill - terminate process
  • top - list top 10 CPU intensive processes
  • ntop, htop - more detailed equivalent of top command
  • tree - display the directory structure in a tree-like format
  • touch - creates a new text file
  • vim, vi - vim text editor
  • whatis, man - get help for specific command
  • sed - replace string in file
  • df - show storage information
  • and other like less, head, tail, unzip, wget, nohup

These commands are part of Terminal (Powershell) by default:

  • alias - create Terminal alias
  • pwd - show current directory
  • mkdir - create folder
  • mkcd - create folder and go to it upon creation
  • mv - move file/folder
  • cp - copy file/folder
  • rm, rmdir - remove file/folder
  • clear, cls - clear terminal
  • cat - show file content in Terminal
  • echo - print string or variable
  • zip - manage zip files
  • whoami - show current username
  • curl - download files
  • gc - get-content alias

Git aliases

  • add - git add %args%; git status
  • status, st - git status
  • commit - git commit -m
  • push - git push
  • pull, pu - git pull
  • rebase - git pull --rebase
  • stash - git stash
  • branch - git branch
  • checkout, ch - git checkout
  • merge - git merge
  • clone - git clone
  • log - git log
  • tag - git tag
  • pusha, pa - git add -u; git status; git commit -m %args%; git push

Other aliases

  • note, np - notepad
  • wi - winget install
  • wl - winget list
  • wr - winget uninstall
  • ws - winget search
  • ww - winget show
  • wu - winget upgrade
  • wua - winget upgrade --all
  • wuu - winget upgrade --all --include-unknown
  • ss - search-string

Examples

list

  • l or l itemName - detailed list of all items
  • ll or ll itemName - detailed list of all items, excl. hidden and starting with dot
  • la or la itemName - vertical list of all items
  • ls or ls itemName - vertical list of all items, excl. hidden and starting with dot
  • ls -v/lsv or la -v/lav - simple vertical list in a single column
  • ld or ld folderName - list only directories
  • lf or lf fileName - list only files

open

  • open $profile or open C:\Users\username\file.txt - opens folder, where specified file is stored
  • open foldername - opens specific folder that is stored in current folder
  • open C:\Users or open C:\Program Files - opens specific folder directory
  • open - opens current folder

history

  • history - shows the list of commands from current and older sessions
  • history wsl or history grep winmac - searches through commands history by specific string or set of strings

env

  • env, printenv - show all environment variables for current user
  • env, printenv windir - show specific environment variable
  • setenv name value - set environment variable
  • rmenv name - remove environment variable

random

  • random - get random string with 10 char length
  • random 32 - get random string with 32 char length

user

  • user/getuser - list all users
  • user/getuser username - show specific user
  • adduser username - add new user account
  • rmuser username - remove user account
  • passwd username - assign or change user account password

stack

  • stack C:\Users\username\Favorites - create Stack shortcut for specific directory
  • stack . - create Stack shortcut for current directory
  • stack go - go to Stahky directory in Explorer

grep

  • grep string or grep "hello world" or grep "show this $value" - search for specific string in files in current folder
  • grep string -r or grep -r string - search for specific string in files recursively
  • grep string -f or grep string -e - include (-f) or exclude (-e) specific files or file extensions in search for current folder:
    • grep string -f/-e file1.ps1
    • grep string -f/-e file1.ps1,file2.md
    • grep string -f/-e *.ps1
    • grep string -f/-e *.ps1,*.md
  • grep string -r -f/-e or grep -r string -f/-e - include (-f) or exclude (-e) specific files or file extensions in recursive search

find

  • find string - search for file that includes specific string
  • find string -r or find -r string - search for file that includes specific string recursively
  • find *.json - search for file that have specific extension
  • find string*.json - search for file that includes specific string and have specific extension