Online Linux Terminal Logo
OnlineLinuxTerminal

File & Directory Manipulation

Creating, copying, renaming, and deleting files and directories are foundational skills for any Linux user. Learn how to manage the Virtual File System cleanly.

Linux Community2.4k Online

Chat with real Linux users, learn new commands & get free cheat sheet PDFs.

Lesson Objectives

4 Steps
1Step 1: Create a Dedicated Lab Directory

Run `mkdir -p lab/configs` to create a parent and subfolder in one command.

2Step 2: Create a Shell Script File

Run `echo "echo hello linux" > lab/test.sh` to create and write content to a file.

3Step 3: Verify Creation & Inspect Content

Run `cat lab/test.sh` to confirm the script content was written properly.

4Step 4: Copy the File to Backup

Run `cp lab/test.sh lab/configs/test.bak` and check with `ls -l lab/configs`.

💡 Pro Tip:

Always use `mkdir -p` when creating nested directory structures to avoid "No such file or directory" errors.

bash — terminal