Files
linuxplus/90-file-search-lesson.el
T
2026-06-16 11:10:28 -04:00

84 lines
2.2 KiB
EmacsLisp

;;; 90-file-search-lesson.el --- file-search-lesson
(defun file-search-lesson ()
"Linux+ lesson for finding files and commands."
(interactive)
(delete-other-windows)
(let ((buf (get-buffer-create "*File Search Lesson*"))
(shell (or shell-file-name (getenv "SHELL") "/bin/sh")))
(switch-to-buffer buf)
(read-only-mode -1)
(erase-buffer)
(insert
"Linux+ Lesson: File Searching and Command Discovery\n"
"==================================================\n\n"
"Concepts:\n"
"- `find` searches the filesystem in real time\n"
"- `locate` searches a database\n"
"- `which` finds executable paths\n"
"- `grep` filters output\n\n"
"VERY IMPORTANT:\n"
"- `find` is slower but current\n"
"- `locate` is faster but may be outdated\n\n"
"Hands-on tasks:\n\n"
"1. Create a practice directory:\n"
" mkdir -p ~/linuxplus-search-test\n"
" cd ~/linuxplus-search-test\n\n"
"2. Create practice files:\n"
" touch alpha.txt beta.log gamma.conf\n\n"
"3. Find a specific file:\n"
" find . -name alpha.txt\n\n"
"4. Find all .txt files:\n"
" find . -name '*.txt'\n\n"
"5. Find directories only:\n"
" find . -type d\n\n"
"6. Find files only:\n"
" find . -type f\n\n"
"7. Search for a command location:\n"
" which grep\n"
" which systemctl\n\n"
"8. Use locate:\n"
" locate passwd\n\n"
"9. If locate gives poor results:\n"
" sudo updatedb\n\n"
"10. Combine find with grep:\n"
" find /etc -name '*.conf' | grep ssh\n\n"
"Linux+ exam traps:\n"
"- `find` searches live filesystem data\n"
"- `locate` uses a database\n"
"- `which` searches PATH for executables\n"
"- `find` is commonly combined with pipes\n\n"
"When finished, run:\n"
" M-x file-search-quiz\n")
(goto-char (point-min))
(view-mode 1)
(split-window-below)
(other-window 1)
(let ((term (get-buffer "*term*")))
(if (buffer-live-p term)
(switch-to-buffer term)
(ansi-term shell "term")))
(other-window -1)))
;;; 90-file-search-lesson.el ends here