Definition (cell complex)

Let $X$ be a topological space and $f: S^{n-1}\to X$ be a map.

The space obtained by attaching an $n$-cell to $X$ along $f$ is the quotient space $$ \begin{align*} X \cup_f D^n := (X\sqcup D^n)/{\sim} \end{align*} $$ where $\sim$ is the equivalence relation identifying $x \sim f(x)$ for all $x\in S^{n-1} = \partial D^n$, and an subset of $X \sqcup D^n$ is open iff its intersections with $X$ and with $D^n$ are open.

A finite cell complex is a space obtained with finitely many steps as follows:

Taking $X = X^n$, we say $n$ is the dimension of $X$. $X^i$ is called the $i$-skeleton of $X$.