Terminal Command Line for Beginners: From ls, cd, and mkdir to Bash, Git, and AI Tool Deployment
An introductory terminal command-line tutorial for absolute beginners, explaining foundational concepts such as Terminal, Shell, Bash, Zsh, paths, ls, cd, mkdir, git clone, and npm run dev.
Many people’s first encounter with the command line feels like a “hacker window”: no buttons, no icons, only lines of English commands. Especially when using GitHub, Vercel, Node.js, Python, Claude Code, Codex, or various AI Agent projects, tutorials often contain commands like ls, cd, mkdir, git clone, npm install, and npm run dev, and beginners can be discouraged quickly.
But the command line is not that mysterious. At its core it is simply another way to operate a computer: you usually click folders, create files, move files, and open projects with a mouse, while the command line does similar work using text commands.
This article explains Terminal, Shell, Bash, Zsh, paths, and common commands in the clearest way possible, and connects them to GitHub, Vercel, Python, Node.js, and AI tool deployment. Once you understand these concepts, reading open-source project docs, deployment tutorials, and AI tool documentation will feel much easier.
1. What are Terminal, Shell, Bash, and Zsh?
Before learning the command line, start by separating a few concepts that are often confused.
| Name | How to understand it | Description |
|---|---|---|
| Terminal / Terminal | The window for entering commands | The command-line interface you open in macOS, Linux, or Windows |
| Shell | The program that interprets commands | Interprets what you type and passes it to the system for execution |
| Bash | A common Shell | The default in many Linux tutorials |
| Zsh | Another Shell | Zsh is now the more common default on macOS |
| PowerShell | A common Shell on Windows | One of the modern command-line environments on Windows |
| Git Bash | A Unix-like environment on Windows | Common after installing Git for Windows, suitable for many commands in GitHub tutorials |
A simple way to think about it:
You enter commands in the Terminal, the Shell interprets them, and the operating system executes them.So when some tutorials say “open Bash and run commands,” beginners can interpret it as:
Open the Terminal, then type these commands.Note that command-line environments differ slightly across systems. Commands common in Mac/Linux tutorials, such as ls, cd, mkdir, and rm, are not always identical in Windows PowerShell. But if you use Git Bash, WSL, or a Unix-like environment, these commands are usually much closer to Mac/Linux tutorials.
2. What exactly is Bash, and why do tutorials mention it so often?
Bash is the Bourne Again Shell, a very common command language interpreter. Many Linux servers, deployment guides, and open-source project READMEs default to Bash or shell syntax very close to Bash.
Many patterns you see in tutorials are tied to Bash conventions:
cd my-project && npm installexport OPENAI_API_KEY="your_api_key"python main.py --input data.txtBash is not meant to be as complex as writing code. It helps you chain multiple system actions together: entering a project directory, installing dependencies, setting environment variables, running scripts, checking logs, and deploying a project.
For beginners, you do not need to start by studying Bash scripting systematically. The following is enough at first:
- How to switch directories;
- How to list files;
- How to create, copy, move, and delete files;
- How to run programs;
- How to read arguments and options;
- How to understand symbols like
&&,|,>,>>; - How to know whether a command is dangerous.
After these basics feel familiar, it is not too early to learn variables, loops, conditionals, and script files.
3. Basic structure of a command
A complete command usually has three parts:
command [options] [arguments]For example:
ls -la ~Can be split as:
| Part | Example | Meaning |
|---|---|---|
| Command | ls | What action to perform |
| Options | -la | Modify how the command behaves |
| Arguments | ~ | The target of the command |
Another example:
mkdir -p images/iconsThis means create the images/icons folder path, and also create images if it does not exist.
Many beginners are intimidated by the command line because they treat a whole command line as an unintelligible string of English. In practice, most commands are readable when broken apart:
python main.py --input data.txt --output result.mdThis can be understood as:
python: run with Python;main.py: the script file to run;--input data.txt: the input file isdata.txt;--output result.md: the output file isresult.md.
4. Paths: the “addresses” of the command-line world
A path is the location of a file or folder on your computer.
For example, on macOS:
~/GitHub/LamjinlabWebsiteThis is like a folder address:
Home directory ~
└── GitHub
└── LamjinlabWebsiteCommon path symbols:
| Symbol | Meaning | Example |
|---|---|---|
/ | Path separator, and also root directory | /Users/yourname |
~ | Current user’s home directory | ~/Desktop |
. | Current directory | ./package.json |
.. | Parent directory | cd .. |
For example:
cd ..This means go up one directory.
Another example:
cd ~/GitHub/LamjinlabWebsiteThis means enter the GitHub/LamjinlabWebsite folder under your home directory.
If a path contains spaces, use quotes:
cd "My Projects"Or escape the space with a backslash:
cd My\ ProjectsFor beginners, quotes are usually clearer and less error-prone.
5. Common foundational commands
These are the commands beginners should master first.
1. pwd: show the current location
pwd = print working directory, which means print the current directory.
pwdExample output:
/Users/yourname/GitHub/LamjinlabWebsiteIf you do not know what folder you are in, run pwd first.
2. ls: list files and directories
ls = list, meaning list the contents of the current directory.
lsCommon forms:
ls -lShow detailed information.
ls -aShow hidden files.
ls -laShow both detailed information and hidden files.
Hidden files usually start with . such as:
.env
.gitignore
.DS_Store.env and .env.local are often used to store API keys, database addresses, and other sensitive configuration; they should not be uploaded to GitHub casually.
3. cd: change directories
cd = change directory, meaning switch to another folder.
cd DesktopGo to the Desktop directory.
cd ..Go to the parent directory.
cd ~Return to the current user’s home directory.
cd -Go back to the previously visited directory.
This is very handy when switching between projects.
4. mkdir: create directories
mkdir = make directory, meaning create a folder.
mkdir imagesCreates a folder named images.
A more common and safer form is:
mkdir -p images/iconsThe -p flag means it automatically creates intermediate directories if they do not exist; if the folder already exists, it does not error.
For example:
mkdir -p ~/ai-agent-workflow-ppt/imagesThis creates:
~/ai-agent-workflow-ppt/imagesIf ai-agent-workflow-ppt does not exist, it is created as well.
5. touch: create empty files
touch is commonly used to create an empty file.
touch README.mdThis creates a file named README.md.
In web projects, you may also see:
touch .env.localThis usually means creating a local environment variable file used to store configuration like API keys and database addresses.
6. cat, less, head, tail: view file contents
cat lets you quickly view text file content.
cat README.mdcat is convenient for short files; for long files, use less to page through:
less README.mdCommon interactions: press Space to go down a page, press q to exit.
If you only want the beginning of a file, use:
head README.mdIf you only want the end of a file, use:
tail README.mdtail is commonly used when reading logs. For example:
tail -f app.log-f means follow file changes continuously, often used to watch runtime logs.
7. cp: copy files or directories
cp = copy.
Copy a file:
cp a.txt b.txtCopying a directory usually requires -r:
cp -r images images-backup-r means recursive copy, which copies all contents inside the directory as well.
8. mv: move or rename
mv = move.
Rename a file:
mv old.md new.mdMove a file:
mv article.md content/posts/ai/So mv has two common uses: moving a file and renaming a file.
9. rm: remove files or directories
rm = remove.
Delete a file:
rm test.txtDelete a directory:
rm -r test-folderBeginners must use rm carefully, especially this:
rm -rf some-folder-r means recursive deletion, and -f means force. Unlike GUI file managers, this does not move files to a recycle bin or trash—it deletes them directly, so verify the path before running it.
10. echo: output text
echo outputs text and is often used with > or >> to write to files.
echo "hello"Output:
helloWrite to a file:
echo "hello" > test.txtThis writes hello to test.txt.
6. Common interaction tips
1. Tab completion
After typing part of a command or filename, press Tab and the terminal will try to auto-complete.
For example, if you have a directory named:
LamjinlabWebsiteYou can type:
cd LamThen press Tab, and the shell may auto-complete to:
cd LamjinlabWebsite2. Use up and down arrows to view command history
Press ↑ to recall the previous command, and ↓ to go forward.
This is very useful when running commands repeatedly, for example:
npm run devIf you just ran it, pressing ↑ recalls it without retyping.
3. Ctrl + C to interrupt a process
If a command keeps running, or you want to stop the current process, press:
Ctrl + CThis can stop local dev servers, Python scripts, and Node.js programs.
4. clear to clear the screen
If the terminal is cluttered, run:
clearThis empties the current display and makes the interface cleaner.
5. history to view previous commands
If you need a command you ran earlier, run:
historyIt lists recent command history. Beginners can use it to review what they just did.
7. Common operator symbols
1. &&: execute the next command only after the previous one succeeds
Example:
mkdir -p images && lsMeaning: create the images directory first, and if successful, run ls to view the current directory.
2. ;: execute the next command regardless of success
Example:
mkdir images; lsMeaning: attempt to create images, then run ls. Even if the first command fails, the second may still run.
So when installing dependencies or deploying projects, it is better to understand &&, because it expresses “only proceed when the previous step succeeds.”
3. |: pipe
The pipe passes the output of the previous command into the next command.
Example:
ls | grep "mdx"Meaning: list current directory contents, then filter lines containing mdx.
4. > and >>: output redirection
> writes output to a file and overwrites existing content:
echo "hello" > test.txt>> appends output to the end of a file:
echo "world" >> test.txtBeginners should note that > overwrites file content, so verify carefully before using it.
5. *: wildcard
* matches multiple characters.
Example:
ls *.mdMeaning: list all files ending in .md in the current directory.
Another example:
rm *.logMeaning: delete all .log files in the current directory. This command can be destructive—confirm your current directory first.
8. Understand commands through real examples
For example, you see this:
mkdir -p ~/ai-agent-workflow-ppt/images && ls ~/ai-agent-workflow-ppt/It can be split into two parts:
mkdir -p ~/ai-agent-workflow-ppt/imagesMeaning: create the images folder in the project.
ls ~/ai-agent-workflow-ppt/Meaning: list what is inside the ai-agent-workflow-ppt directory.
The && in between means:
The directory-listing command only runs after the creation command succeeds.So the full command means:
Create the images folder first, then list the project directory contents.This type of command is usually safe because it only creates a folder and lists directories, with no deletion involved.
9. What is the relationship between the command line and GitHub?
GitHub is a hosting platform for many open-source projects, and Git is a version-control tool. Projects on GitHub are typically downloaded to your local machine with Git.
The most common command is:
git clone https://github.com/example/project.gitThis command means copy a remote GitHub repository to your computer.
After downloading, you usually enter the project directory:
cd projectThen list the project files:
lsMany open-source READMEs include:
git clone https://github.com/example/project.git
cd project
npm install
npm run devBeginners should not paste and run all of them at once. A better approach is to understand each line:
1. git clone: download the project; 2. cd project: enter the project folder; 3. npm install: install dependencies; 4. npm run dev: start the development server.
This way, you understand each step and can locate issues more easily.
10. What is the relationship between the command line and Node.js, npm?
Many web, frontend, and Next.js or Vercel projects use Node.js and npm.
You can understand npm as the package manager for the Node.js ecosystem. Common use cases include installing dependencies, running scripts, starting a development server, and packaging a project.
Common commands:
npm installInstall project dependencies. It usually reads the package.json file in the current directory.
npm run devRun the dev script defined in package.json, usually to start the local dev server.
npm run buildRun the build script, usually to generate a production build.
npm startRun the start script; behavior depends on how the project defines it in package.json.
So when you see npm run dev, do not memorize the command alone. Open the project package.json, and look for something like:
{
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
}
}This means:
npm run devactually runsnext dev;npm run buildactually runsnext build;npm startactually runsnext start.
Once you understand this, frontend project tutorials become much clearer.
11. What is the relationship between the command line, Python, and AI tools?
If you only browse the web, you may never need the command line. But if you want to use more AI tools, open-source projects, and automation workflows, the command line is almost unavoidable.
For example:
python main.pyUsed to run a Python script.
python -m venv .venvUsed to create a Python virtual environment.
pip install -r requirements.txtUsed to install Python project dependencies.
vercel deployUsed to deploy a website project.
claudeMay be used to start CLI tools like Claude Code, depending on your installation method.
Many AI Agents, Claude Code, Codex, Cursor, Next.js, FastAPI, and Vercel projects are effectively installed, run, debugged, and deployed through the command line.
So learning the command line is not about becoming “a professional,” but about gaining real control over your projects.
12. Common mistakes beginners make
1. Not knowing your current directory
Solution:
pwdConfirm where you are first.
2. Mistyping paths
Solution: use Tab completion more, and avoid typing long paths manually.
3. Forgetting filename case
In many systems, filename case can affect command execution.
For example:
README.md
readme.mdThey may be treated as different files.
4. Misusing deletion commands
Especially:
rm -rfAlways confirm the path before running it; do not run unknown commands directly after copying them.
5. Running unknown commands immediately after pasting
This is one of the riskiest beginner habits. Before running any command, you should at least understand three points:
- Could it delete files?
- Could it overwrite files?
- Could it upload sensitive information externally?
If a command contains rm -rf, sudo, curl ... | bash, chmod 777, or >, be even more cautious.
6. Ignoring error messages
Many error messages already tell you what is wrong. For example:
No such file or directoryUsually means a file or folder does not exist, often due to a bad path.
Permission deniedUsually means you lack permission to execute or access.
command not foundUsually means the command is not installed, or your environment variables are not configured correctly.
EADDRINUSECommon with local dev servers; it means the port is already in use. For example, port 3000 may already be used by another project.
13. Suggested learning order
If you are a beginner, I recommend this order:
1. First learn pwd, ls, and cd, and understand where you are; 2. Then learn mkdir, touch, cp, and mv, and understand how to create and move files; 3. Then carefully learn rm, understand how to delete files, but do not misuse it; 4. Then learn cat, less, head, tail, and learn to inspect files and logs; 5. Next learn &&, |, >, >>, and understand how commands are chained; 6. Finally learn git clone, npm install, npm run dev, and python main.py, and use the command line on real projects.
Once you master these, you will be able to understand most basic commands in GitHub project READMEs.
14. Conclusion
The command line is not mystical, and it is not an advanced tool only programmers can use. It is simply another way to operate a computer.
You can think of it this way:
A graphical interface operates a computer with mouse and buttons;
The command line operates a computer with text and commands.After you master basic commands like ls, cd, mkdir, pwd, git clone, and npm run dev, learning about GitHub, Vercel, Python, Node.js, Claude Code, and AI Agent projects becomes much smoother.
What matters is not memorizing all commands at once, but becoming familiar through actual use. When you encounter an unfamiliar command, break it down first: what does it do, what are its options, and what is its target? Then the command line becomes not a stream of foreign symbols, but a tool you can understand, control, and reuse.
FAQ
What level of developer is this article suitable for?
Refer to the “target audience” note in the main text. Articles in this site's Programming section cover everything from beginners to AI programming workflow levels, with different prerequisite assumptions for each.
Do the tools or commands in this article vary across operating systems?
Yes. Terminal environments, path formats, and command syntax differ across macOS, Linux, and Windows. If the article does not specify an operating system, adjust according to the official documentation for your system.
Which AI tools are recommended for learning programming?
Claude Code and Codex are currently among the strongest programming AI tools. They can help explain code, complete logic, debug errors, and generate scripts. For related introductions, refer to this site’s CC Switch Tool article and Vibe Coding Interview Question Set.
What is the most important habit for learning to code?
Hands-on practice matters more than just watching tutorials. It is best to start a real project early (even a small one), and when you face problems, check documentation and code rather than only finishing theory first.
References
- GNU Bash Reference Manual
- GNU Bash Manual: Shell Commands
- GNU Coreutils Manual
- GNU Coreutils: mkdir invocation
- Apple Support: Terminal User Guide for Mac
- Microsoft Learn: Windows Terminal Documentation
- Git Documentation: git clone
- Pro Git Book
- npm Docs: scripts
- npm Docs: npm-run-script
- The Art of Command Line
- MDN Web Docs
The terminal is the foundational environment for AI programming tools. If you want to learn more about using Claude Code or Codex in the terminal, check out the CC Switch Tool Introduction and Vibe Coding Interview Question Set.
Share