Skip to content
Pinter Computing

Knowledge Base for IT Professionals, Teachers, and Astronauts

Pinter Computing

Knowledge Base for IT Professionals, Teachers, and Astronauts

  • Home
  • Programming
  • DevOps
  • Project Management
  • Software and Hardware
  • Miscellaneous
  • Egyebek
  • About
  • Experience
  • Education
  • Contact
  • Home
  • Programming
  • DevOps
  • Project Management
  • Software and Hardware
  • Miscellaneous
  • Egyebek
  • About
  • Experience
  • Education
  • Contact
Close

Search

Knowledge Base

Remove byte-order mark from the beginning of the file

By Laszlo Pinter
July 31, 2020 1 Min Read
3

When a file is saved with BOM (byte-order mark) on a Mac or Linux machine Windows PowerShell cannot execute the script.

Unfortunately the “cat” command by default does not show the byte-order mark at the beginning of the file. As Oriol stated below, use cat -A filename to display this extra information.

Some editors show a question mark at the beginning of the file.

I have discovered it when I issued the “git diff” command:

<U+FEFF>

To remove the BOM in Visual Studio Code

  • Open the file in Visual Studio Code
  • Click the UTF-8 with BOM text at the bottom right of the screen
  • On the top select Save with Encoding
  • Select UTF-8

The “git diff” command shows the removal of the BOM

Tags:

DevOpsLinuxMacOSXPowerShell
Author

Laszlo Pinter

Follow Me
Other Articles
Previous

Clear the browser cache for one site in Chrome

Next

Map the host drive in a VMware Fusion Windows virtual machine

3 Comments
  1. Oriol says:
    September 19, 2023 at 2:43 am

    The flag -A in cat will show you the BOM character

    cat -A filename

    “M-oM-;M-?”

    Reply
    1. Laszlo Pinter says:
      February 4, 2025 at 12:20 pm

      Thank you, Oriol, I have updated the post.

      Reply
  2. Anebi Ode says:
    January 30, 2025 at 3:35 am

    Excellent solution. I had read around the Web for this solution for over an hour only to stumble upon such a simple solution. Thanks alot.

    Reply

Leave a Reply Cancel reply

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

Search

Last Changes

  • Japan travel tips June 22, 2026
  • Argument of type '(number | null)[]' is not assignable to parameter of type '(err: Error, result: QueryResult) => void' June 20, 2026
  • Cities: Skylines II Developer Mode June 20, 2026
  • How to stop the rain and snow in Cities: Skylines II June 20, 2026
  • 'CSII_MANAGEDPATH' has incorrect path(s) when building Cities: Skylines II mod June 20, 2026

Tags

.NET .NETcore 3Dprinting ASP.NET Core AutodeskInventor AWS C# Chef cloud DevOps Docker EntityFramework Games Git Go iOS iPad iPhone iPod Java Kubernetes Linux MacOSX MSSQL MVC Node.js Packer PowerShell Python RDS RightScale Ruby security Splunk TeamCity Terraform TestKitchen Tomcat Ubuntu Vagrant VirtualBox VisualStudio Windows WordPress Xcode

Recent Comments

  • Zengei László on MyHeritage családfa exportálása és küldése emailben
  • Raúl Castillo on DynDns update error
  • MICHAEL on Windows Media Player 12 cannot find the album information
  • Nargis on Configure Epson ET-3850 scanning on Windows 11
  • Venczelné Zemen Erika on Delta S2302 termosztát programozása

–

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
Copyright 2026 — Pinter Computing. All rights reserved.