6. Navigating the File System: ls, cd, pwd
The most basic and essential skills in Termux (or any Linux environment) are knowing where you are and how to move around.
1. Where Am I? (pwd)
pwd stands for Print Working Directory. It displays the absolute path of your current location.
bash $ pwd /data/data/com.termux/files/home
2. What's Here? (ls)
ls stands for List. It lists the contents of the current directory.
Common ls Options:
ls -l: Long format listing (shows permissions, owner, size, date).ls -a: Lists all files, including hidden files (those starting with a dot, e.g.,.bashrc).ls -lh: Long format, human-readable file sizes (e.g., 1K, 20M).
bash $ ls -l total 0
Example output: shows nothing yet
3. Moving Around (cd)
cd stands for Change Directory. It moves you from your current location to a new one.
| Command | Destination | Description |
|---|---|---|
cd /etc | /etc | Moves to the system configuration directory. |
cd .. | Parent directory | Moves one level up in the hierarchy. |
cd ~ | Home directory | Moves directly back to /home. |
cd (alone) | Home directory | Same as cd ~. |
Example Sequence:
bash $ pwd /data/data/com.termux/files/home $ cd .. $ pwd /data/data/com.termux/files $ cd ~ # Back to home $ pwd /data/data/com.termux/files/home