%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% This default.mgp is "TrueType fonts" oriented. %% First, you should create "~/.mgprc" whose contents are: %% tfdir "/path/to/truetype/fonts" %% %% To visualize English, install "times.ttf", "arial.ttf", and "cour.ttf" %% into the "tfdir" directory above: %% http://microsoft.com/typography/fontpack/default.htm %% %% To visualize Japanese, install "MSMINCHO.ttf" and %% "watanabenabe-mincho.ttf" into the "tfdir" directory above: %% http://www.mew.org/mgp/xtt-fonts_0.19981020-3.tar.gz %% %deffont "standard" xfont "helvetica-medium-r", tfont "verdana.ttf", tmfont "hoso6.ttf" %deffont "thick" xfont "helvetica-bold-r", tfont "thick.ttf", tmfont "hoso6.ttf" %deffont "typewriter" xfont "courier-medium-r", tfont "typewriter.ttf", tmfont "hoso6.ttf" %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% Default settings per each line numbers. %% %default 1 area 90 90, leftfill, size 2, fore "gray20", back "white", font "standard", hgap 0 %default 2 size 7, vgap 10, prefix " ", ccolor "black" %default 3 size 2, bar "gray70", vgap 10 %default 4 size 5, fore "gray20", vgap 30, prefix " ", font "standard" %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% %% Default settings that are applied to TAB-indented lines. %% %tab 1 size 5, vgap 40, prefix " ", icon box "green" 50 %tab 2 size 4, vgap 40, prefix " ", icon arc "yellow" 50 %tab 3 size 3, vgap 40, prefix " ", icon delta3 "white" 40 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page %nodefault %size 6.5, font "standard" %center, font "standard", size 8 Getting things done on The Command Line %bar "skyblue" 6 15 70 %font "standard", hgap 0 %size 3 Prepared for COSSFest 2009 by %size 5, fore "green" Mark Carlson %size 4.5 carlsonmark@gmail.com http://mcarlson.ca/cossfest2009 %size 3, fore "black", hgap 20 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Main points: Navigating the command line Learning to use the tools Useful commands Other tips %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Navigating: Index Moving the cursor Killing / Yanking Repeat, undo, and more Process management %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Navigating: Moving the cursor Arrow keys don't always work (on every machine) but you can still get around! Emacs Style Notation (man bash "readline") C-x = Control - x M-x = Meta (Esc) - x S-x = Super - x M-C-x = Meta - Control - x Up / Down [history] (C-p, C-n) Left / Right (C-b, C-f) Home / End (C-a, C-e) Back / Forward Word (M-f, M-b) Tab Completion Cancel (C-c) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Navigating: Killing / Yanking The kill ring kill-line [cut] (C-k) unix-word-rubout [cut] (C-w) Yanking [paste] (C-y) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Navigating: Repeat, Undo, and More undo (C-_) M-# (Repeat next command # count times) history reverse-search-history (C-r) beginning-of-history (M-<) end-of-history (M->) Escaping characters (\ , \\, \', etc.) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Navigating: Process Management Kill process (C-c) Suspend process (C-z) Logout / Exit (C-d) jobs / bg / fg / & top, ps kill, killall Signals Multiple Commands (;, &&, ||) Piping (|) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Learning the tools: Index Making notes Pagers (more/less) Man pages -h --help, etc. When all else fails... %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Learning the tools: Making Notes Use what works for you! Text files: ~/notes/tool.txt Multi-document text editor (kate, gedit) Personal Wiki / CMS Email / Google Docs Do not over-document: Used the man page Looked it up online Took more than a minute to figure out Use notes more like a cookbook %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Learning the tools: Pagers More / Less Arrow keys (don't always work!) Next line(s) (C-n) Prev line(s) (C-p) Next half-page (Space) Prev half-page (C-u) End of file (>) Home of file (<) Searching! (/) Case insensitive (-i) Multiple files Next file (:n) Previous flie (:p) Help (h) Quit (q) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Learning the tools: Man pages / -h Use your pager skills Man page levels [kill(2) = man 2 kill] man -k (apropos) [mount, for example] man -f (whatis) Not just for commands [smb.conf(5)] Man pages are not always installed! command -h or --help May provide a list of available arguments %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Learning the tools: Man pages Use your pager skills Man page levels [kill(2) = man 2 kill] man -k (apropos) [mount, for example] man -f (whatis) Not just for commands [smb.conf(5)] %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Learning the tools: When all else fails /usr/share/doc Internet Online man pages die.net Your distribution's website Project's website Searching keywords: cmdname command line Mailing lists Project's mailing list Linux users group %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Useful commands: Index Xterm tips System tools Utilities Multimedia Web tools %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Useful commands: Xterm tips ~/.Xdefaults contents: XTerm*background: black XTerm*foreground: green XTerm*highlightColor: blue XTerm*saveLines: 10000 Ctrl+Click: Main options Ctrl+Middle Click: VT Options Ctrl+Right Click: VT Fonts %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Useful commands: System Tools Disk: mount/umount, df, du, dd mount # Shows mounted filesystems df -h # Shows disk usage (human readable) du -hC *.mp3 # Total size of file list Memory: free Time: date, hwclock Network: ifconfig, route, hostname Printing: lpr, lp, pdf2ps %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Useful commands: Utilities Editing files: nano, emacs, vi, ee, pico, etc. tar tar xzvf file.tar.gz (or .tgz) tar xjvf file.tar.bz2 (or .tbz) tar czvf newfile.tgz files... tar xzvf ... -C /otherdir zip unzip file.zip %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Useful commands: Utilities screen # manage more than one terminal, and more! find # List files find /usr -iname "*kate*" locate # Find files by name locate kate | grep doc grep # Search in files grep -r scp ~/notes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Useful commands: Multimedia: Music/Video: mplayer (-vo aa, for ASCII!) left/right/up/down/pgup/pgdown quit (q) pause (space) cdio (shell for controlling CD audio) cdparanoia -B # Rip CD to wav in current dir lame (create mp3s) lame infile.wav outfile.mp3 cdrecord (create cd from audio or data) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Useful commands: Multimedia: DVD Play: mplayer dvd://1 Rip: mencoder dvd://1 -mf fps=25 -o /dev/null -ovc xvid -xvidencopts pass=1:bitrate=3000 -vf eq2=1.5 -alang en -oac copy mencoder dvd://1 -mf fps=25 -o output.avi -ovc xvid -xvidencopts pass=2:bitrate=3000 -vf eq2=1.5 -alang en -oac copy %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Useful commands: Multimedia: Images: ImageMagick: display -resize 1280x1024 ... (arrow keys, space, backspace to navigate) convert -resize 1280x1024 file.jpg output.jpg Rotate: jhead -autorot *.jpg %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Useful commands: Web Tools Download: curl, wget, fetch Web: links / lynx back (left) follow link (right or enter) quit (q) goto URL (g) help (h) FTP: ftp glob on get / put mget / mput for multiple files Bittorrent: rtorrent See man page for commands, it's awesome! %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Useful commands: Web Tools Windows share: smbclient, nmblookup, smbmount smbtree -N # Show all non-passworded shares! nmblookup -M -- - # master browser nmblookup -A IP # Find smb name by ip smbclient -L //machine # list shares smbclient //machine/share At the command line, type "help" for a list of commands SSH, SCP: ssh user@host "commands" command > ssh user@host "commands" scp file user@host:/remote/location scp user@host:"/remote/file/glob/*" /local/location ssh -L 8080:mythtv:80 mcarlson.ca Escape characters: ~. Disconnect ~# List forwarded connections %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Other tips: X.org alt+click/drag moves a window alt+F2 opens "Run Program" dialog %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page Summary: Resources IRC: irc.freenode.net ##linux (>800 users) ##ubuntu (>1000 users) Internet Search Queries: linux command line bash1liners sed1liners Rosetta Stone for Unix bash color %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %page The End. Visit %font "typewriter", fore "blue" http://mcarlson.ca/cossfest2009 %fore "gray20", font "standard" For a copy of these slides