Intro to Unix and shell

Published

Mon, 8 of September, 2025

Modified

Mon, 8 of September, 2025

Reference

Great (paid) LinkedIn course by Kevin Skoglund “Unix essential training”

What is Unix?

  • an OS developed by AT&T employes at Bell Labs in the 1960s/70s
  • in 1972 it is rewritten in C programming, which made it portable. It then spread outside AT&T
  • it still powers devices all around
  • you can use it from the Command line or from GUI interfaces

What are the kernell and shell?

  • kernel is the core of the OS. it allocates time and memory to processes
  • shells is the outer layer of the OS. it sends requests to the kernel
    • you can choose from different shells (sh, bash, zsh, etc.)

Fundamental

  • Ctrl + C = Cancel/stop the current command (SIGINT)
  • Ctrl + Z = Pause current command (suspend, SIGTSTP)
    • fg Resume the last paused command
  • Ctrl + a = start of the command
  • Ctrl + e = end of the command
  • q = close dialogue
  • Ctrl + L → clears the terminal screen (but not history)

Mac is a “Unix system”

The macOS is a Unix-native system, i.e. it is built on a Unix core (Darwin). This enables you to use Unix commands in the terminal, as opposed to Windows, which is built on a different core.

Why Mac is preferred for programming?

  • Mac has a better terminal emulator (Terminal, iTerm2) than Windows (Command Prompt, PowerShell)
  • MacOS is more stable and less prone to viruses than Windows
  • Mac with chip Apple Silicon (M1, M2, M3) has better performance and energy efficiency than Windows laptops with Intel or AMD processors
  • Mac is a Unix system, so you can use Unix commands in the terminal (e.g. ls, cd, mv, cp, rm, etc.)
    • [On Windows, to run Unix commands, you need to install a Unix-like environment, e.g. 
      • WSL (Windows Subsystem for Linux)
      • Cygwin (a large collection of GNU and Open Source tools which provide functionality similar to a Linux distribution on Windows)
      • Git Bash](an application for Microsoft Windows environments which provides a bash emulation used to run Git from the command line.)

MacOS and open source software

  • MacOS is more compatible with open-source software and tools used in data science (e.g. R, Python, etc.)
  • Many libraries and packages used in data science are developed and tested first on Unix/Linux systems, so they may work better on MacOS than on Windows.
  • Some dependencies and tools may not be available or may require additional configuration on Windows (Rcpp, devtools, spacy, etc.)
  • Homebrew, which is a popular package manager for MacOS (& Linux), makes it easy to install and manage open-source software and tools (es. git, python, r, node, wget, ecc.). Plus, it avoids having to download different installers, configure PATHS, manage version conflicts etc.
    • Windows alternatives would be Chocolatey or winget, but they are not as widely used or supported as Homebrew.
  • Docker, which is a popular containerization platform used in data science, also works better on MacOS than on Windows, as it uses a Linux kernel to run containers.
Table 1: Comparison of macOS/Unix vs Windows for Data Science Workflows

Area

macOS_Unix

Windows_Standard

Windows_Positron

Shell / PATH

Single Unix shell (zsh/bash). PATH always coherent.

Multiple shells (CMD, PowerShell, Git Bash, WSL). Frequent PATH conflicts.

Positron manages interpreters better, but PATH issues remain.

R & Packages

CRAN install + compilation works out of the box.

Requires Rtools for many packages → extra step, errors likely.

Still requires Rtools. Positron smooths management but OS issue remains.

Python & Envs

Native support. venv/conda integrate with terminal.

Multiple installs common. PATH confusion across shells.

Positron can choose envs in IDE, but conflicts outside remain.

Git / GitHub

Git native via Xcode CLI or Homebrew. One SSH dir (~/.ssh).

Git for Windows + Git Bash + WSL = multiple key locations, SSH mismatches.

Positron integrates Git/GitHub login, centralizing SSH inside IDE.

Docker / Containers

Native support. ARM64 stable on Apple Silicon.

Needs WSL2/Hyper-V → overhead, resource heavy.

Still needs WSL2/Hyper-V. Positron smooths workflow but not overhead.

IDE

RStudio, VS Code, PyCharm run natively with Unix shell.

RStudio and VS Code work, but rely on Git Bash/WSL.

Positron unifies R, Python, Quarto, Git → single IDE lowers friction.

Maintenance

Minimal IT support needed. Easy updates via Homebrew.

Frequent issues with PATH, Rtools, Docker/WSL, SSH keys.

Less IDE friction, but IT still needed for OS-level issues.

Table 2: Comparison of macOS/Unix vs Windows for Data Science Workflows

Area

macOS_Unix

Windows_Standard

Windows_Positron

Shell / PATH

Unica shell Unix (zsh/bash). PATH sempre coerente.

Più shell (CMD, PowerShell, Git Bash, WSL). Conflitti PATH frequenti.

Positron gestisce meglio gli interpreti, ma i problemi di PATH restano.

R & Pacchetti

Installazione da CRAN + compilazione funziona subito.

Richiede Rtools per molti pacchetti → passaggio extra, errori possibili.

Rtools serve comunque. Positron semplifica la gestione, ma il problema rimane.

Python & Ambienti

Supporto nativo. venv/conda integrati col terminale.

Spesso più installazioni (system, Anaconda, Store). Conflitti PATH tra shell.

Positron può scegliere l’ambiente in IDE, ma i conflitti fuori restano.

Git / GitHub

Git nativo via Xcode CLI o Homebrew. Una sola directory SSH (~/.ssh).

Git for Windows + Git Bash + WSL = directory multiple, conflitti SSH.

Positron integra Git/GitHub con login centralizzato alle chiavi SSH.

Docker / Container

Supporto nativo. ARM64 stabile su Apple Silicon.

Richiede WSL2/Hyper-V → overhead, consumo risorse elevato.

WSL2/Hyper-V servono comunque. Positron semplifica i workflow ma non l’overhead.

IDE

RStudio, VS Code, PyCharm girano nativamente con shell Unix.

RStudio e VS Code funzionano, ma dipendono da Git Bash/WSL.

Positron unifica R, Python, Quarto, Git → un solo IDE riduce gli attriti.

Manutenzione

Minimo supporto IT. Aggiornamenti facili con Homebrew.

Problemi frequenti con PATH, Rtools, Docker/WSL, chiavi SSH.

Meno problemi lato IDE, ma l’IT serve ancora per i conflitti del sistema operativo.