# Creating Files & Directories — Linux

Source: https://www.geekswithgeeks.com/en/linux/linux-file-creation

> touch and mkdir.

## touch & mkdir

`touch` creates an empty file (or updates its timestamp). `mkdir` creates a directory.

```bash
touch notes.txt
mkdir projects
ls
```

Output:

```
notes.txt  projects
```

## Nested directories

`mkdir -p` creates parent directories as needed, without erroring if they already exist.

```bash
mkdir -p projects/app/src
ls -R projects
```

Output:

```
projects:
app

projects/app:
src
```

## Avoid spaces & special chars

File names with spaces need quotes or escaping: `touch "my file.txt"` or `touch my\ file.txt`. Prefer hyphens or underscores instead.
