ProgrammingWords 2663Read time7 min

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.

NameHow to understand itDescription
Terminal / TerminalThe window for entering commandsThe command-line interface you open in macOS, Linux, or Windows
ShellThe program that interprets commandsInterprets what you type and passes it to the system for execution
BashA common ShellThe default in many Linux tutorials
ZshAnother ShellZsh is now the more common default on macOS
PowerShellA common Shell on WindowsOne of the modern command-line environments on Windows
Git BashA Unix-like environment on WindowsCommon 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 install
export OPENAI_API_KEY="your_api_key"
python main.py --input data.txt

Bash 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:

PartExampleMeaning
CommandlsWhat action to perform
Options-laModify how the command behaves
Arguments~The target of the command

Another example:

mkdir -p images/icons

This 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.md

This can be understood as:

  • python: run with Python;
  • main.py: the script file to run;
  • --input data.txt: the input file is data.txt;
  • --output result.md: the output file is result.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/LamjinlabWebsite

This is like a folder address:

Home directory ~
└── GitHub
    └── LamjinlabWebsite

Common path symbols:

SymbolMeaningExample
/Path separator, and also root directory/Users/yourname
~Current user’s home directory~/Desktop
.Current directory./package.json
..Parent directorycd ..

For example:

cd ..

This means go up one directory.

Another example:

cd ~/GitHub/LamjinlabWebsite

This 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\ Projects

For 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.

pwd

Example output:

/Users/yourname/GitHub/LamjinlabWebsite

If 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.

ls

Common forms:

ls -l

Show detailed information.

ls -a

Show hidden files.

ls -la

Show 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 Desktop

Go 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 images

Creates a folder named images.

A more common and safer form is:

mkdir -p images/icons

The -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/images

This creates:

~/ai-agent-workflow-ppt/images

If 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.md

This creates a file named README.md.

In web projects, you may also see:

touch .env.local

This 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.md

cat is convenient for short files; for long files, use less to page through:

less README.md

Common interactions: press Space to go down a page, press q to exit.

If you only want the beginning of a file, use:

head README.md

If you only want the end of a file, use:

tail README.md

tail 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.txt

Copying 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.md

Move 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.txt

Delete a directory:

rm -r test-folder

Beginners 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:

hello

Write to a file:

echo "hello" > test.txt

This 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:

LamjinlabWebsite

You can type:

cd Lam

Then press Tab, and the shell may auto-complete to:

cd LamjinlabWebsite

2. 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 dev

If 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 + C

This can stop local dev servers, Python scripts, and Node.js programs.

4. clear to clear the screen

If the terminal is cluttered, run:

clear

This empties the current display and makes the interface cleaner.

5. history to view previous commands

If you need a command you ran earlier, run:

history

It 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 && ls

Meaning: 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; ls

Meaning: 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.txt

Beginners should note that > overwrites file content, so verify carefully before using it.

5. *: wildcard

* matches multiple characters.

Example:

ls *.md

Meaning: list all files ending in .md in the current directory.

Another example:

rm *.log

Meaning: 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/images

Meaning: 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.git

This command means copy a remote GitHub repository to your computer.

After downloading, you usually enter the project directory:

cd project

Then list the project files:

ls

Many open-source READMEs include:

git clone https://github.com/example/project.git
cd project
npm install
npm run dev

Beginners 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 install

Install project dependencies. It usually reads the package.json file in the current directory.

npm run dev

Run the dev script defined in package.json, usually to start the local dev server.

npm run build

Run the build script, usually to generate a production build.

npm start

Run 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 dev actually runs next dev;
  • npm run build actually runs next build;
  • npm start actually runs next 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.py

Used to run a Python script.

python -m venv .venv

Used to create a Python virtual environment.

pip install -r requirements.txt

Used to install Python project dependencies.

vercel deploy

Used to deploy a website project.

claude

May 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:

pwd

Confirm 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.md

They may be treated as different files.

4. Misusing deletion commands

Especially:

rm -rf

Always 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 directory

Usually means a file or folder does not exist, often due to a bad path.

Permission denied

Usually means you lack permission to execute or access.

command not found

Usually means the command is not installed, or your environment variables are not configured correctly.

EADDRINUSE

Common 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.

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

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

Share this article