Lifestyle
Linux and WSL CLI environments
Distinguish host and WSL tools, paths and accounts, then run the exercise and update from the right environment.
About 12 min read · Practice 30 min

On this page
Back to the Codex learning hubCodex learning hub: tutorial directoryA planned 60-lesson, ten-unit Codex curriculum, from setup and your first task to MD instructions and advanced integrations. Find your next lesson by experience, platform, goal or command; unpublished entries show their status.Read the full article
Goal and two entry routes
On a Linux computer, open its terminal and begin at step two. Windows users should decide whether Linux tooling is needed; native PowerShell can run Codex without WSL. Choose WSL2 for an existing Linux workflow or Linux-dependent project. It is an alternative to Windows CLIWindows CLI setup and troubleshootingInstall and sign in from PowerShell, check command discovery, read a project and troubleshoot updates.Read the full article, not an automatic migration for every Windows installation error.
Diagram 1 identifies the command environment, 2 installs and enters the Linux project, and 3 verifies files from that environment. Linux home directories, tools and credentials are separate by default. A successful Windows codex --version does not establish installation inside Ubuntu, and WSL authentication alone does not establish sign-in in the Windows desktop client.
Step 1: Windows users verify WSL2
Run this query in Windows PowerShell and inspect the distributions and VERSION column for 2. It is not a Linux-shell command. Preserve an existing WSL2 distribution. The current Codex Linux sandbox does not support WSL1. If your work is in WSL1, back it up and plan conversion with Microsoft's documentation rather than experimenting on its only copy.
wsl --list --verbose
Check winver first: Microsoft’s simplified wsl --install procedure requires Windows 11 or Windows 10 version 2004 (build 19041) or later. Older versions require the official manual installation procedure rather than the command below. If WSL is absent, confirm virtualization/WSL is permitted and follow Microsoft's instructions to run wsl --install in administrator PowerShell. Complete any requested reboot and Linux-user creation. This installs an operating-system environment, not just an npm package, so allow time to interrupt other work. Follow managed-device policy rather than bypassing it.
wsl --install
With several distributions, use wsl --distribution followed by the full name shown in your list, quoted as needed, from PowerShell. Select the distribution before installing. Finding codex in distribution A does not establish its availability in B. If you later return to PowerShell, inspect command resolution again rather than applying Linux installation or file-hash records to Windows.
After setup, select your distribution in Terminal or run wsl from ordinary PowerShell to open the default distribution. With multiple distributions, choose the actual name shown by wsl --list --verbose rather than assuming Ubuntu exists. Once inside, prompts and paths use Linux conventions. All following steps run in that Linux shell.
Step 2: identify the shell, CLI and home directory
uname -s
pwd
printf '%s\n' "$WSL_DISTRO_NAME"
command -v codex
type -a codex
Expect Linux from uname. WSL_DISTRO_NAME identifies the distribution in WSL; an empty value on ordinary Linux is normal. Inspect command -v and type -a for the intended Linux installation. A Windows wrapper under /mnt/c is not evidence of a native Linux installation. Record the source, install inside Linux and verify which command the shell subsequently selects.
For a new installation, verify and run the official standalone command, read the PATH instructions and open a new Linux terminal. Existing npm users can verify node/npm inside the same Linux environment and use npm install -g @openai/codex. Windows Node.js is not a substitute for that Linux setup. Choose one channel and keep updates consistent.
curl -fsSL https://chatgpt.com/codex/install.sh | sh
command -v codex
codex --version
codex --help
Match installer output, executable path and version. If curl, sh or system utilities are missing, prepare them using your distribution's documentation rather than another distribution's package commands. CLI startup does not establish project dependencies or working sandbox execution; the file task checks the next layer.
Step 3: create the exercise in Linux home
For WSL work executed by Linux tools, prefer Linux home such as ~/code. /mnt/c is a Windows filesystem mount, not another name for the same /home project. Leave production repositories in place for this exercise. The block below creates a new folder and stops without overwriting if it exists. Choose a new name if needed. It runs in a subshell; explicitly enter the folder afterward.
(
set -e
cd ~
mkdir 'codex linux lab'
cd 'codex linux lab'
printf '%s\n' 'LINUX-CLI-01' > note.txt
cp note.txt note.original.txt
pwd
ls
)
Run the next block only after creation succeeds. A File exists error from mkdir protects prior data; it is not a reason to add sudo. Choose a new directory. After entering, expect two files, LINUX-CLI-01 and matching SHA-256 hashes. This compares identical local bytes, not a required match to Windows file hashes.
cd ~/"codex linux lab"
pwd
cat note.txt
sha256sum note.txt note.original.txt
Step 4: authenticate and read in that Linux environment
codex login
codex login status
codex --sandbox read-only
Wait for each command and follow the actual sign-in flow. WSL may use the host browser, but return to the Linux terminal to verify completion. Without a browser or working local callback, consult codex login --help and the official authentication page. Use codex login --device-auth only when your account and organization permit device authentication. Do not copy Windows credential files into a project as a login fix.
Read note.txt and note.original.txt in the current Linux practice directory. Report the current directory and the exact marker, and check whether both files match. Do not edit, create files, or use external services. Stop and report any missing file or access error.
That is a Codex prompt, not a bash command. Expect the Linux practice directory, LINUX-CLI-01 and an actual read record. Next, request nonexistent note-missing.txt in the same Codex session and expect an explicit absence report without creation. Then use /exit to return to the shell and rerun sha256sum, cat and ls to confirm no changes. Both outcomes connect installation, authentication, location and reading into a verified workflow.
Files, updates and troubleshooting
| Location or tool | Environment | How to check |
|---|---|---|
| C:\Users path | Native Windows | Get-Location in PowerShell |
| Project under /home | Linux / WSL filesystem | pwd in Linux shell |
| Project under /mnt/c | Windows drive mounted in Linux | Do not confuse it with a /home copy |
| Linux codex | CLI selected by Linux shell | Check command -v and version together |
For slow Linux-tool workloads under /mnt/c, compare a new practice copy in Linux home before moving or deleting the only original. To inspect WSL through File Explorer, use the documented \\wsl$ entry and choose the actual distribution. This accesses Linux files; it does not synchronize two copies. Identify directories through markers and pwd, not matching names alone.
Exit CLI and record the work summary before updating. Use the Linux installer again for standalone, or npm in the same Linux environment for npm installations. Check command -v and version in a new shell. wsl --update updates WSL, not Codex CLI; wsl --shutdown stops running WSL work and is not a routine required Codex installation step.
If the shell can read but Codex cannot, record sandbox startup/access errors, confirm WSL2 and the distribution, and follow permissionsPermissions, sandbox, network and keysSandbox rules define technical access to files and networks; approval policy determines when the agent asks before acting. No prompt does not guarantee permission, and read access does not imply write access everywhere.Read the full article rather than disabling sandboxing by default. Missing old sessions may reflect a different distribution, Linux user or CODEX_HOME. This lesson does not share credential directories across environments. Return to CLI basicsInstall and start Codex CLIChoose an installation platform, sign in, inspect a file, make a one-line change, verify it independently and resume the session. Includes a repeatable two-file exercise and a missing-file test.Read the full article for editing/restoration, then context handoffContext and task handoffLong work needs durable decisions and evidence, not just a long conversation. README explains use, design documents explain choices, handoffs record current progress and AGENTS.md holds ongoing instructions. Do not turn all temporary progress into permanent rules.Read the full article.
Back to the Codex learning hubCodex learning hub: tutorial directoryA planned 60-lesson, ten-unit Codex curriculum, from setup and your first task to MD instructions and advanced integrations. Find your next lesson by experience, platform, goal or command; unpublished entries show their status.Read the full article
Read the full description
Three numbered stages: identify the starting point, perform the exercise, and verify the result. Original illustration, not a product screenshot.
Lifestyle
Codex learning hub: tutorial directory
A planned 60-lesson, ten-unit Codex curriculum, from setup and your first task to MD instructions and advanced integrations. Find your next lesson by experience, platform, goal or command; unpublished entries show their status.
Lifestyle
Worktrees and isolated tasks
A Git worktree gives one repository multiple working directories on different branches. It isolates file edits, but databases, ports and external services may still be shared. File isolation is not full resource isolation.
Lifestyle
Workshop: build a small website
Plan and build the Small Steps task website from brief.md, with adding, completing, deleting, filtering and local persistence. Separate HTML, CSS, data functions, UI events and tests, verify with Node and browser checks, and document restart and recovery steps.
Lifestyle
Usage and efficiency: reducing rework
Record task conditions, model options, time and outcomes to reduce unnecessary retries and excess context.
Articles that cite this one
Latest travel guides

GuideTokyo
Where to Stay in Tokyo: Comparing Shinjuku, Ueno, Tokyo Station, Shibuya, Asakusa, Ikebukuro, and Ginza, Plus Airport Access, Accommodation Tax, and Luggage Delivery
Where should you stay in Tokyo? Compare Shinjuku, Ueno, Tokyo Station, Shibuya, Asakusa, Ikebukuro, and Ginza by the same criteria: access from Narita and Haneda, transit routes, nearby attractions, neighborhood character, and who each area suits. Includes a comparison table, a Yamanote Line diagram, Tokyo’s accommodation tax as verified in 2026/9 (changing to 3% in 2027/4), and Airport TA-Q-BIN luggage shipping rules.
- Budget
- Hotels

GuideTokyo
How to Choose Tokyo Transit Passes: Are Suica, Welcome Suica, the Tokyo Subway Ticket, and the JR Pass Worth It?
On a first Tokyo trip, start with an IC card and pay per ride (Welcome Suica has no deposit and is valid for 28 days). If you take four or more subway rides in a day, add a 72-hour Tokyo Subway Ticket for 2,000 yen; a JR Pass is never worthwhile if you stay in Tokyo and do not go to Kansai. See what TOURIST PASMO, Suica on iPhone, and the Tokyo Metro day pass do and do not cover, with a decision chart. Prices verified in September 2026.
- Transport
- Budget

GuideTokyo
Tokyo Disneyland and DisneySea Guide: Ticket Prices, Fantasy Springs, Disney Premier Access (DPA), Standby Pass, and Which Park to Choose for Your First Visit
Tokyo Disney one-day Passport prices vary: most weekdays in 9/2026 cost ¥9,900 and weekends ¥10,900. At 14:00 daily, tickets go on sale for the same date two months later. Free Priority Pass is no longer on the official service list; only paid Disney Premier Access (¥1,000–3,500 per person per use) shortens waits. Covers hours, the 25th anniversary, Standby Pass, Entry Request, Fantasy Springs access and first-visit park choice; checked on the official site in 9/2026.
- Itineraries
- Family
Sources
- Codex CLI · Checked:
- Authentication · Checked:
- Developer commands · Checked:
- WSL with Codex · Checked:
- Windows app and WSL authentication separation · Checked:
- Install WSL · Checked:
- WSL commands · Checked: