惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
L
LangChain Blog
雷峰网
雷峰网
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
T
Tailwind CSS Blog
V
Visual Studio Blog
博客园_首页
Apple Machine Learning Research
Apple Machine Learning Research
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 司徒正美
有赞技术团队
有赞技术团队
J
Java Code Geeks
酷 壳 – CoolShell
酷 壳 – CoolShell
大猫的无限游戏
大猫的无限游戏
Engineering at Meta
Engineering at Meta
B
Blog
Recent Announcements
Recent Announcements
C
Check Point Blog
MongoDB | Blog
MongoDB | Blog
GbyAI
GbyAI
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
F
Full Disclosure
Microsoft Security Blog
Microsoft Security Blog
N
Netflix TechBlog - Medium
I
InfoQ
云风的 BLOG
云风的 BLOG
量子位
D
Docker
D
DataBreaches.Net
Vercel News
Vercel News
Blog — PlanetScale
Blog — PlanetScale
宝玉的分享
宝玉的分享
V
V2EX
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Y
Y Combinator Blog
美团技术团队
小众软件
小众软件
阮一峰的网络日志
阮一峰的网络日志
博客园 - 聂微东
B
Blog RSS Feed
MyScale Blog
MyScale Blog
月光博客
月光博客
T
The Blog of Author Tim Ferriss
WordPress大学
WordPress大学
aimingoo的专栏
aimingoo的专栏
M
MIT News - Artificial intelligence
U
Unit 42
Google DeepMind News
Google DeepMind News

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Commanding the Command Line
Phillip A. Wessels · 2026-05-26 · via DEV Community

You may experience some emotions of trepidation when staring at the empty prompt in the terminal.

$

That is very normal for beginners. But I want you to rewrite the story you're telling yourself from:

❌ I am going to mess something up with this.

to:

🚀 I am going to take off with this.

The command line does have deep functionality -- but it also has basics, and they're not complicated. By the time you finish this article, you'll understand those basics, and you can start to find your flow in the command line. Now let's get into:

  • Bash (your shell if you're on Windows or Linux)
  • Zsh (your shell if you're on macOS)

Either way, in the VS Code integrated terminal!

What does the command line do?

The command line allows you to interact with the operating system through the shell in your terminal.

Why use the command line interface (CLI) instead of a graphical user interface (GUI)?

  • It gives more control. There are things you can only do via the command line.
  • Because typing is fast and you can also automate tasks, the command line is far quicker; the small gains in speed per task cumulate into a significant amount of efficiency.
  • Compatibility; the command line will run on any machine, though Windows requires additional setup if you want to use the Unix command line. Cloud computing often requires the use of the command line. And, some AI tools are only available as CLIs.

What am I looking at?

The first thing you see is the prompt. The default composition of the prompt is as follows:

currentuser@hostname:workingdirectoryUID

Your prompt should look something like this if on WSL:

your-name@machine-name:/mnt/c/Users/your-name$

And not much different on macOS:

your-name@machine-name ~ %

What's $/%/# mean in the prompt? What's sudo?

Before we go any further we have to talk about privileges.

The prompt has a UID indicator to remind you if your privileges are standard ($ - Bash; % - Zsh) or root (#). Root is not recommended. Anyone accessing your workstation (digitally or physically) could take advantage of or sabotage your system. If you see # in the prompt, you should take it as a red flag.

With standard privileges ($/%), you can temporarily gain administrative privileges by using the sudo command. sudo ("soo doo", short for "substitute user do") will prompt you for your user password, then for 5 minutes the Linux environment will run any command-line with the root privileges (in other words, all privileges). If you need to use sudo for a command, you will receive a message stating something like "Permission denied."

Remember to store passwords securely.
http://pawper.dev/l/guide-password-management-cybersecurity-beginners

What's ~? Where am I?

Your prompt shows the absoltue path from the root directory.

Think of a path as instructions for how to navigate the file system. Every / (Bash/Zsh's path separator) is a going from a directory into one of its contents. If you've spent time on Windows, you may be used to \ as the path separator, but you probably recognize / as a path separator from URLs on the Internet.

A path is an absolute path if it gives directions all the way from the root (the other kind of path is a relative path, but we'll return to that in a bit).

If you're in what's called the home directory for your user profile, you'll see ~. In Bash/Zsh, home is represented by the metacharacter ~, and if you use it in the CLI, the shell just sees it as the absolute path of your home directory. So you can always return home by entering cd ~! No ruby slippers required.

If you're using WSL and in the mounted Windows filestystem, you'll see something like /mnt/c/Users/your-name in the prompt. You should use cd ~ to change to your home directory in Linux. Stay on the Linux side of the fence!

Anatomy of the Prompt (Generated by Claude Design)

What do I type here?

You can submit a command-line from the prompt. The general syntax is:

command -options arguments

Letter options follow a single dash and can be combined. For example, -lh. Word options follow two dashes, such as --help. Try the following commands as we go through them.

Some commands are just a command/utility name, such as clear.

clear

Others take arguments:

echo hello

Others accept letter options. Letter options are prefixed with a dash (-)

ncal -3hMj

Some options might be longform word options (--) and can't be combined in the above way.

df --human-readable --total --type=ext4

If you want to learn what options and arguments a command takes, use the --help option:

clear --help

Anatomy of a Command Line (Generated by Claude Design)

Help, --help isn't working!

Enter:

history --help

You'll see it doesn't work.

If the option --help doesn’t work, it’s a built-in. Built-ins like history are built into the shell (Bash/Zsh) and aren’t a standalone application executed from a file. They are processed faster and have a slightly different way of getting help & usage. Try passing them to other commands, like:

help history
info history
man history

You can determine if a command is a builtin or external program using the type command:

type help
type history
type type

How do I navigate the filesystem?

When typing in the prompt, you can use absolute paths, but you'll usually use relative paths. Relative paths begin at the current directory, represented by ..

You can type .. in the path to indicate a parent directory. So, cd ../../.. goes up 3 times in the filesystem.

Note that Bash/Zsh are case-sensitive, and you'll need quotes around any paths with spaces in them.

Understanding the Root Directory

You can start using cd .. now to change directory up, but you should know -- The root directory (represented as /) is the top-level of your entire filesystem—the foundation from which all other directories branch out. It contains system files, configuration, and installed software that makes your operating system run. You'll rarely need to navigate here for your own work, but understanding what's there helps you navigate confidently and avoid dangerous mistakes.

⚠️ Caution: Never delete or modify files in the root directory or its subdirectories unless you know exactly what you're doing. One wrong command with rm can break your entire system. Always stay in your home directory (~) for your work.

The Filesystem & Paths (Generated by Claude Design)

Commands for Navigating & Working with the Filesystem

Command Description
pwd Print the working directory (where you are)
mkdir -p path Create directories in the path(s) within the working directory
cd path Change to the home directory (or specified path)
ls path List the content of the working directory (or path)
file file Print what kind of file it is
mv source destination Move source to destination; also used to rename files (e.g., mv old.txt new.txt)
ln -s path link Create a symbolic link (nickname) for a file or directory
cp file1 file2 Create a copy of file1 named file2
rm file Remove the file; use -r to remove directories recursively. ⚠️ No undo!
locate x Search for x in the shell’s filesystem database
updatedb Update the database that locate uses
pushd / popd Save your location (pushd); return to it (popd)
code . Open the current directory in VS Code

There is no undo. If you move, overwrite or delete a file or directory, it is a permanent change.

How do I make a new file?

Command Use When
touch filename.txt You need a quick empty file
echo "content" > filename.txt You want to create a file with text in one command
cat > filename.txt then type content, Ctrl+D to save, Ctrl+C to cancel You want to type content interactively
code newfile.txt You want to create and edit in VS Code

Naming files

Capitalization matters and you should only use alphanumeric characters, hyphens and underscores. Other special characters cause issues, as they have special meaning to the operating system. Also avoid spaces because they are problematic; they do work if you put the filename in quotes ('my website').

Extensions

A file can have a file type that doesn't match its extension and files technically work without an extension (however this is not recommended). Use the file command to determine the actual file type.

How do I open / edit a file?

Command Purpose
code filename.txt Edit in VS Code — Best use this.
cat filename.txt View file (read-only, printed to your terminal)
less filename.txt Page through file (read-only) — View a file page-by-page.
Space to scroll, B to go back, Q to quit.

If you accidentally end up in a terminal text editor like nano or vim:

  • Nano: Press Ctrl+X to exit (it will ask to save)
  • Vim: Press Esc, then type :q! (colon, q, exclamation) and press Enter to quit without saving

Helpful Notes

  • Bash is case-sensitive. Most of the time the command-line will be lowercase.
  • Use / to cycle through previous submissions.
  • You can enter a list of commands separated by ; or &&, all in one command line.
  • Enter !! (“bang bang”) to repeat the previous command line.
  • Right click with your mouse to paste.

Command Completion

If you start typing a command, directory or file name, you can use command completion (a.k.a. auto completion) with the Tab key to have the shell to guess where you are trying to get to. If it isn’t working because there are multiple possibilities, press Tab twice to see a list of conflicting files:

$ cd DoTab doesn’t autocomplete.

$ cd DoTabTab prints the conflicts:

Documents/ Downloads/

$ cd DocTab autocompletes to:

$ cd Documents/

WSL: converting Windows paths

wslpath is a CLI tool to convert Windows paths to Linux paths and vice-versa.

WSL users: Should you ever need to, you can open the current directory in Windows Explorer by entering explorer.exe .

Beyond the Basics (Optional)

Once you're comfortable with the fundamentals above, you can explore:

  • Pipes (|) — Chain commands together: cat file.txt | grep “search term” sends the output of one command into another
  • Redirection (>, >>) — Save output to files: ls > files.txt writes directory listing to a file; >> appends
  • grep — Search text: grep “pattern” filename finds lines matching a pattern
  • find — Advanced searching: find . -name “*.js” finds all JavaScript files recursively
  • sed / awk — Text processing and manipulation for advanced workflows

These tools unlock the real power of the command line, but they're not essential for getting started. Master the basics first, then explore these as you need them.

Permissions

You can see files’ permissions using the ls command with the long format argument (-l). They are represented within a string of characters and dashes at the beginning of a file’s line.

drwxr-xr-x 2 user user 4096 Jan  9 10:11 documents
-rw-r--r-- 1 user user  675 Jan  7 12:05 .profile

  • The first character indicates if the file is a directory or file. A d indicates it is a directory. A - indicates it is a file and is not a directory. The next 9 characters are the permissions.
  • Every file or directory belongs to a user owner and a group owner. Then there are other people. Files can be readable (r), writeable (w) and/or executable (x) for each, in that order. If you see a - where one of these characters should be, that means the owner, group or public does not have that permission.
  • chmod changes the mode/permissions of a file. You can optionally specify who for by using the corresponding letter for the owning user (u), owning group (g), and others (o). Use + to add a permission or - to remove it. Then follow that with the applicable permission(s): r, w and/or x. E.g., chmod +x file (adds executable permission for all) or chmod go-w file (removes write permission for the owning group and others).

File Permissions (Generated by Claude Design)

Customize Your Prompt

When you open Bash/Zsh in VS Code, your prompt might look like:

user@computer:/path/to/project$

You can customize this by editing your .bashrc/.zshrc file (in your home directory):

code ~/.bashrc

Add this near the bottom to create a simpler, colorful prompt:

export PS1="\[\033[1;36m\]\[\033[0m\] "

Or a prompt showing the current directory:

export PS1="\[\033[1;32m\]\w\[\033[0m\] \[\033[1;36m\]\[\033[0m\] "

Save with Ctrl+s.

Reload your Bash configuration:

source ~/.bashrc

Prompt Key

Use these variables to build your custom prompt:

Variable What It Shows Recommendation
\u Current username ✓ Keep it
\h Hostname (computer name) ✓ Keep it (useful for Docker)
\w Full path of current directory Consider switching to \W
\W Base name of current directory only ✓ Recommended (cleaner display)
\@ Current time (12-hour am/pm format) Optional
\$ Shows # if root user, otherwise $ ✓ Keep it (security indicator)

Color Codes

To customize colors, find where you want the color to change and insert: \[\033[X;Ym\] where X;Y is the color code below.

Example: \[\033[1;36m\]→\[\033[0m\] makes the arrow bright cyan.

Color Code Color Code
Black 0;30 Dark Gray 1;30
Red 0;31 Light Red 1;31
Green 0;32 Light Green 1;32
Brown 0;33 Yellow 1;33
Blue 0;34 Light Blue 1;34
Purple 0;35 Light Purple 1;35
Cyan 0;36 Light Cyan 1;36
Light Gray 0;37 White 1;37

Note: Not all terminals support all colors. If using a terminal outside of VS Code, test and adjust if needed.

Troubleshooting

How to Escape Terminal Apps

If you're stuck in a terminal application (like a text editor, pager, or hung process), here are the universal ways to escape:

Keyboard Shortcut What It Does
Ctrl+C Interrupt/Cancel — Stops the current process. Works in most apps.
Ctrl+D Exit — Signals end-of-file. Closes some apps like cat in input mode.
Q Quit — Works in pagers like less and man. Just press Q.
Ctrl+Z Suspend — Pauses the app and returns to prompt (type fg to resume, bg to run in background).
Esc then :q! Vim exit — Press Esc, type :q!, press Enter to force-quit without saving.
Ctrl+X Nano exit — Exits to prompt (asks if you want to save).

If nothing works: Try Ctrl+C first. If that hangs, try Ctrl+Z. In VS Code's terminal, you can also close the terminal tab directly.

Permissions Denied When Running Scripts

If you ever get a bash script, and you can't run it, use chmod +x:

chmod +x ./script.sh
./script.sh

The chmod +x command makes the script executable.


You are now in command of the command line. You can navigate the filesystem, manipulate files, run programs, and understand what's happening under the hood. That empty prompt that felt intimidating at the beginning? You know what to do with it now.

Sources / additional material:

https://code.visualstudio.com/docs/editor/command-line

This article was revised & expanded with AI for the purpose of providing practical information. I have reviewed it for accuracy and edited it appropriately.