After that, I may write a little shell script that simply opens one at random for me.
dir="/bin"; man $(ls $dir |sed -n "$(echo $(( $RANDOM % $(ls $dir |wc -l | awk "{ print $1; }" ) + 1 )) )p")
I think I may write my own version as well. Just to gain a bit more experience with shell scripting. ;; Taken from http://emacswiki.org/emacs/ElispCookbook#toc57
(defun directory-dirs (dir)
"Find all directories in DIR."
(unless (file-directory-p dir)
(error "Not a directory `%s'" dir))
(let ((dir (directory-file-name dir))
(dirs '())
(files (directory-files dir nil nil t)))
(dolist (file files)
(unless (member file '("." ".."))
(let ((file (concat dir "/" file)))
(when (file-directory-p file)
(setq dirs (append (cons file
(directory-dirs file))
dirs))))))
dirs))
;; Taken from
;; http://stackoverflow.com/questions/3815467/stripping-duplicate-elements-in-a-list-of-strings-in-elisp
(defun strip-duplicates (list)
(let ((new-list nil))
(while list
(when (and (car list) (not (member (car list) new-list)))
(setq new-list (cons (car list) new-list)))
(setq list (cdr list)))
(nreverse new-list)))
;; Display a random manual page
(defun open-random-man-page ()
(interactive)
;; Get manual page paths from the environment.
(setq man-paths (parse-colon-path (getenv "MANPATH")))
(setq man-dirs ())
(dolist (man-path man-paths)
(setq man-dirs (append man-dirs (directory-dirs man-path))))
;; Get a list of files in manual page paths.
(setq files ())
(dolist (man-dir man-dirs)
(setq files (append files (directory-files man-dir nil "^[^\.].*"))))
;; Fixup the files to be a list of man pages.
(setq man-pages ())
(dolist (file files)
(setq man-pages (cons (car (split-string file "\\." t)) man-pages)))
(setq man-pages (strip-duplicates man-pages))
(random t)
(man (nth (random (length man-pages)) man-pages)))
Be aware that Emacs lisp is still something I'm learning; I'm sure the above could be improved.* Read your primary shell's manpage.
* Read alternative shell's manpages. Most particularly zsh, if you're not already using it.
* Look at your bash history and most frequently used commands. Read those manpages.
* Read manpages of language(s) you're looking to develop in.
* Read manpages for tools that are supplanting existing tools. E.g.: ip(8) vs. ifconfig(8).
* Read manpages for not just commands (1 & 8) but file formats (section 5), special files (4), and system and library calls (2 & 3).
* Follow references in manpages (the "SEE ALSO" section(s).
* Try reversing the process. Use apropos to find tools which accomplish a given task.
* On Debian or Ubuntu, install the dwww package and surf manpages locally at http://localhost/dwww/man/ within your web browser.