PowerShell 7.2.6: Using Linux and Windows Commands in GNU

PowerShell 7.2.6: Using Linux and Windows Commands in GNU

PowerShell 7.2.6: Using Linux and Windows Commands in GNU

Certainly, when it comes to using Free and open operating systems based in GNU / Linux, the use of the terminal is usually more common than, when it comes to Private and closed operating systemsas Windows and macOS. However, in both the terminal is present and each with their respective Terminals and Shells.

And, as many will already know from different sources, Microsoft has time betting on him open source and the convergence of many of its Windows applications on GNU/Linux. being one of them, PowerShell. Which is a modern command shell that includes the best features of other popular shells. One, unlike others, which only accept and return text, accepts and returns objects.

about PowerShell

And, before starting this post of "PowerShell 7.2.6" and using Linux and Windows commands on a GNU Distro, we recommend exploring the following related contents, at the end of reading it:

about PowerShell
Related article:
PowerShell, install this command line shell on Ubuntu 22.04
Powershell
Related article:
Microsoft PowerShell Core has already reached its version 6.0

Using Windows PowerShell 7.2.6 on GNU/Linux Distros

Using Windows PowerShell 7.2.6 on GNU/Linux Distros

Installation of PowerShell on GNU/Linux

To make use of PowerShellabout my current GNU / Linux Operating System, LLAMADA Miracles (a respin of MX Linux) we install its ".deb file" in its version 7.2.6, using the following command:

sudo dpkg -i ./Descargas/powershell_7.2.6-1.deb_amd64.deb

Linux and Windows Command Examples Using PowerShell on GNU

Linux and Windows Command Examples Using PowerShell on GNU

First, to start PowerShell on GNU/Linux we must execute the pwsh command, as seen in the following image:

PowerShell: Screenshot 1

And ready! From here we can execute almost any Linux Bash Shell command and Windows PowerShell supported, as we will show below in the following images with the execution of the following 5 command orders:

move between directories

  • Set-Location ./Descargas/
  • cd /home/sysadmin

move between directories

List route contents

  • Get-ChildItem -Path /home/sysadmin
  • ls -l /home/sysadmin

List route contents

Request the route where we are positioned

  • Get-Location
  • pwd

Request the route where we are positioned

Find files using search patterns

  • Get-ChildItem '/opt/milagros/scripts/' -Filter '*milagros*' -Recurse
  • find /opt/milagros/scripts/ -name *milagros*

Find files using search patterns

Create, copy, move and delete files and folders

On windows

  • New-Item -ItemType File FileUbunlog.txt
  • New-Item -ItemType Directory 'DirUbunlog'
  • Copy-Item ./FileUbunlog.txt ./FileUbunlog2.txt
  • Move-Item ./FileUbunlog2.txt ./FileUbunlog3.txt
  • Remove-Item *.txt

Create, copy, move and delete files and folders in Windows

On Linux

  • mkdir dirtemp
  • touch filetemp
  • mv ./filetemp ./dirtemp/
  • cp ./dirtemp/filetemp ./dirtemp/filetemp2
  • rm ./dirtemp/filetemp2

Create, copy, move and delete files and folders in Linux

For more information about PowerShell and its commands, you can start with the following official link. Or this other one, which is located in GitHub.

PowerShell 7.2.6: Linux and Windows Commands over GNU - 1

PowerShell 7.2.6: Linux and Windows Commands over GNU - 2

Powershell
Related article:
Powershell, the Windows console comes to Ubuntu
Shell Scripting - Tutorial 01: The Shell, Bash Shell and Scripts
Related article:
Shell Scripting – Tutorial 01: Terminals, Consoles and Shells

Abstract banner for post

Summary

In short, we hope that initial look at "PowerShell 7.2.6" and the use of Linux and Windows commands on a GNU Distro, continue to provide value and knowledge to many, on the technical field of managing the GNU/Linux Terminal, either on GNU/Linux or Windows Distros.

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.


Be the first to comment

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.