Why can’t a macOs be installed in a Windows computer?

Why can’t a macOS be installed in a Windows computer?

Why can’t a macOS be installed in a Windows computer?

macOS, also known as Mac OS X, is a proprietary operating system developed and maintained by Apple Inc. for use on Apple’s Macintosh computers. This operating system is not designed to be installed on non-Apple hardware, such as a Windows computer. This is because macOS is specifically built to work with Apple’s hardware and software ecosystem, and is therefore not compatible with the hardware and software of a Windows computer. Additionally, Apple has put in place technical and legal restrictions to prevent macOS from being installed on non-Apple hardware.

Why can’t a macOS be installed in a Windows computer?
Why can’t a macOS be installed in a Windows computer?

Apple don’t want that to happen.

Not because they want to extract more money from hardware sales (Apple hardware is actually cheap for the quality you get anyway), not because they wouldn’t sell OS X as a product if they could.

It’s really simple: they did the math on the support costs of random third party hardware, and the numbers came up “nope”.

Apple actually did this long before OS X was a thing; for a short while you could actually get a licensed non-Apple MacOS computer.

But the support costs killed it.

To actually do this and make money, they’d have to sell OS X for a couple of thousand dollars, or maybe a subscription at about $50/month. That’s to pay for the three or four thousand developers and ten or so thousand support people they’d have to hire to deal with all the random crap hardware out there.

And it still wouldn’t meet their quality targets anyway.

So how can Microsoft do it?

They get the OEMs and hardware manufacturers to deal with most of it. Which they mostly do badly, but people have somehow become used to the resulting mess.

Making the OS itself free does mean that they don’t want people to install it on third party hardware because that would mean zero profits from the extra user (unless they use services such as iCloud in a premium fashion — more than just what’s given free).

I guess that makes the hackintoshing phenomenon an issue. Now, when the support for the last Intel based Mac ends hackintoshing will be a real issue (I mean, some explicitly limit themselves to High Sierra because of some NVidia GPUs that aren’t supported on newer versions at all…). But for now, if you have good, compatible hardware, you can reap the benefits just fine.

I am currently a hackintosher but intend to get an actual MacBook Pro (Intel based) soon. Wouldn’t have happened if I didn’t get a good hackintosh. So I’d say, don’t fight those who try it out like this and then migrate to actual Apple products, since that’s actually a profit vector. Only fight those that do it despite that.

The better question to ask is “How does Linux do it?”. You can find drivers for most of “the random crap hardware out there”… You can “google yourself” the support for most of the issues you’d run into, unlike Windows, etc. Support is a “thing” mostly for corporate users. Companies need someone to sue in case they’d somehow lose a penny because of hw/sw issues.

Using Windows would be much better than hackintoshing. Windows has its issues, it is not as reliable as macOS. However, Windows is much more flexible than macOS. It is much more programmer friendly than macOS. Most of the advantages of macOS will cease to exist once you take it out of the integration with Apple hardware.

You can, not so easily, run the OSX on a windows machine as you would run a second version of windows or Linux or any other OS. My current machine has around 4 different OS in 2 drives. The machine was originally assembled keeping in mind running it on OSX, endearingly known by the community as Hackintoshs. I did run an OSX version of Snow Leopard for a few months but didn’t have much use of it as I already own a MacBook Pro. A fun project but not without hastles.

Also, I did shift my 10+ year old MacBooks drive into the machine, before writing this reply, just for fun. Given the changes over time, the OSX failed to recognise half the peripherals which is solvable, but would need a lot of work.

You can. Such computers are called a “Hackintosh.” The procedure is totally unsupported, but I suppose it can save the user some money, when it works.

It’s not that it can’t. It’s a violation of the end-user license. If you’d like to give a try, just google out Hackintosh. I am not aware of any prosecution if you do. Definitely nothing like the infamous Microsoft initiated BSA raids on companies and individual users.

  • Flashing question mark
    by /u/Successful_Sweet_178 (Mac) on July 26, 2024 at 10:35 pm

    submitted by /u/Successful_Sweet_178 [link] [comments]

  • Help purchasing a budget MacBook for editing in 2024
    by /u/ttrrippinn (Mac) on July 26, 2024 at 10:30 pm

    Hi! I’m looking to purchase a MacBook for video editing, I will be most likely buying used or refurbished. I know I want a M1 with 16gb, but would like to know exactly what model would be the best value set up? My budget is honestly low, $600 or under, but that is in the used/ refurbished market. Thank you! submitted by /u/ttrrippinn [link] [comments]

  • Mac won’t charge or open chrome
    by /u/mmorca (Mac) on July 26, 2024 at 10:16 pm

    My Mac (not sure what version, big sur something, but pretty old) suddenly, after not charging it for one night completely stopped working. I had it plugged in for a few hours before going to use it, took 3 tries to get it to turn on and the battery was still on 1% and if I take the charger out it immediately shuts down. Everything seems to open except for chrome? It just won’t respond. I’m going to take it to a repair person if theres nothing I can do, has anyone else had this problem? submitted by /u/mmorca [link] [comments]

  • The right shift key on my Mac works with the R letter key, and does not work with other keys. The left arrow key function keeps happening repeatedly, even though I'm not pressing it
    by /u/Regular_Focus_725 (Mac) on July 26, 2024 at 10:16 pm

    Model details: 2021 Macbook Pro. The OS version is Sonoma 14.5 So, the 2 problems on my mac are as I wrote in the title. Just giving some more context here. My right shift key does not work with any key. I used a keyboard test website to see if it is even getting pressed or not. And it doesn't show the press on the test with any keys, except, strangely, when pressed together with -, +, the letter R, Caps Lock or delete key. For every other key, it shows that it is NOT pressed. Does anyone know what may cause this? And what is the solution for this? Another strange issue is of the left arrow key. The left arrow function happens repeatedly, even though I'm not pressing the key. When I'm playing a video, it keeps going back to previous timestamps, which normally happens when the left arrow key is pressed. And when I'm typing, the cursor keeps going back to the left of the word or the line, in the middle of typing. When I actively press the key, it stops for some time. But then it happens again later. Also, the active presses on the left arrow key itself have started to not work. I have to press the left key harder than before for it to work when actively pressed. The right arrow key works normally, and so do the other arrow keys. What is the problem here? And how to solve it Note: NO external keyboard is connected submitted by /u/Regular_Focus_725 [link] [comments]

  • Got my Macbook repair complete!
    by /u/Egga22 (Mac) on July 26, 2024 at 10:10 pm

    submitted by /u/Egga22 [link] [comments]

  • what is the error Namespace SIGNAL, Code 6 Abort trap: 6 about?
    by /u/MeeloJeeloDEV (Mac) on July 26, 2024 at 10:04 pm

    Im trying to run a Godot project that was working properly for an entire month, however, today I got a very strange error that never happened, Namespace SIGNAL, Code 6 Abort trap: 6. It quit from my running project after two objects collided three times, into the Mac Terminal application and listing the reason for terminating the project as Namespace SIGNAL, Code 6 Abort trap: 6. Any idea what this is about? submitted by /u/MeeloJeeloDEV [link] [comments]

  • Where to get a reasonably priced Macbook?
    by /u/TheShatteredDiamond (Mac) on July 26, 2024 at 9:09 pm

    Hii! Help, I currently have a MacBook Pro 2019. Unpopular opinion, I love my touch bar and I wish they continued the touch bar but gave people the option to not have one. My battery is bad, and some keys come up when I type. I am a college student in computer science, so I need a device for school. Sometimes my Mac acts up during class, so I have to run to the school's library and rent a Mac there for a day, many times they don't have them in stock. Best Buy offered a $350 credit for me to trade mine in, I went to see their Macs but the cheapest one was like $900. I don't have a lot of money so if anyone knows where I am able to find a Mac for a good price. Thanks in advance! 🤗 submitted by /u/TheShatteredDiamond [link] [comments]

  • So much storage taken from where?!
    by /u/Solid_Debate_6845 (Mac) on July 26, 2024 at 8:40 pm

    Hey guys! I currently have a mac mini attached to a desktop, and I'm trying to clear out space on my Macintosh but I have no idea what is occupying this space. Obviously my pictures are only like ~7 GB but how do I clear like a minimum of 6gb from this 146GB?! I've deleted steam, minecraft, and epic launcher. Yet, I still don't have space in this thing. All I have rn are ofc those pictures, some pdfs that are all 5mb, and roblox 🙁 https://preview.redd.it/4w02wugdexed1.png?width=1396&format=png&auto=webp&s=7cf7d7c5f0b82cb8eaaee0291cbbd565d8a27fa4 submitted by /u/Solid_Debate_6845 [link] [comments]

  • messed up partitions
    by /u/megalodon86 (Mac) on July 26, 2024 at 8:17 pm

    Hi. I messed up my Mac OS Partitions after trying Asahi Linux on my M1 Mac. After deleting Asahi i cannot reclaim the missing space. Can someone help me to restore my Partitions. This is the output of diskutil list https://preview.redd.it/ono8fcb08xed1.png?width=1384&format=png&auto=webp&s=1bcd5d8873092ba9241724e0c0e7232cdc82d27c submitted by /u/megalodon86 [link] [comments]

  • Planning on buying a monitor for my mac
    by /u/nightboi-_- (Mac) on July 26, 2024 at 8:09 pm

    I have a mac m1 air 2020 and im planning on buying a gaming monitor. Im trying to get a monitor that is 1440p and 165 hz and will be connected via display port 1.4 to usb c connection. are there any good monitors for this and will there be any problems in doing so? i need a bigger screen as the macbook 13 inch screen is too small for me to use from a bigger distance and need a better display. Planning on buying the lg 27Gr75Q 1440p monitor 165 hz submitted by /u/nightboi-_- [link] [comments]

  • stripped screw spins but does not turn on 2015 12" macbook retina
    by /u/Tactical-A29 (Mac) on July 26, 2024 at 7:42 pm

    was using right screw driver it just pinned in place and there's no way to grip the top because its fully in its one short screw that's preventing smile repairs submitted by /u/Tactical-A29 [link] [comments]

  • Apple USB SuperDrive issue
    by /u/jtwall2015 (Mac) on July 26, 2024 at 7:29 pm

    Apple USB SuperDrive issue Apple SuperDrive issue Using a clean DVD and it spits it back out. Does the same with CDs Using a MacBook Pro mid 2014. Anyone have an idea how to resolve this? submitted by /u/jtwall2015 [link] [comments]

  • Apple USB SuperDrive issue
    by /u/jtwall2015 (Mac) on July 26, 2024 at 7:29 pm

    Apple USB SuperDrive issue Apple SuperDrive issue Using a clean DVD and it spits it back out. Does the same with CDs Using a MacBook Pro mid 2014. Anyone have an idea how to resolve this? submitted by /u/jtwall2015 [link] [comments]

  • Apple PH - Order stuck on “Processing”; Card already charged
    by /u/Rage-and-Serenity (Mac) on July 26, 2024 at 7:26 pm

    I ordered an M2 Air 16gb custom from the Apple Philippines website. As the title suggests, my order is stuck on processing but my card was already charged the right amount. Anyone with the same experience? How was it resolved? How long did it take for the status of the order to change? Thanks! submitted by /u/Rage-and-Serenity [link] [comments]

  • Confused about Volumes on Hard Drive
    by /u/Cassius_Klay (Mac) on July 26, 2024 at 7:21 pm

    I was looking at the volumes on my Mac hard drive, and was very confused about a few things. Thought I would ask Reddit before freaking out and resetting my whole computer. Attached relevant images. Why are there so many different volumes on my hard drive? I never made any of these, to my knowledge. When I click "Container disk3, what is "VM" - is this a virtual machine? I never downloaded or used a virtual machine on my computer. Also, the file size changed multiple times after I looked at it - when I noticed this yesterday, it was 3GB. Now it is 25KB. When I found "VM" on my computer yesterday, there were three files on it: "swapfile0", "swapfile1", and "swapfile2". Now, all three files have been deleted. When I click "Container disk3", what is the "1 Not Mounted"? Do I have a virus on my computer? Do I need to reset my computer in safe mode? Thank you so much for all the help, I am a computer noob and I was really freaking out yesterday. Link to screenshots: https://imgur.com/a/I7LnFwb Thank you!! submitted by /u/Cassius_Klay [link] [comments]

  • The Last Glowing Apple Logo Chad MacBook Pro (2015)
    by /u/hamfield518 (Mac) on July 26, 2024 at 6:37 pm

    Oh hell yeah! Just ordered it a couple weeks ago. It's a real upgrade compared to my 2006 Mac Mini. And while yes, it is 2.5 times slower than the macbook air m1, but it has twice as much ram and ssd space, and it can also handle native Windows 11! submitted by /u/hamfield518 [link] [comments]

  • Which MacBook Should I Buy?
    by /u/Prince_T_2022 (Mac) on July 26, 2024 at 5:44 pm

    I have to buy a MacBook for school, and as my PC, but I am a bit confused by the differences between the models. I will maybe play some light games and do light video editing, but not too intense games. I am particularly confused by benefits of different unified memory and the number of cores for CPU and GPU. The 4 options I am looking at are: MacBook Pro M3 Pro 11/14 cores CPU/GPU 18 GB Unified Memory 512 GB SSD MacBook Pro M3 Pro 11/14 cores CPU/GPU 36 GB Unified Memory 512 GB SSD MacBook Pro M3 Pro 12/18 cores CPU/GPU 18 GB Unified Memory 1 TB SSD MacBook Pro M3 Pro 12/18 cores CPU/GPU 36 GB Unified Memory 1 TB SSD submitted by /u/Prince_T_2022 [link] [comments]

  • iMac G3 blueberry
    by /u/1997PRO (Mac) on July 26, 2024 at 5:17 pm

    submitted by /u/1997PRO [link] [comments]

  • Does anyone else's Mac have sentimental value to them?
    by /u/LadyKookaburra (Mac) on July 26, 2024 at 5:08 pm

    I know at the end of the day laptops are just tools but does anyone else feel somewhat sentimental about their Mac to the point you'd think twice before trading it in for the next latest and greatest Macbook? Or would you prefer to keep it as a backup machine for sentimental reasons? My own laptop has gotten me through part of undergrad, a masters, and part of a PhD and I think I'd definitely would like to keep it running as long as possible, even if I were to upgrade to a new Mac. submitted by /u/LadyKookaburra [link] [comments]

  • Cant use keyboard in boot screen
    by /u/Ornery_Ingenuity3178 (Mac) on July 26, 2024 at 3:54 pm

    I was trying to load linux mint but i cant use my keyboard in this screen (the setup requires you to press enter to start) (note:this only happens after deleting mac partition) submitted by /u/Ornery_Ingenuity3178 [link] [comments]

  • My macbook air is flickering
    by /u/Wide_Procedure_4335 (Mac) on July 26, 2024 at 2:26 pm

    Hi, my macbook air screen is flickering. Any idea what can be the reason, is it some damage to screen or any software issues. submitted by /u/Wide_Procedure_4335 [link] [comments]

  • Apple iPhone 5 64GB White Good at the Best Price in UAE
    by Fonezone.ae (Apple on Medium) on July 26, 2024 at 2:08 pm

    IntroductionContinue reading on Medium »

  • Apple’ın İki Yüzü
    by Hap Bilgi (Apple on Medium) on July 26, 2024 at 2:01 pm

    🍎 Steve Jobs ve Tim Cook’un Apple’daki efsanevi yolculuğu! Jobs’un vizyonu ve Cook’un analitik liderliği ile Apple zirveye ulaştı. iPhone…Continue reading on Medium »

  • Why Your Account Has Been Disabled in the App Store and iTunes and How to Fix It
    by MacKeeper (Apple on Medium) on July 26, 2024 at 1:59 pm

    Have you encountered the message, “Your account has been disabled in the App Store and iTunes”? This situation can be both annoying and…Continue reading on Medium »

  • WWDC 2024
    by Samet Eğerci (Apple on Medium) on July 26, 2024 at 1:47 pm

    İOS 18 VE APPLE İNTELLİGENCEContinue reading on Sibernetik Topluluğu »

  • Apple iPhone 5 64GB Black Good at Lowest Price in the UAE
    by Fonezone.ae (Apple on Medium) on July 26, 2024 at 1:18 pm

    IntroductionContinue reading on Medium »

  • I Spent $200 on a “Vision Pro”
    by Jacky (Apple on Medium) on July 26, 2024 at 1:15 pm

    A Comprehensive Review of the Knockoff’s Design, Features, and PerformanceContinue reading on Generative AI »

  • Apple iPhone 5 32GB White Good at the Best Price in UAE
    by Fonezone.ae (Apple on Medium) on July 26, 2024 at 12:11 pm

    IntroductionContinue reading on Medium »

  • Is Mac gaming dead?
    by Emily (Apple on Medium) on July 26, 2024 at 12:11 pm

    Here I will teach you how to play games on mac.Continue reading on Medium »

  • Unlocking Excellence: Mastering SOLID Principles for Top-Tier Software Development
    by Ragul M (Apple on Medium) on July 26, 2024 at 11:23 am

    In the dynamic world of software development, maintaining code that is both robust and adaptable is a paramount challenge. This is where…Continue reading on Stackademic »

  • Apple’s Intelligence: A Quiet Revolution
    by Arjun Agarwal (Apple on Medium) on July 26, 2024 at 11:19 am

    Apple has always prided itself on hardware, design, and user experience. But beneath the sleek exteriors and intuitive interfaces lies a…Continue reading on Medium »

  • MacBook Pro: The Ultimate Laptop for Creatives and Professionals
    by John The Carter (MacBook on Medium) on July 26, 2024 at 10:43 am

    In the world of technology, few devices have made as significant an impact as the MacBook Pro. This powerhouse of a laptop has become…Continue reading on Medium »

  • Should I get a m2 MacBook Air 13 16gb or a m3 MacBook Air 13 8gb in 2024?
    by /u/Natureb1rds (Mac) on July 26, 2024 at 10:05 am

    I’m wondering which one is worth more in 2024. submitted by /u/Natureb1rds [link] [comments]

  • Say Goodbye to Cracked or Shattered Screens with Expert Screen Replacement in Auckland
    by 73 Inc - Macbook Buy , Sell & Repair Center (MacBook on Medium) on July 26, 2024 at 8:59 am

    Accidents happen, and one of the most common mishaps for electronic devices is a cracked or shattered screen. Whether it’s a smartphone…Continue reading on Medium »

  • Restoring a Macintosh classic
    by /u/aqwarius (Mac) on July 26, 2024 at 8:57 am

    Hi everyone I got my hands on my dad’s Macintosh classic. It comes with its keyboard and mouse, and power cable. However it does not want to boot. I only get a grey screen with a responsive mouse. Any idea what to do next to get it running again ? Thanx for reading 🙂 submitted by /u/aqwarius [link] [comments]

  • Uninstalled file still exists
    by /u/Purple-Education-798 (Mac) on July 26, 2024 at 6:49 am

    Hi, I’ve already uninstalled this app called Notion Calendar through Settings>General>Storage>Applications and then I deleted it. However, this file still exist here. How can I remove it and plz give me ways to totally delete files cause I’m new to mac. 😭 submitted by /u/Purple-Education-798 [link] [comments]

  • MacBook Mockups
    by Logocraft (MacBook on Medium) on July 26, 2024 at 1:04 am

    Continue reading on Medium »

  • M1 Pro vs M2 Pro vs M3 Pro: The Ultimate MacBook Comparison
    by Kelly Shephard (MacBook on Medium) on July 25, 2024 at 4:00 pm

    M1 Pro vs M2 Pro vs M3 Pro: Discover performance differences, battery life, and real-world tasks to help you choose the best option.Continue reading on Medium »

  • The Little Macbook Air That COULD
    by 5h3ph3rd (MacBook on Medium) on July 25, 2024 at 1:20 pm

    The MacBook Air 2022: Why 8GB RAM is All You Need for Most TasksContinue reading on Medium »

  • Oh, how much I like MacOS's window management...
    by /u/Busy-Discipline4985 (Mac) on July 25, 2024 at 1:13 pm

    https://preview.redd.it/kcxt4rduzned1.png?width=550&format=png&auto=webp&s=7497c66b764800fdb4bf7b0470eac176ea6c4855 see the link if the image didn't open http://wanderingstan.com/wp-content/uploads/2009/07/alt-tab-flowcharts-labeled-2.png submitted by /u/Busy-Discipline4985 [link] [comments]

  • How to run llama3.1 on M1 Mac with Ollama
    by MLAPI (MacBook on Medium) on July 25, 2024 at 10:01 am

    In this blog you will learn how run Llama3.1 on M1 Mac with Ollama.Continue reading on Medium »

  • [DevOps] 把家裡舊的 Macbook 當作 Server 使用
    by PC Chen (MacBook on Medium) on July 25, 2024 at 4:55 am

    發現好像有點久沒有寫技術相關的文章了,今天就來點「微。技術」文好了。好啦其實只是剛好最近換了台新的 Macbook,舊的電腦 2014 Mid Macbook Pro 想想也是賣不出去了,加上擺在那邊也是積灰塵,心血來潮不如就把它當成一個簡易的檔案傳輸 server 好了。Continue reading on 程式乾貨 »

  • Macbook Pro Mockup
    by Gridgenius (MacBook on Medium) on July 25, 2024 at 12:40 am

    Continue reading on Medium »

  • Laptop Mockup
    by Novanavigator (MacBook on Medium) on July 25, 2024 at 12:39 am

    Continue reading on Medium »

  • 2024 Student MacBook Buyer’s Guide
    by Mike Anguilano (MacBook on Medium) on July 24, 2024 at 6:26 pm

    With August right around the corner, that means back-to-school shopping is starting to creep into view. Other than tuition, the other big…Continue reading on Medium »

  • Apple Event Discussion Thread: WWDC 2024 Keynote
    by /u/NSCFType (Mac) on June 10, 2024 at 4:52 pm

    submitted by /u/NSCFType [link] [comments]

How to pipe grep on command line on windows and Linux

How to pipe grep on command line on Windows and Linux?

Let’s find how to pipe grep or find a specific string after running a command using shell, batch and powershell (windows and Linux)

  • On Linux via shell

    ls -al | grep filename

  • On Windows via powershell

    GetChildItem | Select-Object “filename”
    or
    GetChildItem | where-Object {$_ -match “filename”}

  • On Windows via batch

    Dir | findstr “filename”

On both Windows and Linux, you can use the grep command in combination with the | (pipe) operator to filter the output of another command. The | operator takes the output of the command on the left and passes it as input to the command on the right.

Here is an example of how to use the grep command with the | operator on both Windows and Linux:

On Linux:

# List all the files in the current directory and filter the output to show only the files that contain the word "example"
ls | grep example

On Windows:

# List all the files in the current directory and filter the output to show only the files that contain the word "example"
dir | findstr example

In this example, the ls (Linux) or dir (Windows) command lists all the files in the current directory, and the grep (Linux) or findstr (Windows) command filters the output to show only the lines that contain the word “example”.

You can use the grep command with the | operator in combination with other command-line utilities to perform various tasks. For example, you can use the grep command to filter the output of the ps command to show only the processes that contain a particular string in their command line arguments.

# Show all the processes that contain the string "python" in their command line arguments
ps -aux | grep python

I hope this helps! Let me know if you have any questions.

reverse a string on Linux and Windows

How to reverse a string on Linux and Windows

On Linux:

  1. Using the rev command: The rev command is a utility that reverses the lines of a file or the characters in a string. To reverse a string, you can use the echo command to pass the string to rev:
echo "string" | rev
  1. Using the sed command: The sed command is a powerful utility that can perform various text transformations. To reverse a string, you can use the sed command with the -r option and the 's/.*(.)/\1/g' expression:
echo "string" | sed -r 's/.*(.)/\1/g'
  1. Using the awk command: The awk command is a programming language that is used for text processing. To reverse a string, you can use the awk command with the {print} action:
echo "string" | awk '{print $1}'

On Windows:

  1. Using the powershell command: The powershell command is a shell that provides a command-line interface for Windows. To reverse a string, you can use the powershell command with the -C option and the '[System.Text.Encoding]::Unicode.GetString([System.Text.Encoding]::Unicode.GetBytes("string"))' expression:
powershell -C "[System.Text.Encoding]::Unicode.GetString([System.Text.Encoding]::Unicode.GetBytes("string"))"
  1. Using the cmd command: The cmd command is the command-line interpreter for Windows. To reverse a string, you can use the cmd command with the for loop:
cmd /c "for /L %i in (1,1,%len%) do @echo !string:~%len%-%i,1!"

These are some ways to reverse a string on Linux and Windows. There are other ways to achieve this, using different utilities or programming languages.

Via shell script on Linux

reverse a string on Linux and Windows

sh-3.2# vi reverse.sh
#### Start Script #####
#!/bin/bash
input_string=”$1″
reverse_string=””

input_string_length=${#input_string}
for (( i=$input_string_length-1; i>=0; i– ))
do
reverse_string=”$reverse_string${input_string:$i:1}”
done

echo “$reverse_string”
##### End Script #####

Let’s run it:

sh-3.2# chmod 775 reverse.sh
sh-3.2# ./reverse.sh Etienne
enneitE

Via powershell script on Windows

#Let’s use the script reverse.ps1 below.
######
$string=”Etienne”
$string_array=$string -split “”
[array]::Reverse($string_array)
$string_array -join ”

#####Output#####
PS C:\Users\etienne_noumen\Documents\Etienne\Scripting> .\reverse.ps1

E t i e n n e

enneitE

Via powershell script on Windows in one line

([regex]::Matches($String,’.’,’RightToLeft’) | ForEach {$_.value}) -join ”

Via batch script on Windows

::Note: ReverseStr also calls StrLen
::and string length is not greater than 80 chars
:: but can be changed.

@echo off
SetLocal EnableDelayedExpansion
cls
set Str=Etienne
call :StrLen %Str%
echo Length=%Len%
call :ReverseStr %Str%
echo String=%Str%
echo Reverse Str=%Reverse%
exit /b

::—————-
:: Calc Var Length
::—————-
:: %*=Str to Check
:: Returns %Len%
:: —————
:StrLen %*
set Data=%*
for /L %%a in (0,1,80) do (
set Char=!Data:~%%a,1!
if not “!Char!”==”” (
set /a Len=%%a+1
) else (exit /b)
)
exit /b

::—————
:: Reverse String
::—————
:: %* Str to Reverse
:: Returns %Reverse%
::——————
:ReverseStr %*
set Data=%*
call :StrLen %Data%
for /L %%a in (!Len!,-1,0) do (
set Char=!Data:~%%a,1!
set Reverse=!Reverse!!Char!
)
exit /b

Via perl script on Windows or Linux

Via python script on Windows or Linux

def reverse_string(a_string)
return a_string[::-1]
reverse_string(“etienne”) returns “enneite”
Source:

  1. http://www.computing.net/answers/programming/reverse-a-string-in-dos/26004.html

Remove all empty lines in a file

How to Remove all empty lines in a file on Linux and Windows?

Remove empty lines from file.txt via Linux command line

  • Option 1: sed -i ‘/^$/d’ file.txt
  • Option 2: awk ‘NF > 0’ file.txt > output.txt
  • Option 3: perl -i.backup -n -e “print if /\S/” file.txt
  • Option 4: grep . file.txt > output.txt

Remove empty lines from file.txt using Powershell script on Windows
  • (gc file.txt) | ? {$_.trim() -ne “” } | set-content file.txt
  • Windows Boot process

    Windows Boot Process

    What is involved in Windows Boot Process:

    The Windows boot process involves several stages, in which the operating system performs various tasks to prepare the system for use.

    1. The BIOS (Basic Input/Output System) runs a power-on self-test (POST) to check the system’s hardware components and to load the bootstrap program.
    2. The bootstrap program, also known as the boot loader, is responsible for loading the operating system kernel and transferring control to it. In Windows, the boot loader is called the bootmgr.
    3. The operating system kernel, which is the core of the operating system, initializes the system and starts the system services.
    4. The system services, such as the device drivers, are loaded and initialized.
    5. The operating system loads the user profile and starts the user interface, such as the desktop or the login screen.
    6. The user can log in and start using the system.

    This is a general overview of the Windows boot process. The exact sequence of events may vary depending on the specific version of Windows and the hardware configuration of the system.

    Windows_Booting_Procedure

      • Power is turned on.
      • The first process starting when you turn on your computer is BIOS i.e, Basic Input Output System. BIOS has two functions, to conduct POST and read MBR.
        1. POST – POST stands for Power On Self Test. POST checks all the hardware devices connected to a computer like RAM, hard disk etc and make sure that the system can run smoothly with those hardware devices. If the POST is a failure the system halts with a beep sound.
        2. Now BIOS checks the boot priority. We can set the boot priority as CD drive, hard disk or floppy drive
        3. MBR – The next duty of BIOS is to read the MBR. MBR stands for Master Boot Record and its the first sector on a hard disk. MBR
          contains the partition table and boot loader.
      • Functions of Boot loader
        Now BIOS has passed the control to boot loader and boot loader is a small program which loads kernel to computers memory. Actually there are two stages of boot loaders, stage 1 boot loader and stage 2 boot loader. MBR contains the stage 1 boot loader and stage 1 boot loader is a link to the stage 2 boot loader. The stage 2 boot loader resides in the boot partition and it loads the kernel to memory.
      • Boot files and functions
        There are three boot files in a Windows operating system and they are NTLDR, NTDETECT.COM and Boot.ini. The boot files are found in the active partition of hard disk and its normally C drive in a Windows machine.

        1. NTLDR – NTLDR stands for NT Loader and its the second stage bootloader. The path of NTLDR is C:\Windows\i386\NTLDR.
        2. Boot.ini – Boot.ini contains the configuration files of NTLDR. When the operating system is loaded we cannot pass any arguments to kernel, so those arguments are passed through boot.ini. You can edit boot.ini by opening through notepad. The path of Boot.ini is C:\boot.ini.
        3. NTDETECT.COM – This file detect hardware’s and passes information to NTLDR. Using the collected information the NTLDR creates a hardware key and this key is used to detect hardware’s. A new hardware key is generated after each reboot of the operating system and that’s why system asks to reboot after installation of a new hardware. The hardware keys created by NTLDR can be found in Windows registry at
          HKEY_LOCAL_MACHINE -> HARDWARES.
      • Kernel and its functions
        After executing the functions of boot files the control is passed to Kernel. ntoskrnal.exe is the kernel file in a Windows machine and its path is C:\Windows\system 32\ntoskrnal.exe. Kernel acts as a layer between software and hardware. The library file hal.dll (C;\Windows\system32\hal.dll) helps Kernel to interact with hardware’s. HAL stands for Hardware Abstraction Layer and this hal.dll file is
        machine specific. Now the drivers for hardware’s are loaded from the file C:\Windows\system32\config\system and the Kernel is loaded to primary memory.
    • Services and log in procedure
      When kernel is loaded in the primary memory services for each process is started and the registry entry for those services can be found at HKEY_LOCAL_MACHINE – System – Current control set – Services.
      Winlogon.exe (C:\Windows\system32\winlogon.exe) is the last service started during this process.
      Winlogon.exe starts the log in procedures of windows machine. It first calls the library file msgina.dll (C:\Windows\system32\msgina.dll). MSGINA stands for Microsoft Graphics Identification and Authentication and it provides the log in window. Now msginal.dll passes the control to LSA (Local Security Authority), it verifies the username and password from the SAM file. SAM (Security Accounts Manager) contains the information about all users created in a Windows operating system.
      Now the booting procedure is over and we have reached the desktop of Windows operating system.

    Source:

    1. Windows Booting Process
    2. Understanding the boot process

    List only regular file names in a directory

    How to List only regular file names in a directory on Linux and Windows

    Listing regular files in a directory without including . and .. files.


    • On Linux

      Solution 1:$ ls -p | grep -v /
      Solution 2: $ ls -F | grep -v ‘[/@=|]’
      Solution 3: $for list in `ls` ; do ls -ld $list | grep -v ^d > /dev/null && echo $list ; done ;
      Solution4:$ for list in `ls` ; do ls -ld $list | grep ^d > /dev/null || echo $list ; done ;
      Solution5 (exclude sym links):$ for list in `ls` ; do ls -ld $list | grep -v ^l > /dev/null && echo $list ; done ;


    • On Windows

      Solution 1: dir /a-d /b >..\File_List.txt

    Set Date and time via command line

    Let’s find out how to set Date and time via command line on linux and windows:

    • On Linux via terminal

      System time (Must have sudo privilege)
      date -s ‘2015-07-28 15:27:30’
      Hardware time
      Let’s set the hardware clock to the current system time:
      hwclock –systohc

    • On Windows via command prompt terminal

      System time (Must have Administrator privilege)
      date
      The current date is: 07/28/2015
      Enter the new date: (mm-dd-yy)_
      time
      The current time is: 15:34:03.44
      Enter the new time: _

    Replace all instances of a string in a file

    How to Replace all instances of a string in a file?

    How to Replace all instances of a string in a file?

    1. Open the file in read mode using the open() function.
    2. Read the contents of the file into a string using the read() method.
    3. Use the replace() method to replace all instances of the target string with the new string.
    4. Open the file in write mode using the open() function.
    5. Write the modified string to the file using the write() method.
    6. Close the file using the close() method.

    Here is an example code snippet:

    How to Replace all instances of a string in a file?
    How to Replace all instances of a string in a file?

    This will replace all instances of old_string with new_string in the file file.txt.

    # Open the file in read mode
    with open(‘file.txt’, ‘r’) as f:
    # Read the contents of the file into a string
    contents = f.read()

    # Replace all instances of the target string
    contents = contents.replace(‘old_string’, ‘new_string’)

    # Open the file in write mode
    with open(‘file.txt’, ‘w’) as f:
    # Write the modified string to the file
    f.write(contents)

    # Close the file
    f.close()

    Shell script to replace all instances of a string in a file on Linux & Windows.

    • On Linux via bash script

      sed “s/$stringToReplace/$replaceWith/g” $File_Name > $File_Name

    • On Windows using Powershell

      ( get-content $File_Name ) | % { $_ -replace $stringToReplace, $replaceWith } | set-content $File_Name

    • On Windows using Batch

      set str=teh cat in teh hat
      echo.%str%
      set str=%str:teh=the%
      echo.%str%

      Script Output:
      teh cat in teh hat
      the cat in the hat

    • On Windows or Linux using Perl

      perl -pi.orig -e “s///g;”

    • On Windows or Linux using Python

    Source:

    1. http://stackoverflow.com/questions/60034/how-can-you-find-and-replace-text-in-a-file-using-the-windows-command-line-envir

    Search all files containing a specific string

    How to search all files containing a specific string on Linux and Windows?

    • On Linux

      grep -rnw ‘directory’ -e “pattern”
      grep –include=\*.{txt,log} -rnw ‘directory’ -e “pattern”
      This will only search for files with .txt or .log extension.
      grep –exclude=*.txt -rnw ‘directory’ -e “pattern”
      This will exclude files with .txt extensions.

    • On Windows

      CD Location
      FINDSTR /L /S /I /N /C:”pattern” *.log

    Ace the 2023 AWS Solutions Architect Associate SAA-C03 Exam with Confidence Pass the 2023 AWS Certified Machine Learning Specialty MLS-C01 Exam with Flying Colors

    List of Freely available programming books - What is the single most influential book every Programmers should read



    #BlackOwned #BlackEntrepreneurs #BlackBuniness #AWSCertified #AWSCloudPractitioner #AWSCertification #AWSCLFC02 #CloudComputing #AWSStudyGuide #AWSTraining #AWSCareer #AWSExamPrep #AWSCommunity #AWSEducation #AWSBasics #AWSCertified #AWSMachineLearning #AWSCertification #AWSSpecialty #MachineLearning #AWSStudyGuide #CloudComputing #DataScience #AWSCertified #AWSSolutionsArchitect #AWSArchitectAssociate #AWSCertification #AWSStudyGuide #CloudComputing #AWSArchitecture #AWSTraining #AWSCareer #AWSExamPrep #AWSCommunity #AWSEducation #AzureFundamentals #AZ900 #MicrosoftAzure #ITCertification #CertificationPrep #StudyMaterials #TechLearning #MicrosoftCertified #AzureCertification #TechBooks

    Top 1000 Canada Quiz and trivia: CANADA CITIZENSHIP TEST- HISTORY - GEOGRAPHY - GOVERNMENT- CULTURE - PEOPLE - LANGUAGES - TRAVEL - WILDLIFE - HOCKEY - TOURISM - SCENERIES - ARTS - DATA VISUALIZATION
    zCanadian Quiz and Trivia, Canadian History, Citizenship Test, Geography, Wildlife, Secenries, Banff, Tourism

    Top 1000 Africa Quiz and trivia: HISTORY - GEOGRAPHY - WILDLIFE - CULTURE - PEOPLE - LANGUAGES - TRAVEL - TOURISM - SCENERIES - ARTS - DATA VISUALIZATION
    Africa Quiz, Africa Trivia, Quiz, African History, Geography, Wildlife, Culture

    Exploring the Pros and Cons of Visiting All Provinces and Territories in Canada.
    Exploring the Pros and Cons of Visiting All Provinces and Territories in Canada

    Exploring the Advantages and Disadvantages of Visiting All 50 States in the USA
    Exploring the Advantages and Disadvantages of Visiting All 50 States in the USA


    Health Health, a science-based community to discuss health news and the coronavirus (COVID-19) pandemic

    Today I Learned (TIL) You learn something new every day; what did you learn today? Submit interesting and specific facts about something that you just found out here.

    Reddit Science This community is a place to share and discuss new scientific research. Read about the latest advances in astronomy, biology, medicine, physics, social science, and more. Find and submit new publications and popular science coverage of current research.

    Reddit Sports Sports News and Highlights from the NFL, NBA, NHL, MLB, MLS, and leagues around the world.

    Turn your dream into reality with Google Workspace: It’s free for the first 14 days.
    Get 20% off Google Google Workspace (Google Meet) Standard Plan with  the following codes:
    Get 20% off Google Google Workspace (Google Meet) Standard Plan with  the following codes: 96DRHDRA9J7GTN6 96DRHDRA9J7GTN6
    63F733CLLY7R7MM
    63F7D7CPD9XXUVT
    63FLKQHWV3AEEE6
    63JGLWWK36CP7WM
    63KKR9EULQRR7VE
    63KNY4N7VHCUA9R
    63LDXXFYU6VXDG9
    63MGNRCKXURAYWC
    63NGNDVVXJP4N99
    63P4G3ELRPADKQU
    With Google Workspace, Get custom email @yourcompany, Work from anywhere; Easily scale up or down
    Google gives you the tools you need to run your business like a pro. Set up custom email, share files securely online, video chat from any device, and more.
    Google Workspace provides a platform, a common ground, for all our internal teams and operations to collaboratively support our primary business goal, which is to deliver quality information to our readers quickly.
    Get 20% off Google Workspace (Google Meet) Business Plan (AMERICAS): M9HNXHX3WC9H7YE
    C37HCAQRVR7JTFK
    C3AE76E7WATCTL9
    C3C3RGUF9VW6LXE
    C3D9LD4L736CALC
    C3EQXV674DQ6PXP
    C3G9M3JEHXM3XC7
    C3GGR3H4TRHUD7L
    C3LVUVC3LHKUEQK
    C3PVGM4CHHPMWLE
    C3QHQ763LWGTW4C
    Even if you’re small, you want people to see you as a professional business. If you’re still growing, you need the building blocks to get you where you want to be. I’ve learned so much about business through Google Workspace—I can’t imagine working without it.
    (Email us for more codes)