From ca890301a0f9d58c5fb2561417df88965f173917 Mon Sep 17 00:00:00 2001 From: Manan Mehta <75382447+mananmehta3@users.noreply.github.com> Date: Mon, 31 Jan 2022 13:55:06 +0530 Subject: [PATCH] Create Commands For Windows.md These are the commands to use in Windows PowerShell, which act as alternate for the ZSH commands. These are only those commands which are different. --- .../Commands For Windows.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Linux and Terminal commands/Commands For Windows.md diff --git a/Linux and Terminal commands/Commands For Windows.md b/Linux and Terminal commands/Commands For Windows.md new file mode 100644 index 0000000..f5387fc --- /dev/null +++ b/Linux and Terminal commands/Commands For Windows.md @@ -0,0 +1,17 @@ +| ZSH Commands | PowerShell Commmands | +| --- | --- | +| where | where.exe | +| open | Use Shortcut- Win + R| +| $PATH | $Env:Path | +| ls -a
[To see all files[hidden and visible]] | dir -Force | +| vi | vim
[need to download] | +| ls -l
[To see all files & directories] | Get-ChildItem | +| cat >
[To edit] | vim | +| cat file.txt two.txt > total.txt | cat file.txt, two.txt > total.txt | +| cat file.txt | tr a-z A-Z > upper.txt | (cat 'file.txt').ToUpper() > upper.txt | +| \
[For new line] | ` | +| mkdir random
mkdir random/hello
[we need to create random first here] | mkdir random/hello
[only one line to execute, no need to create random first, it can be created together] | +| touch | [you need to define touch]
function touch {
Param(
[Parameter(Mandatory=$true)]
[string]$Path
)
if (Test-Path -LiteralPath $Path) {
(Get-Item -Path $Path).LastWriteTime = Get-Date
}
else {
New-Item -Type File -Path $Path
}
} | +| sudo | runas | +| df | gdr | +| du | [need to define du]
function du($path=".") {
Get-ChildItem $path \|
ForEach-Object {
$file = $_
Get-ChildItem -File -Recurse $_.FullName \| Measure-Object -Property length -Sum \|
Select-Object -Property @{Name="Name";Expression={$file}},
@{Name="Size(MB)";Expression={[math]::round(($_.Sum / 1MB),2)}} # round 2 decimal places
}
} |