Using the .emacs file
Here you will need to know (or copy) a bit of Lisp. Here are some examples.
(global-set-key "\e#" 'quoted-insert) (define-key c-mode-map "\e#" 'quoted-insert)
These both set M-#
to perform a quoted insert.
(global-set-key "\C-cg" 'goto-line) (define-key ctl-x-map "g" 'goto-line)
Make C-c g and C-x g prompt for a line number to jump to.
The function keys can also be set to do things -
(global-set-key [f1] 'goto-line) ;; goto line number