Day 1 of 5
⏱ ~60 minutes
Linux in 5 Days — Day 1

The Terminal and File System

Learn navigation commands, understand the Linux directory structure, create and delete files, and use tab completion and command history.

Why the Terminal Matters

Every server, container, and CI environment is Linux. The terminal is the universal interface. GUI tools come and go. The terminal is everywhere.

Navigation
pwd          # print working directory
ls           # list directory contents
ls -la       # long format, show hidden files
cd /home     # change to absolute path
cd ~         # home directory
cd ..        # parent directory
cd -         # previous directory

# Autocomplete: press Tab
# History: press ↑ arrow
# Search history: Ctrl+R then type
The Directory Tree
/          ← root of the filesystem
/home      ← user home directories (/home/bo)
/etc       ← configuration files
/var/log   ← log files
/tmp       ← temporary files (cleared on reboot)
/usr/bin   ← user programs
/usr/local ← locally installed software
/proc      ← virtual FS: running process info
/dev       ← device files
Files and Directories
mkdir mydir              # create directory
mkdir -p a/b/c           # create nested dirs
touch file.txt           # create empty file
rm file.txt              # delete file
rm -rf mydir/            # delete directory (careful!)
mv file.txt newname.txt  # rename/move
cp file.txt backup.txt   # copy
cp -r dir/ backup/       # copy directory
⚠️
rm -rf / deletes your entire system with no confirmation and no recovery. rm -rf ./ (with the dot) does the same for your current directory. Always double-check paths before running rm -rf.
📝 Day 1 Exercise
Navigate Your File System
  1. O
  2. p
  3. e
  4. n
  5. a
  6. t
  7. e
  8. r
  9. m
  10. i
  11. n
  12. a
  13. l
  14. .
  15. N
  16. a
  17. v
  18. i
  19. g
  20. a
  21. t
  22. e
  23. t
  24. o
  25. y
  26. o
  27. u
  28. r
  29. h
  30. o
  31. m
  32. e
  33. d
  34. i
  35. r
  36. e
  37. c
  38. t
  39. o
  40. r
  41. y
  42. ,
  43. /
  44. e
  45. t
  46. c
  47. ,
  48. a
  49. n
  50. d
  51. /
  52. v
  53. a
  54. r
  55. /
  56. l
  57. o
  58. g
  59. u
  60. s
  61. i
  62. n
  63. g
  64. b
  65. o
  66. t
  67. h
  68. a
  69. b
  70. s
  71. o
  72. l
  73. u
  74. t
  75. e
  76. a
  77. n
  78. d
  79. r
  80. e
  81. l
  82. a
  83. t
  84. i
  85. v
  86. e
  87. p
  88. a
  89. t
  90. h
  91. s
  92. .
  93. C
  94. r
  95. e
  96. a
  97. t
  98. e
  99. a
  100. d
  101. i
  102. r
  103. e
  104. c
  105. t
  106. o
  107. r
  108. y
  109. s
  110. t
  111. r
  112. u
  113. c
  114. t
  115. u
  116. r
  117. e
  118. :
  119. <
  120. c
  121. o
  122. d
  123. e
  124. >
  125. p
  126. r
  127. o
  128. j
  129. e
  130. c
  131. t
  132. s
  133. /
  134. l
  135. i
  136. n
  137. u
  138. x
  139. -
  140. c
  141. o
  142. u
  143. r
  144. s
  145. e
  146. /
  147. d
  148. a
  149. y
  150. 1
  151. /
  152. <
  153. /
  154. c
  155. o
  156. d
  157. e
  158. >
  159. .
  160. C
  161. r
  162. e
  163. a
  164. t
  165. e
  166. 3
  167. t
  168. e
  169. x
  170. t
  171. f
  172. i
  173. l
  174. e
  175. s
  176. i
  177. n
  178. i
  179. t
  180. .
  181. D
  182. e
  183. l
  184. e
  185. t
  186. e
  187. o
  188. n
  189. e
  190. .
  191. C
  192. o
  193. p
  194. y
  195. o
  196. n
  197. e
  198. .

Day 1 Summary

  • pwd, ls -la, cd — the three commands you use a hundred times a day.
  • Tab completes paths and commands. Use it constantly to avoid typos.
  • rm -rf has no undo. Always double-check the path before running it.
  • The Linux directory tree is standardized. /etc = config, /var/log = logs, /home = user data.
Finished this lesson?