Less than a month ago, we addressed in a post about PowerShell 7.2.6, its installation and we gave some examples of useful commands of "PowerShell on Linux". Making it clear, what is its equivalent command in Linux.
And since there are many existing ones, today we will continue with other more well-known ones, which will surely be very useful and interesting, not only for those who already know and use PowerShell, but for those who have never typed commands on windows, but they are very good about the GNU/Linux terminal.
And, before starting this post of "PowerShell on Linux" and see more equivalent commands between Linux and Windows, we recommend exploring the following related contents, at the end of reading it:
PowerShell on Linux: Equivalent Commands
10 more examples of PowerShell commands on Linux
Since, in the previous post, we explained the equivalent powershell commands Linux commands following, cd, ls, pwd, find, mkdir, touch, cp, mv, and rm; today we will explore the following equivalent commands PowerShell / Bash Shell:
- Get-Content "file" / cat "file": To display the content of a file.
- Get-Date / date: To obtain information related to the dates/times of the computer.
- Get-Command "command" / which "command": To view the path of a command or file.
- Get-Content "file" -TotalCount n / head -n "file": To display the initial content of a file.
- Get-Content "file" -Tail n / tail -n "file": To display the final content of a file.
- Set-Alias abbreviation “command” / alias abbreviation=”command”: To create command aliases.
- «Input» | Select-String -Pattern 'pattern' / "Input" | grep 'pattern': To filter a pattern within an input from a previous command.
- Invoke-WebRequest "URL" / curl -I "URL": To obtain information from the header of a website.
- Get-Help -Name "Command" / man "command" or "command" --help: To obtain usage information (help manual) an Operating System command.
- «Input» | Tee-Object -FilePath "/path/file" / "Input" | tee "/path/file": To read standard input and write it to a file.
5 other equivalent commands with the same names
Between both Shell, that is, PowerShell and Bash Shell there same commands (same name), and among those we can mention the following:
- "clear" command: Completely clear the terminal screen. In addition, they use the same key shortcut, that is, the key combination Ctrl + l.
- "dir" command: List the files and folders corresponding to our location or another indicated. In addition, they often share many parameters in common, for example: "-a", "-l" and "-s".
- echo commands: Show messages on the screen of the terminal used. Also, to work the same, messages must be quoted, either as single or double quotes.
- "cat" command: To display the content (text/characters) of a file.
- Command "Aliases"/"aliases": To see the aliases generated in the operating system.
For more information about PowerShell and its commands, you can continue exploring the next link.
Summary
In short, if you like or have used "PowerShell on Linux", tell us about your experience and offer us some other Useful PowerShell Command Examples, that we can use on any GNU / Linux Distro. Or, if you know of another PowerShell command that has its Linux equivalent, will also be of great use to us, to continue providing value and knowledge to many, on the technical field of managing the GNU/Linux and Windows Terminal.
If you liked the content, comment and share it. And remember, visit the beginning of our «site», in addition to the official channel of Telegram for more news, tutorials and Linux updates. West group, for more information on today's topic.
I have used it and not with much success. The only use I saw for it was to lend a hand to the IT Windows department and for that you need something more than powershell (which you can end up building if you look a little chestnuts). Regarding its use in UNIX-based systems, I would only see it useful if someone who uses Windows has no choice but to access Linux. The problem in these cases is that few I have found that really feel comfortable with a terminal. All this if I am talking about something purely “systems” oriented. If we refer to fields such as the deployment of applications, the most neutral and versatile thing between both operating systems that I have found is people using python
Greetings, Alvaro. Thank you for your comment and giving us your personal experience with PowerShell on Linux and Windows.