DEV Community

Vincent Tommi
Vincent Tommi

Posted on

Moving from Ubuntu 26.04 to Windows: Linux Commands vs PowerShell for Developer

Introduction

Recently, I migrated from Ubuntu 26.04 to Windows as my primary development environment. Since I had been using Ubuntu for development, I was already comfortable working with the Linux terminal.

On Ubuntu, I frequently used commands such as ls, cd, mkdir, touch, rm, and cat when navigating directories and managing project files.

However, after moving to Windows, I discovered that not all the commands I was familiar with worked in the same way.

For example, I tried creating an HTML file using:

touch index.html
Enter fullscreen mode Exit fullscreen mode

But PowerShell returned an error:

touch : The term 'touch' is not recognized as the name of a cmdlet,
function, script file, or operable program.
Enter fullscreen mode Exit fullscreen mode

This made me realise that although Linux and Windows terminals share some similarities, they have different command-line tools and conventions.

In this article, I will share some of the differences I have encountered and the commands developers can use when transitioning from Ubuntu to Windows.

1. Understanding Windows PowerShell

Windows provides different command-line environments, but two common ones are:

  • Command Prompt (CMD): The traditional Windows command-line interpreter.
  • PowerShell: A more advanced command-line shell designed for system administration, automation, and scripting.

I was using PowerShell when I encountered the touch error.

Unlike Linux terminals, PowerShell uses cmdlets such as New-Item, Get-ChildItem, and Remove-Item to perform different operations.

2. Common Linux Commands and Their Windows Equivalents

Here are some commands I commonly used on Ubuntu and their equivalents in Windows PowerShell.

Listing files and directories

On Ubuntu, I would use:

ls
Enter fullscreen mode Exit fullscreen mode

In PowerShell, I can also use:

ls
Enter fullscreen mode Exit fullscreen mode

Alternatively, the native PowerShell command is:

Get-ChildItem
Enter fullscreen mode Exit fullscreen mode

Both allow you to view files and directories in the current location.

Checking the current directory

On Ubuntu:

pwd
Enter fullscreen mode Exit fullscreen mode

In PowerShell:

Get-Location
Enter fullscreen mode Exit fullscreen mode

This displays the current working directory.

Creating a directory

On Ubuntu:

mkdir my-project
Enter fullscreen mode Exit fullscreen mode

In PowerShell:

New-Item my-project -ItemType Directory
Enter fullscreen mode Exit fullscreen mode

You can also use the shorter command:

mkdir my-project
Enter fullscreen mode Exit fullscreen mode

Creating a file

This is where I encountered my first issue.

On Ubuntu:

touch index.html
Enter fullscreen mode Exit fullscreen mode

In PowerShell, use:

New-Item index.html -ItemType File
Enter fullscreen mode Exit fullscreen mode

Alternatively:

New-Item style.css -ItemType File
Enter fullscreen mode Exit fullscreen mode

This creates an empty CSS file.

Deleting a file

On Ubuntu:

rm index.html
Enter fullscreen mode Exit fullscreen mode

In PowerShell:

Remove-Item index.html
Enter fullscreen mode Exit fullscreen mode

Reading file contents

On Ubuntu:

cat index.html
Enter fullscreen mode Exit fullscreen mode

In PowerShell:

Get-Content index.html
Enter fullscreen mode Exit fullscreen mode

Changing directories

On both Ubuntu and PowerShell, you can use:

cd my-project
Enter fullscreen mode Exit fullscreen mode

To move one directory backwards:

cd ..
Enter fullscreen mode Exit fullscreen mode

Clearing the terminal

On Ubuntu:

clear
Enter fullscreen mode Exit fullscreen mode

In PowerShell:

Clear-Host
Enter fullscreen mode Exit fullscreen mode

You can also use:

clear
Enter fullscreen mode Exit fullscreen mode

3. Linux Commands vs PowerShell Commands vs CMD

It is important to understand that PowerShell and Command Prompt are different environments.

Here is a quick comparison:

Operation Ubuntu PowerShell Windows CMD
List files ls ls dir
Current directory pwd Get-Location cd
Create directory mkdir mkdir mkdir
Create file touch file.txt New-Item file.txt -ItemType File type nul > file.txt
Delete file rm file.txt Remove-Item file.txt del file.txt
Read file cat file.txt Get-Content file.txt type file.txt
Change directory cd folder cd folder cd folder
Clear terminal clear Clear-Host cls

Notice that some commands work across multiple environments, while others require different syntax.

4. Creating a Simple Web Development Project in PowerShell

Let's say you want to create a simple web development project containing HTML, CSS, and JavaScript files.

On Ubuntu, I would normally do something like this:

mkdir my-website
cd my-website

touch index.html
touch style.css
touch script.js

ls
Enter fullscreen mode Exit fullscreen mode

In PowerShell, I can achieve the same result using:

# Create the project directory
mkdir my-website

# Navigate into the directory
cd my-website

# Create the HTML file
New-Item index.html -ItemType File

# Create the CSS file
New-Item style.css -ItemType File

# Create the JavaScript file
New-Item script.js -ItemType File

# List the project files
ls
Enter fullscreen mode Exit fullscreen mode

The resulting project structure will look like this:

my-website/
│
├── index.html
├── style.css
└── script.js
Enter fullscreen mode Exit fullscreen mode

You can then open the project in Visual Studio Code using:

code .
Enter fullscreen mode Exit fullscreen mode

5. Do I Need to Abandon Linux Commands Completely?

Not necessarily.

Windows offers several options for developers who prefer working with Linux commands.

Windows Subsystem for Linux (WSL)

WSL allows developers to run a Linux environment directly on Windows without setting up a traditional virtual machine.

For example, you can install Ubuntu through WSL and continue using familiar commands:

touch index.html
ls
mkdir my-project
Enter fullscreen mode Exit fullscreen mode

Git Bash

Git Bash provides a Bash-like terminal environment on Windows. It supports many familiar Linux commands, making it useful for developers transitioning from Linux.

PowerShell

PowerShell is also worth learning because it provides powerful tools for managing files, directories, applications, and development environments on Windows.

6. Lessons Learned from Migrating to Windows

One thing I have learned from this transition is that changing operating systems does not mean starting my development journey from scratch.

The underlying development concepts remain the same. What changes is how we interact with the operating system.

As developers, understanding different terminal environments makes it easier to work across operating systems, collaborate with other developers, and manage development projects.

Conclusion

Migrating from Ubuntu 26.04 to Windows has been an interesting learning experience. My first challenge was discovering that familiar Linux commands such as touch do not work directly in PowerShell.

However, learning commands such as New-Item, Get-Content, and Remove-Item has made the transition easier.

My takeaway is simple: Don't just memorise terminal commands; understand what they do. Once you understand the purpose of a command, learning its equivalent in another operating system becomes much easier.

As I continue developing on Windows, I also plan to explore PowerShell, WSL, and other tools that can improve my development workflow.

Top comments (0)