visit
cd
, mkdir
, etc
~
stands for your root or home directory, the default directory where the terminal will generally open.ctrl+shift+p
.ctrl+,
Press Ctrl+,
to open settings, here we will set Powershell as our default, it would be Command Prompt in default if you haven’t changed it before.
To install a nerd font, first, go to the nerd-fonts and download the zip file of your preferred Nerd Font from the latest release. Extract the zip file and install the fonts. If you have never installed a font before, that’s fine, you can just double-click the .ttf
files and click on install.
To change the theme of your terminal, open settings and click on "Open JSON file", this will open the settings.json
file for your terminal.
winget install scoop
iwr -useb get.scoop.sh | iex
Now type scoop
and if it returns an output like the one below then all is good.
Usage: scoop <command> [<args>]
Some useful commands are:
alias Manage scoop aliases
bucket Manage Scoop buckets
cache Show or clear the download cache
cat Show content of specified manifest. If available, `bat` will be used to
pretty-print the JSON.
checkup Check for potential problems
cleanup Cleanup apps by removing old versions
config Get or set configuration values
create Create a custom app manifest
depends List dependencies for an app
download Download apps in the cache folder and verify hashes
export Exports (an importable) list of installed apps
help Show help for a command
hold Hold an app to disable updates
home Opens the app homepage
info Display information about an app
install Install apps
list List installed apps
prefix Returns the path to the specified app
reset Reset an app to resolve conflicts
search Search available apps
shim Manipulate Scoop shims
status Show status and check for new app versions
unhold Unhold an app to enable updates
uninstall Uninstall an app
update Update apps, or Scoop itself
virustotal Look for app's hash on virustotal.com
which Locate a shim/executable (similar to 'which' on Linux)
Type 'scoop help <command>' to get help for a specific command.
This is the moment you stop using those installers, now you are a terminal guy. You can even install Mozilla Firefox, just do scoop install firefox
.
is a directory jumper. What is a directory jumper? Let's say you are in the directory ~/Desktop/Development/NextJS/tutorial
, and you want to go to ~/SomewhereElse/Products/Product1/prod-website
, the one way of doing this in your terminal would be this:
cd ../../../../
cd SomewhereElse/Products/Product1/prod-website
Let's take the above example this time you just have to do this (assume you are in ~/Desktop/Development/NextJS/tutorial
):
z prod-website
That's it! You just should have visited the directory once in your lifetime (which you most probably will during the project setup). You don't even need to use the full name of your project directory, you can just do z prod
and you would jump to the most recent directory which has prod
in its name somewhere (in this case, the prod-website).
Now to install z
, just type in the following and hit enter, and there you go:
Install-Module -Name z -Force
Huh? This is not scoop, is it? Yes, it is not, we are currently installing a PowerShell Module (you can install some modules using scoop or winget too) and thus, we are using the Install-Module
command that is builtin into PowerShell.
As the name suggests it adds icons for when you do ls
. To install it do the following:
Install-Module -Name Terminal-Icons
To install Node, first, install nvm
which stands for Node Version Manager, it also lets you have multiple versions of node installed at the same time.
scoop install nvm
nvm install lts
nvm install latest
nvm install 18.1.0
To list out the versions of node available use nvm list
, the one with a *
denotes the one being used currently. To change the version do nvm use version_number
.
Quick Tip: You can also install sudo
by doing scoop install sudo
, by using that you don’t have to close and reopen the terminal for admin commands. You can use it like, sudo nvm use 18.1.0
.
scoop install git
winget install git
scoop install neovim
Also, install any other packages it asks you to. I don't recommend jumping into Neovim right ahead if you haven't seen it ever before in your life or don't know the common commands/keybindings. You can check out this article of mine for learning a bit about it and how to set it up.
winget install oh-my-posh
scoop install //github.com/JanDeDobbeleer/oh-my-posh/releases/latest/download/oh-my-posh.json
Let's make ours in ~/.config/powershell
.
cd .config
mkdir powershell && cd powershell
Let's get started with the editing then, create a file user_profile.ps1
in your preferred editor, I will be using Neovim here.
nvim user_profile.ps1
oh-my-posh init pwsh --config ~/.config/powershell/avi.omp.json | Invoke-Expression
{
"$schema": "//raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes
/schema.json",
"blocks": [
{
"alignment": "left",
"segments": [
{
"foreground": "#41A6B5",
"style": "plain",
"template": "@avi",
"type": "session"
},
{
"foreground": "#7AA2F7",
"properties": {
"folder_separator_icon": "/",
"style": "full"
},
"style": "plain",
"template": " \uf07b {{ .Path }} ",
"type": "path"
},
{
"foreground": "#BB9AF7",
"powerline_symbol": "\ue0b0",
"properties": {
"fetch_stash_count": true,
"fetch_upstream_icon": true
},
"style": "plain",
"template": "{{ .UpstreamIcon }}{{ .HEAD }}{{ if gt .StashCount 0 }} \uf692
{{ .StashCount }}{{ end }} ",
"type": "git"
}
],
"type": "prompt"
},
{
"alignment": "left",
"newline": true,
"segments": [
{
"foreground": "#cd5e42",
"style": "plain",
"template": "\ue3bf ",
"type": "root"
},
{
"foreground": "#CD4277",
"style": "plain",
"template": "> ",
"type": "text"
}
],
"type": "prompt"
}
],
"version": 2
}
Next, open your powershell profile (you can do it by nvim $profile
, do it from the home directory if you are not on Neovim, the file is located at ~/My Documents/powershell/Microsoft.PowerShell_profile.ps1), and type in the following:
. $env:USERPROFILE\.config\powershell\user_profile.ps1
To configure it open your user_profile.ps1
and add the following:
Set-PSReadLineOption -PredictionSource History
Set-PSReadLineOption -PredictionViewStyle ListView
Import-Module Terminal-Icons
Set-Alias g git
The above will set the alias for git
as g
, but that will only make it the alias for this particular terminal session/tab not globally. To make it a global alias add the exact same command as above in your PowerShell config file. Now, g is the alias for git. Similarly, you can set other aliases. Here are a few of mine:
Set-Alias v nvim
Set-Alias g git
Set-Alias y yarn
Set-Alias p pnpm
Set-Alias tig 'C:\Program Files\Git\usr\bin\tig.exe'
Set-Alias explorer explorer.exe
There is another way to set aliases for commands like npm start
, yarn dev
. Here is an example of making an alias yd
for yarn dev
:
function yarnDev {
yarn dev
}
New-Alias yd yarnDev
I don’t have experience with PowerShell script, so in the above, I can only explain that we create a function yarnDev
and add whatever we want to run when we call the function. After that, we set the alias to call the function as yd
.
You can even make your own little commands by setting them in your PowerShell config. For example, touch
command (used to create a file) which is not present in PowerShell, here is how you can add it:
function touch ($command) {
New-Item -Path $command -ItemType File | out-null && Write-Host Created $command
}
What we are doing above is creating a function touch
and letting it have a parameter. Then, in New-Item -Path $command -ItemType File
, we are using built-in PowerShell commands to create a file, you will have to research PowerShell commands to create more utilities on your own, the documentation is amazing, so it won’t be a problem. In the second half of the function, we are just telling it to output Created [file_name]
.
Here is how you can add rm
command from Linux:
function rm ($command) {
Remove-Item $command -Recurse && Write-Host Removed $command
}
To use this just do rm [file_name/directory_name]
and it will delete the file.
It is not exactly the same as the rm
command in Linux though.