Bash & Linux·Bash from first command to automation

Files and directories

Create, move, copy and inspect files without destroying anything.

Beginner 12 min read Lesson 2 of 300 Challenge included
What you will be able to do
  • Use mkdir -p for nested directories.
  • Use cp -r for directories.
  • Use rm -i or a trash tool when unsure.
  • Quote paths that contain spaces.

In plain English

Paths are either absolute (start at /) or relative (start at the current directory). Use ls -la to see hidden files and permissions. Prefer cp and mv with explicit destinations, and be careful with rm.

terminalTerminal
mkdir -p notes/archive
touch notes/lesson.txt
cp notes/lesson.txt notes/archive/lesson.txt
mv notes/archive/lesson.txt notes/archive/old-lesson.txt
ls -la notes/archive
Your turn

Create a nested folder

Easy

Create a directory structure project/src/components in one command.

BASH · starter
mkdir
Check your understanding before moving on.
Knowledge checkQuestion 1

Which option creates parent directories as needed?

Select an answer to continue
Study tools

Make it yours.

Keep a private note for this lesson, then turn the key ideas into flashcards you can revisit.

Sign in to save notes and flashcards.Both are private to your account and stay with your progress.
Sign in
Finished reading?

Lock in what you just learned.

Mark this lesson complete to save your place and move one step closer to the certificate.

Next: Permissions
Lesson 2 of 300 · 0% of course