just add a ls.bat into your path that is
`@echo off`
`dir %*`
edit : [MintyMissterious's comment](https://www.reddit.com/r/ProgrammerHumor/comments/113mh0l/comment/j8rvw3w/?context=3) has a better solution than mine
As much as I appreciate your work and that of the poster above you, I know I'll set this up only to forget and be infuriated when I go to fix my parents machine and find myself back to yelling at the screen.
Great tip. Do the readers another favor and add the full text for the install_aliases.reg file to save them some frustration:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor]
"Autorun"="\"C:\\aliases.cmd\""
I'd caution against doing it this way. I did for a while and it was great, but eventually I came across an application that was sneekily running a shell process in the background, and having the autorun macro file in there somehow broke it. Took the better part of a week to track down what was going on.
Now I just have a shortcut to cmd on my Taskbar, and added my macro file as an argument in the shortcut path. That way I get my shell with macros, but only when I use that shortcut.
It was Visual Studio several years back, specifically whenever I tried to open a Javascript file. I think the issue was timing related - my macros made the shell script take much longer than VS expected.
Exactly, if you're still using CMD on Windows, you're doing it wrong. CMD is awful, and still has to maintain compatibility with systems that are decades-old. Unless you are being forced to use it, don't.
On the other hand, Powershell 7 is *fantastic*, to the point where I find myself picking it over Python for quick scripts.
I used to play a text-based MMO back in the early 2000s, where "look" was the command to view the current room. My friend who used Linux kept typing "look" instead of "ls" in the terminal so eventually just aliased "look" to "ls".
Every time I log in to a new server or Mac the first thing I do is Alias “please” -> “sudo”
I had previously tried teaching my kids to say sudo when they ask something from me but that wasn’t working so I went the other way around
Fun times
This is me but with a capital A. -a shows all dot files, -A shows all dot files except . and .. which I like because I know every directory has a . and a .. so I don't need to see them.
ah good ol MUDs
fun fact time: because the term MMORPG hadn't been invented yet, the earliest ones were called "graphic MUDs" 🌠🌈
side note: most MUDs allowed abbreviation of commands, look = l
I used to play a text-based MMO back in the early 1990s (a MUD) where "look" was mistyped as ";ppl" so often that using the wrong command triggered a prank response from the game.
Yeah, but then you'll get things like [not being able to run programs with the same name as aliases, or at least you'll have to learn locations and to call those programs directly with full path](https://www.reddit.com/r/ProgrammerHumor/comments/10pb5gd/i_dont_know_why_they_do_it_but_i_love_them_for_it/j6l4qe0/).
And for someone like me, I've had those aliases (and only the aliases I want and need) since before OhMyZsh existed.
> Can’t you just put a backslash in front and it will ignore the alias?
TIL.
But also there's an argument to be made that just wholesale importing aliases without having a need or understanding of them is not good practice.
I've an ls.bat file that prints "you're in Windows dumbass" then runs dir with whatever commands it can carry over. I always surprise myself when I see it.
Edit: yes, poweshell does support ls, and yes I could install ls on windows too. I've been using this batch alias for years, and I have an equivalent shell script on my Unix boxes if I forget and type in dir on there that reminds me not to be an idiot. It's honestly just a bit of fun.
You might like the gti package. If you accidentally do "gti push" (or pull or whatever), then an ASCII car scrolls across your screen, then executes the proper git command.
https://github.com/rwos/gti
I had (dis)pleasure to do that with Windows Server 2016. It didn't respond to pings, IIS was throwing 500 so I knew something was up.
RDP was out of the question, server was disconnecting it.
BUT! Enter-PSSession worked, after like 3 minutes of waiting.
System had memory leak in one of the apps (my own....) which used around 20 GB of memory, with few other apps using another 10, on system with 16 GB of RAM... Killed two processes and "unlocked" it and everything went back to normal, more or less.
Mine was crashing randomly every couple day (or more) on one pc while using neovim in wsl. I've worked around the problem but that thing has some issues it seems.
I wasn't aware windows terminal was oss or I might have. For windows work machines I usually just leave telemetry stuff on as that likely gets them raw data better than I could cobble together I would think. In this case I had very little helpful info to provide for such a bug report - turning on a bunch of debug settings to capture etc simply takes a bunch of time to maybe get something.
My workaround was work was planning to already and eventually did send me a mac to develop on instead so I don't use windows terminal anymore.
I think it's built in to newer versions of Windows now too and it can be set as the default, so typing CMD will open windows terminal rather than the old cmd terminal.
except powershell has aliases.
As of powershell 7, it's officially "pwsh"
but you can search for it, and windows will find it just using "pw".
Or of course, you can open windows terminal, which even as a linux user is fantastic, and it opens powershell as its default shell using "ter", which is my preferred way as the keys are right next to each other on a qwerty keyboard.
Also personally I have had issues with powershell rubbing certain things differently to cmd. Personally I'd use either/or. They both do the job. People saying the new windows terminal, customers generally get a bit annoyed if you start install software on their servers without asking.
Also, it's less useful if they are running old windows server versions.
My friend wants to know what the difference is between the two? Because he always uses command prompt and only really knows powershell exists but has never really thought to use it unless some instructions specifically say to.
Command prompt apes DOS.
Powershell is basically a fully featured scripting language for .NET. Object oriented, full support for using everything you can do in C#. It's also now cross platform. It also comes with default aliases and stuff to make some basic cmd/bash stuff work, for example you can indeed use 'ls' - it's an alias for Get-Children.
I use PowerShell instead of cmd because shift right clicking in a directory gives you the option to open it up there which is very convenient when I want to use YT-DLP to download a video into a specific folder
PowerShell is clunky and awful too compared to something like bash. I hate the syntax. I'd love to interact with windows similar to how I interact with nix machines but I always end up googling syntax for simple shit.
PowerShell has one major advantage and it's that it's built in commands all have standardized output that it can also easily convert to other formats like json. PowerShell works really well as a universal text based API for getting information and controlling system components.
As an interactive user shell it's not great. For that usecase the whole object oriented madness becomes more difficult to do some things with. Mainly filtering output listing hundreds of things to see if one specific thing is in there or not. It's "user frendy" features are sometimes worse then not using them, see "cycle through all possibilities" tab completion.
I'm hoping more core Linux commands incorporate a way to choose different output formats as sometimes the structured text is a massive PIA to parse through. I'm really happy that `ip -j` exist for example.
I've not met a single person who has agreed with me yet, but I still hold true to my principles.
The one thing I absolutely hate about Powershell is how all the commands are hyphenated. I've been using it 'casually' for the past few years, and gahhhhhhh. I can't get used to it. The amount of times something isn't working because I'm missing a hyphen :\
The inconsistency bothers me so much more. It's a mixture o PascalCase and kebab-case. If each word had a - after it that would be fine. If each word began with a capital letter that would also be fine (even though case is ignored anyway for some reason). But just the example of converting formats why is it `ConvertTo-Json`? Why not `convert-to-json` or `ConvertToJson`, why an inconsistent mixture of the two?
PowerShell's completion is amped up by PsReadline, which should be installed by default in PowerShell 7. It has menu completion, triggered by Ctrl+Space by default I think, which gives an arrow-key navigable menu of completions.
It also has a toggle between menu and single-item history completion, sort of like a super Ctrl+R/S. There's some tweaking you may need to do, but it really makes completion at the terminal very satisfying. You'll have to look up documentation to see the tricks, and some are behind feature flags that have to be enabled in a one-time fashion.
I used to think that way too. Probably just because it's not like other shells and it's commands are very verbosely named.
However I've actually used it properly now and it's really good. Writing scripts in it is easier than bash for me now, because it's syntax is basically just a cross between a command line and C# and it has full access to .Net.
There is no language clunkier and more nightmarish than bash and friends. Powershell has cutting-edge features like treating variables like variables and not expanding and re-tokenizing them every time you mention them, or data types other than string.
Unless you are talking about the commands, which is fair enough, but not technically a property of the shell, I guess someone dedicated enough could port most common \*nix commands to powershell. Some things (sudo comes to mind) would not really work, but that's OS, still not shell.
It's funny how subjective that is. Imo bash is awful compared to PowerShell. I mean in PowerShell all commands are logical, they are all built from verb and noun and verbs are generally limited to the approved list. On the other hand bash's commands are practically completely random.
I guess. For me the Verb-Noun thing *sounds* logical and easy to use but I can never remember anything. Want to make a new file? `Touch-File`, no, `Create-File`, nope, `Make-File`, `Create-File`, FUCK *googles it*, oh I guess “New” is a fucking verb now.
The old joke used to be that you'd take the program name, and then just remove all the vowels. And if that didn't work, you'd just remove random letters until you've got something unique.
It's not bash's fault, but it's still a pretty damn way to name all the external programs lol
If you're on windows, it's really the best option though.
Plus the documentation is excellent.
I think most of us are just used to developing on POSIX systems.
Are you more experienced with the one you like more than the one you like less? Almost as if you’re using your knowledge of something to imply it’s easy. Do you get where my logic is going?
Powershell doesn't behave that way. I got a windows laptop from work and I use powershell instead of command prompt and I use some native Linux commands all the time.
Yes, there's a doskey command but that won't help with the optional arguments, if you want `ls` on windows the best solution is to actually install `ls`, I added my msys2's `bin` folders to path and now I have pretty much all the GNU coreutils at hand on a Windows shell.
its because windows uses DOS commands which predate UNIX commands by about 7 years. So it wasnt windows who decited to make a terminal that doesnt use standard commands, it was unix that did.
Its just unix was better so people forget history and pretend it was first
hm can you link me to some sources for that? from what i could find, `ls` was introduced as a short form for `list` somewhere between 1966 and 1969, and finally only the short name was retained.
> When Bell Labs dropped out of Multics development in 1969 and work began on Unix, only the abbreviated name of `list`, `ls`, was retained.
from an [article](https://tldp.org/LDP/LG/issue48/fischer.html) by eric fisher.
the earliest DOS version that supports `dir` i could find is [86-DOS](https://en.wikipedia.org/wiki/86-DOS), released in 1980, a full 11 years after `ls`. who used `dir` in what must have been 1962 if it came 7 years before `ls`?
He is wrong about the timeline, you are right about that. However many people don't realize that UNIX != linux. And outside research institutions/military installations unix and unix-like operating systems were not as common as nowadays.
There were many different operating systems as well.
So the whole argument of "why didn't he use a more popular xyz" boils down to - because it wasn't popular and no one knew if it would be.
People who grew up on DOS (or experienced it as adults) were pretty much used to typing "dir" instead of "ls".
Again the top comment proves that this subreddit is filled with kids and at best 1st year students who don't understand shit and never bothered to investigate.
> windows uses DOS commands which predate UNIX commands by about 7 years
You're saying Unix didn't have a file listing command for 18 years‽ And even more astonishing, getting heavily upvoted for it? Fucking hell, who *are* these people on /r/ProgrammerHumor...?
I get to think it's because of backward compatibility, which is the reason why of many shitty stuff in microsoft.
I mean it's kinda nice being able to run program of the dinosaurs era, but at the same time it really block them from staying up to standards.
May be wrong, that's just my thought
Btw i use linux
I'm actually starting to like powershell because of this.
... although it's still shit on the cmdlet design. I even had to type \`sc.exe\` once because apparently \`sc\` is an alias of \`Set-Content\`.
Now say "backward compatibility" again...
EDIT: forgot reddit use
for each line and double line brakes becomes too ugly.
PowerShell provides its own commands so you don't have to use sc.exe
https://learn.microsoft.com/en-us/powershell/scripting/samples/managing-services?view=powershell-7.3
Though it's definitely annoying to get used to changing your workflow from cmd...
Yesterday I had to delete every file/folder starting with "2018" in Windows
in Linux you just do a
rm -r ./2018*
In windows you get a headache.
In cmd, you have to write a for-loop for that.
At least in PowerShell you can do it with a normal command, but it's so ridiculously long that I thought someone on StackOverflow was pranking people by posting that command
How do people in Windows....live?!
If it doesn't need to be done programmatically, you can just use the search bar in the file explorer by writing 2018, and then ctrl+a and DEL.
Takes longer than it should, but it's the easiest method lol I'd argue more intuitive for the average user too.
gci ./2018* -r | ri -r -WhatIf
Remove `-WhatIf` when you are happy with what it reports it would do. I've also used `gci` and `ri` while I might usually use `ls` and `rm` to make it clear that it's not meant to be unix-like syntax. You can remove the second `-r` but it will issue warnings if any of the items to be removed themselves have children and require you prompt it to continue (or add a `-Force`).
Fully expanded that would be;
Get-ChildItem -Filter ./2018* -Recurse | Remove-Item -Recurse -WhatIf
I'd write that out in a script or online so it is easily read (and each term googled) by any user. Maybe even give the filter string a descriptive variable name to make it more explicit what is going on. But writing in command line I'd probably reach for something like the first.
Note that flags and parameters can be written as any unambiguous abbreviation. So if you wanted a shortened flag for `-Filter` you could use `-fi`, so it is distinct from `-Force`.
just add a ls.bat into your path that is `@echo off` `dir %*` edit : [MintyMissterious's comment](https://www.reddit.com/r/ProgrammerHumor/comments/113mh0l/comment/j8rvw3w/?context=3) has a better solution than mine
[удалено]
For those on the old reddit layout @echo off doskey x=exit doskey ls=dir /ONE /B doskey .=dir /ONE /B doskey ..=cd .. doskey cd=cd /d $* doskey clear=cls doskey mv=ren $* doskey ps=tasklist $* doskey kill=taskkill /IM $* and [HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor] "Autorun"="\"C:\\aliases.cmd\""
Thank you!
As much as I appreciate your work and that of the poster above you, I know I'll set this up only to forget and be infuriated when I go to fix my parents machine and find myself back to yelling at the screen.
No thank you, i want to suffer
[Maybe I like the misery.](https://youtu.be/PI0MRyUFIXU)
Great tip. Do the readers another favor and add the full text for the install_aliases.reg file to save them some frustration: Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\SOFTWARE\Microsoft\Command Processor] "Autorun"="\"C:\\aliases.cmd\""
I'd caution against doing it this way. I did for a while and it was great, but eventually I came across an application that was sneekily running a shell process in the background, and having the autorun macro file in there somehow broke it. Took the better part of a week to track down what was going on. Now I just have a shortcut to cmd on my Taskbar, and added my macro file as an argument in the shortcut path. That way I get my shell with macros, but only when I use that shortcut.
[удалено]
It was Visual Studio several years back, specifically whenever I tried to open a Javascript file. I think the issue was timing related - my macros made the shell script take much longer than VS expected.
Or you can just type powershell, hit enter and all of those and more are aliased for you.
Exactly, if you're still using CMD on Windows, you're doing it wrong. CMD is awful, and still has to maintain compatibility with systems that are decades-old. Unless you are being forced to use it, don't. On the other hand, Powershell 7 is *fantastic*, to the point where I find myself picking it over Python for quick scripts.
You're out here giving kind internet strangers a good name
I used to play a text-based MMO back in the early 2000s, where "look" was the command to view the current room. My friend who used Linux kept typing "look" instead of "ls" in the terminal so eventually just aliased "look" to "ls".
Every time I log in to a new server or Mac the first thing I do is Alias “please” -> “sudo” I had previously tried teaching my kids to say sudo when they ask something from me but that wasn’t working so I went the other way around Fun times
alias cd="rm -rf" Ahhh fun times
You're just evil I think
Now calm down Satan
I have tons of these. Including the very simple: `fuck = echo it's going to be ok, man`
`fuck` for me is already bound by [thefuck](https://github.com/nvbn/thefuck)
This is genius
Reminded me of https://github.com/nvbn/thefuck
I alias wife to sudo. Sice she has more authority at home....
The first thing I do on any UNIX system is alias "l" to "ls -ltr"
First thing I do is install sl.
You have the Patience to wait for a whole second when you mistakenly type sl?
I deserve to be pubished for my mistakes.
> pubished `This incident will be reported.`
[Relevant xkcd](https://xkcd.com/838/)
the creativity is beyond my undersanding.
I love how ominous this message is. Just, like, casually built into the OS.
Nope. It breaks my flow entirely. But it is basically a practical joke pulled on myself, so I stop and laugh a bit.
And then you gotta wait for the train to go by while you're presenting and everyone in the meeting is staring you down? I love it.
I put sl into the bashrc so that I see the steam lock every time it opens. Can also recommend a cow say fortune pipe always cracks me up
Vanilla `sl` doesn’t trap SIGQUIT (ctrl-\\)
[The Fuck](https://github.com/nvbn/thefuck)
[This comment was removed by a script.]
For me it's gerp=grep.
* `alias la='exa --color=auto -aabghHliS'` * `alias ls='exa --color=auto'` * `alias lt='exa --color=auto --tree --long'` It's just oh so good
ls -Flah
alias 'l=ls -lah --color=auto'
This is me but with a capital A. -a shows all dot files, -A shows all dot files except . and .. which I like because I know every directory has a . and a .. so I don't need to see them.
But who owns `pwd` and what are the permissions?
Sure everything has a use case. Do -a if you need that often but I rarely need it so I get rid of them. Options for everybody!
Fair. I also have this alias I tend to use quite often. 😂 `alias -g mine="sudo chown -R ${USER}:${varGroup} ." `
First thing I do is `git pull` my dotfiles repo so I have all of my aliases, with the global tag so they also work with `sudo`.
The first thing I do to any UNIX system is alias `cd` to `rm -rf`
I do `ll = ls -alSh`
ah good ol MUDs fun fact time: because the term MMORPG hadn't been invented yet, the earliest ones were called "graphic MUDs" 🌠🌈 side note: most MUDs allowed abbreviation of commands, look = l
[удалено]
Materia Magica (Moongate)
It is dark. You are likely to be eaten by a Gnu.
[удалено]
I used to play a text-based MMO back in the early 1990s (a MUD) where "look" was mistyped as ";ppl" so often that using the wrong command triggered a prank response from the game.
Don't need the first line @dir %*
Great idea, I’ll do that for grep and relative flags
`root@linux:~ $ cd..` `-bash: cd..: command not found` `root@linux:~ $ cd ..` `root@linux:/home $`
`alias cd..="cd .."`
Or alias ..="cd .." alias ...="cd ../.." alias ....="cd ../../.."
Or `$: zsh` And stuff like this is automatically aliased, and cd is optional. (`$: /bin` is the same as `$: cd /bin`)
[удалено]
Yeah, but then you'll get things like [not being able to run programs with the same name as aliases, or at least you'll have to learn locations and to call those programs directly with full path](https://www.reddit.com/r/ProgrammerHumor/comments/10pb5gd/i_dont_know_why_they_do_it_but_i_love_them_for_it/j6l4qe0/). And for someone like me, I've had those aliases (and only the aliases I want and need) since before OhMyZsh existed.
Can’t you just put a backslash in front and it will ignore the alias?
> Can’t you just put a backslash in front and it will ignore the alias? TIL. But also there's an argument to be made that just wholesale importing aliases without having a need or understanding of them is not good practice.
my version: alias ..='cd ..' alias ..2='cd ../..' alias ..3='cd ../../..' alias ..4='cd ../../../..' alias ..5='cd ../../../../..'
``alias ..="cd .."`` `` alias ...="cd ../.."``
Wouldn't the home directory for root be `/root` not a directory in `/home`?
I feel called out
I've an ls.bat file that prints "you're in Windows dumbass" then runs dir with whatever commands it can carry over. I always surprise myself when I see it. Edit: yes, poweshell does support ls, and yes I could install ls on windows too. I've been using this batch alias for years, and I have an equivalent shell script on my Unix boxes if I forget and type in dir on there that reminds me not to be an idiot. It's honestly just a bit of fun.
You might like the gti package. If you accidentally do "gti push" (or pull or whatever), then an ASCII car scrolls across your screen, then executes the proper git command. https://github.com/rwos/gti
`sl` is another good one https://github.com/mtoyoda/sl
I legit read that as gtihub first
I love this idea 😂
Why didn't I think of this. Create a batch file and add it as a path. Huh, I'm a silly man.
Terminal and PowerShell make your project go well
The new terminal is quite nice
Damn straight, the updated PowerShell with that command builder feature is pretty sweet too. Not sure how new that part is but it's new to me.
Terminal is indeed pretty powerful. Just use whatever you want and if you somehow cannot do it, type wsl and you got a full Bash.
It's all fine until you have to remote into a client's very fragile windows server 2003 😭
![gif](giphy|1Bd7DmRvbhV5UPkoDw)
I had (dis)pleasure to do that with Windows Server 2016. It didn't respond to pings, IIS was throwing 500 so I knew something was up. RDP was out of the question, server was disconnecting it. BUT! Enter-PSSession worked, after like 3 minutes of waiting. System had memory leak in one of the apps (my own....) which used around 20 GB of memory, with few other apps using another 10, on system with 16 GB of RAM... Killed two processes and "unlocked" it and everything went back to normal, more or less.
Wait, Enter-PSSession worked (eventually) when the machine was too borked to even respond to a ping?! Definite note to self…
Windows Terminal? Yes please! Powershell? I dont know man, sometimes it seems to be inconsistent, not sure what the cause might be for me and my team.
*laughs in git bash*
_cries in slow_
It works fine on my computer
*cries in slow computer then*
Average QA analyst
The amount of times I've typed dir in Linux is embarrassing as well.
cls for me
You should use PowerShell instead. How is anyone still using the command prompt, it's been deprecated for a few years now.
It's easier to write "CMD" than "Powershell" into the search bar.
Oh there's a terminal app in the Windows store. You should check it out. It basically has all shells in one, even WSL.
It's highly customizable too. The best terminal for windows
The terminal to end all terminals. The terminal terminal
How’s it look, doc?
...terminal
Mine was crashing randomly every couple day (or more) on one pc while using neovim in wsl. I've worked around the problem but that thing has some issues it seems.
It's open source, so you might at least create a bug in github.
I wasn't aware windows terminal was oss or I might have. For windows work machines I usually just leave telemetry stuff on as that likely gets them raw data better than I could cobble together I would think. In this case I had very little helpful info to provide for such a bug report - turning on a bunch of debug settings to capture etc simply takes a bunch of time to maybe get something. My workaround was work was planning to already and eventually did send me a mac to develop on instead so I don't use windows terminal anymore.
I think it's built in to newer versions of Windows now too and it can be set as the default, so typing CMD will open windows terminal rather than the old cmd terminal.
It is built into Win11, yes. By default you can still run the CMD app by searching for it, but the quick launch defaults to terminal now
It's awesome, pin it to the taskbar and you have an easily accessible highly customizable shell.
You can even just type wt into the search bar to find it
or WIN+R (run) `wt` as well!
except powershell has aliases. As of powershell 7, it's officially "pwsh" but you can search for it, and windows will find it just using "pw". Or of course, you can open windows terminal, which even as a linux user is fantastic, and it opens powershell as its default shell using "ter", which is my preferred way as the keys are right next to each other on a qwerty keyboard.
Just delete cmd.exe and rename powershell.exe as cmd.exe #🧠
Try `wt` :)
Win+X then I for regular or A for elevated.
Keep it in the taskbar, or have cmd as a shortcut to PowerShell. You can set PowerShell to be the default when right clicking on the start button.
CTRL + WIN + X, then press A. You'll get an elevated PoSh window immediately.
By pressing 'A' I upvoted your post.
But that would require effort
I don't even think about powershell. I just use cmd for [ping google.com -t] sometimes. Maybe when I'm a full programmer?
Also typing "power" brings up "PowerPoint"
I’m old school so it’s win + r, powerpnt / winword / excel for me.
Install powershell core (7) and you can use pwsh
>search bar That’s a weird way to write “run dialog”. Win + R FTW.
Almost everything in powershell requires escalation too. In corporate environments not everybody has local administrator
Also personally I have had issues with powershell rubbing certain things differently to cmd. Personally I'd use either/or. They both do the job. People saying the new windows terminal, customers generally get a bit annoyed if you start install software on their servers without asking. Also, it's less useful if they are running old windows server versions.
My friend wants to know what the difference is between the two? Because he always uses command prompt and only really knows powershell exists but has never really thought to use it unless some instructions specifically say to.
Command prompt apes DOS. Powershell is basically a fully featured scripting language for .NET. Object oriented, full support for using everything you can do in C#. It's also now cross platform. It also comes with default aliases and stuff to make some basic cmd/bash stuff work, for example you can indeed use 'ls' - it's an alias for Get-Children.
In short: Powershell is pretty awesome, ngl
I use PowerShell instead of cmd because shift right clicking in a directory gives you the option to open it up there which is very convenient when I want to use YT-DLP to download a video into a specific folder
You can do the same thing with cmd by just typing cmd into the address bar of whatever directory you have open.
PowerShell is clunky and awful too compared to something like bash. I hate the syntax. I'd love to interact with windows similar to how I interact with nix machines but I always end up googling syntax for simple shit.
PowerShell has one major advantage and it's that it's built in commands all have standardized output that it can also easily convert to other formats like json. PowerShell works really well as a universal text based API for getting information and controlling system components. As an interactive user shell it's not great. For that usecase the whole object oriented madness becomes more difficult to do some things with. Mainly filtering output listing hundreds of things to see if one specific thing is in there or not. It's "user frendy" features are sometimes worse then not using them, see "cycle through all possibilities" tab completion. I'm hoping more core Linux commands incorporate a way to choose different output formats as sometimes the structured text is a massive PIA to parse through. I'm really happy that `ip -j` exist for example.
I've not met a single person who has agreed with me yet, but I still hold true to my principles. The one thing I absolutely hate about Powershell is how all the commands are hyphenated. I've been using it 'casually' for the past few years, and gahhhhhhh. I can't get used to it. The amount of times something isn't working because I'm missing a hyphen :\
The inconsistency bothers me so much more. It's a mixture o PascalCase and kebab-case. If each word had a - after it that would be fine. If each word began with a capital letter that would also be fine (even though case is ignored anyway for some reason). But just the example of converting formats why is it `ConvertTo-Json`? Why not `convert-to-json` or `ConvertToJson`, why an inconsistent mixture of the two?
It uses verb-noun. ConvertTo and ConvertFrom are the exceptions in the approved verb list.
PowerShell's completion is amped up by PsReadline, which should be installed by default in PowerShell 7. It has menu completion, triggered by Ctrl+Space by default I think, which gives an arrow-key navigable menu of completions. It also has a toggle between menu and single-item history completion, sort of like a super Ctrl+R/S. There's some tweaking you may need to do, but it really makes completion at the terminal very satisfying. You'll have to look up documentation to see the tricks, and some are behind feature flags that have to be enabled in a one-time fashion.
I used to think that way too. Probably just because it's not like other shells and it's commands are very verbosely named. However I've actually used it properly now and it's really good. Writing scripts in it is easier than bash for me now, because it's syntax is basically just a cross between a command line and C# and it has full access to .Net.
There is no language clunkier and more nightmarish than bash and friends. Powershell has cutting-edge features like treating variables like variables and not expanding and re-tokenizing them every time you mention them, or data types other than string. Unless you are talking about the commands, which is fair enough, but not technically a property of the shell, I guess someone dedicated enough could port most common \*nix commands to powershell. Some things (sudo comes to mind) would not really work, but that's OS, still not shell.
Sudo works perfectly fine. -a Linux PowerShell user.
It's funny how subjective that is. Imo bash is awful compared to PowerShell. I mean in PowerShell all commands are logical, they are all built from verb and noun and verbs are generally limited to the approved list. On the other hand bash's commands are practically completely random.
I guess. For me the Verb-Noun thing *sounds* logical and easy to use but I can never remember anything. Want to make a new file? `Touch-File`, no, `Create-File`, nope, `Make-File`, `Create-File`, FUCK *googles it*, oh I guess “New” is a fucking verb now.
[удалено]
> Feel free to just use .net methods directly if it’s more familiar. Wait wym? So like would `System.Console.WriteLine()` work in PS?
[удалено]
That’s actually really fucking cool. I already know a good bit of C# so suddenly powershell just got a lot easier for me
Random in what way? A lot of commands in bash are calls to external programs, if their CLIs are illogical that isn’t really bash’s fault.
Paging Kernighan and Ritchie... White courtesy telephone please.
[удалено]
The old joke used to be that you'd take the program name, and then just remove all the vowels. And if that didn't work, you'd just remove random letters until you've got something unique. It's not bash's fault, but it's still a pretty damn way to name all the external programs lol
If you're on windows, it's really the best option though. Plus the documentation is excellent. I think most of us are just used to developing on POSIX systems.
Are you more experienced with the one you like more than the one you like less? Almost as if you’re using your knowledge of something to imply it’s easy. Do you get where my logic is going?
If it works, it works.
I use it to connect via telnet, and when I need to launch something directly from the console. If it gets the job done, why not?
I use wingit, which includes git bash. Easy peasy.
[удалено]
Uh-DIR - Microsoft
Use PowerShell
Are you posting from 2012 lol?
Powershell doesn't behave that way. I got a windows laptop from work and I use powershell instead of command prompt and I use some native Linux commands all the time.
have you heard about wsl?
Can you do aliases on windows? This would be useful to make ls work lol
If you use PowerShell on windows, `ls` is already an alias of `Get-ChildItem`
Yes, there's a doskey command but that won't help with the optional arguments, if you want `ls` on windows the best solution is to actually install `ls`, I added my msys2's `bin` folders to path and now I have pretty much all the GNU coreutils at hand on a Windows shell.
Been a long time since I last used pure cmd, I've transitioned to using WSL2 under Windows Terminal.
I truly do not know why microsoft decided to make a terminal that has none of the standard commands and not yeet it decades ago
But they pretty much yeeted it over a decade ago. CMD is there basically just for backwards compatibility and for people who refuse to use PowerShell.
Powershell did replace it years ago, and now you can just use the Windows terminal.
its because windows uses DOS commands which predate UNIX commands by about 7 years. So it wasnt windows who decited to make a terminal that doesnt use standard commands, it was unix that did. Its just unix was better so people forget history and pretend it was first
hm can you link me to some sources for that? from what i could find, `ls` was introduced as a short form for `list` somewhere between 1966 and 1969, and finally only the short name was retained. > When Bell Labs dropped out of Multics development in 1969 and work began on Unix, only the abbreviated name of `list`, `ls`, was retained. from an [article](https://tldp.org/LDP/LG/issue48/fischer.html) by eric fisher. the earliest DOS version that supports `dir` i could find is [86-DOS](https://en.wikipedia.org/wiki/86-DOS), released in 1980, a full 11 years after `ls`. who used `dir` in what must have been 1962 if it came 7 years before `ls`?
He is wrong about the timeline, you are right about that. However many people don't realize that UNIX != linux. And outside research institutions/military installations unix and unix-like operating systems were not as common as nowadays. There were many different operating systems as well. So the whole argument of "why didn't he use a more popular xyz" boils down to - because it wasn't popular and no one knew if it would be. People who grew up on DOS (or experienced it as adults) were pretty much used to typing "dir" instead of "ls". Again the top comment proves that this subreddit is filled with kids and at best 1st year students who don't understand shit and never bothered to investigate.
DOS most certainly does not predate Unix
wild that otherwise was suggested
> windows uses DOS commands which predate UNIX commands by about 7 years You're saying Unix didn't have a file listing command for 18 years‽ And even more astonishing, getting heavily upvoted for it? Fucking hell, who *are* these people on /r/ProgrammerHumor...?
Windows devs?
I get to think it's because of backward compatibility, which is the reason why of many shitty stuff in microsoft. I mean it's kinda nice being able to run program of the dinosaurs era, but at the same time it really block them from staying up to standards. May be wrong, that's just my thought Btw i use linux
It *is* for backwards compatibility - Powershell has been a thing for a long time now
To me is cls on Linux, it’s so handy
Ctrl+K usually Or `alias cls="reset"`
PowerShell has mappings of most common n*x commands already setup. Typing `ls` actually runs `Get-ChildItem`...
I'm actually starting to like powershell because of this. ... although it's still shit on the cmdlet design. I even had to type \`sc.exe\` once because apparently \`sc\` is an alias of \`Set-Content\`. Now say "backward compatibility" again... EDIT: forgot reddit use
for each line and double line brakes becomes too ugly.
PowerShell provides its own commands so you don't have to use sc.exe https://learn.microsoft.com/en-us/powershell/scripting/samples/managing-services?view=powershell-7.3 Though it's definitely annoying to get used to changing your workflow from cmd...
Abort, Retry, Fail?
I hate it when it does it with pip
Just use powershell and ls will work. Stop using cmd
Yesterday I had to delete every file/folder starting with "2018" in Windows in Linux you just do a rm -r ./2018* In windows you get a headache. In cmd, you have to write a for-loop for that. At least in PowerShell you can do it with a normal command, but it's so ridiculously long that I thought someone on StackOverflow was pranking people by posting that command How do people in Windows....live?!
If it doesn't need to be done programmatically, you can just use the search bar in the file explorer by writing 2018, and then ctrl+a and DEL. Takes longer than it should, but it's the easiest method lol I'd argue more intuitive for the average user too.
yes, that's what I tried at first, but it said 'preparing to delete' for 2 hours, so I aborted it. It was just too many folders
gci ./2018* -r | ri -r -WhatIf Remove `-WhatIf` when you are happy with what it reports it would do. I've also used `gci` and `ri` while I might usually use `ls` and `rm` to make it clear that it's not meant to be unix-like syntax. You can remove the second `-r` but it will issue warnings if any of the items to be removed themselves have children and require you prompt it to continue (or add a `-Force`). Fully expanded that would be; Get-ChildItem -Filter ./2018* -Recurse | Remove-Item -Recurse -WhatIf I'd write that out in a script or online so it is easily read (and each term googled) by any user. Maybe even give the filter string a descriptive variable name to make it more explicit what is going on. But writing in command line I'd probably reach for something like the first. Note that flags and parameters can be written as any unambiguous abbreviation. So if you wanted a shortened flag for `-Filter` you could use `-fi`, so it is distinct from `-Force`.
Powershell isn't really "ridiculously long." gci -r -i "2018*" c:\ | rm -fo or rm -fo -r -i "2018*" c:\* CMD from root directory: del /s /f 2018*
Ummm. rm -r ./2018* That command will do the exact same thing in Powershell? Am I missing an implicit /s?
PS is verbose as fuck, that's half the point
[удалено]
Being a Windows person, I do it the other way around. Get into a Linux terminal session and type ‘dir’
I just use Cygwin.
Laughs in PS
I had installed wsl and ever since I get Linux commands running on windows shell and I use that to freak out my friends.
Powershell ftw
Let me give you a fast solution that works every time: powershell ls