DEV Community

Pacharapol Withayasakpunt
Pacharapol Withayasakpunt

Posted on

Shell (e.g. Bash) users before coming to Windows Terminal - which shell do you use?

Do you use PowerShell or cmd.exe? Or something else, like Git-bash or WSL?

How do you learn commands? PS and cmd.exe have different commands.

Some of commands I need are

  • which => Get-Command
  • head (I don't need cat) => gc log.txt | select -first 5

Discussion (7)

Collapse
ducaale profile image
Mohamed Dahir

If you have wsl1/wsl2 installed, any commands from wsl can be used in Windows land if you prefix it with wsl e.g wsl touch file.txt.

devblogs.microsoft.com/commandline...

Collapse
patarapolw profile image
Pacharapol Withayasakpunt Author • Edited

Thanks. I totally forgot that I can do that, no matter cmd.exe or PowerShell.

wsl which python # /mnt/c/Users/Pacharapol W/.pyenv/pyenv-win/shims/python
Enter fullscreen mode Exit fullscreen mode

Surprisingly, this points to the correct answer.

Not to mention that these are useful

wsl du -sh *
wsl head bigfile.csv
Enter fullscreen mode Exit fullscreen mode

Though, I personally don't get the purpose of wsl touch new.txt. I know it creates or modifies timestamp, but why?

Collapse
ducaale profile image
Mohamed Dahir • Edited

I only have used the touch command to create new files. I am not sure either what is the purpose of modifying file timestamps.

Collapse
shadowtime2000 profile image
shadowtime2000

I use cmd.exe and occasionally Git-bash when it is required for a projects build setup or something. I rarely use commands other than mkdir and cd because I mainly just use Yarn or NPM CLI commands along with code .

Collapse
brunovieira97 profile image
Bruno Vieira

PwerShell 7 always. Actually, being a lifetime Windows user makes me miss some stuff when I go to Linux-based Shells, mostly CUA keybindings. Nothing compares to PSReadLine for selecting text with Ctrl and Shift.

Also, my PS profile has a lot of stuff defined in it, so my environment is exactly the way I like it ;)

(Linux-like aliases are much better than the cmdlets full names btw, would hate to type Get-ChildItem all the time XD)

Collapse
ahferroin7 profile image
Austin S. Hemmelgarn

For stuff that actually has to be run on Windows, PowerShell. It has default aliases that make it easier to adapt to from POSIX sh, and it’s far more capable than CMD even if you do have to quote things more.

In all other cases, I just boot into Linux when I need a shell environment for something...

Collapse
zoedreams profile image
☮️✝️☪️🕉☸️✡️☯️

i use WSL2 with openSuse and windows terminal (emulated powershell)

i really wish iTerm2 was ported over for windows. I miss the opacity and shortcuts and history stuff in that. however terminal is pretty decent.

i rarely use cmd these days because its annoying to start in admin mode. versus the old days where you could just do a cmd...

i do like the window key + search feature that is basically like spotlight search in mac. This is fancy to grep your actions and has smart sorting of popular commands you use.. This can also be configured to index your ~/bin of your scripts so you can run scripts into a terminal window with just a few key strokes.. Very impressed with the new productivity features of w10. not to mention regedit is still better IMO then the scattered plist configs that maxc uses.

<3 gitbash , i still find myself using ming over having to boot up the wsl2 vm. however ill reserve my wsl2 for ec2 connection and storage of my pems and stuff like that.. its a bit harder for external users to grab since its buried into a vm shadow file which hopefully has some encryption setup on.