<<

Extracted from:

Ubuntu Kung Fu Tips, Tricks, Hints, and Hacks

This PDF file contains pages extracted from Kung Fu, published by the Pragmatic Bookshelf. For more information or to purchase a paperback or PDF copy, please visit http://www.pragprog.com.

Note: This extract contains some colored text (particularly in code listing). This is available only in online versions of the books. The printed versions are black and white. Pagination might vary between the online and printer versions; the content is otherwise identical.

Copyright © 2008 The Pragmatic , LLC.

All rights reserved.

No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior consent of the publisher. Contents

1 Introduction 17 1.1 How to Read This Book ...... 18 1.2 Acknowledgments ...... 19 1.3 Sharing ...... 20

2 An Ubuntu Administration Crash Course 21 2.1 The Ubuntu Desktop ...... 22 2.2 Users, Passwords, and Files ...... 24 2.3 Command Line or GUI? ...... 27 2.4 Software Installation and Management ...... 38 2.5 Using -editor ...... 52 2.6 Editing Configuration Files ...... 53 2.7 Making and Keeping Backups ...... 55 2.8 Rescue Me! What to Do If It All Goes Wrong ...... 57 2.9 Miscellaneous Things You Ought to Know ...... 59

3 The Tips 64 1. Set Any Picture as Wallpaper with a Single Click . . . . 65 2. See (and Reuse) the Most Recently Typed Commands . 66 3. Add Cool New Visualizations to Totem/ . . 67 4. Switch Monitor Resolutions with a Single Mouse Click 67 5. Closely Monitor the Power Consumption of a Laptop . 68 6. Stop the Cursor from Blinking ...... 68 7. Scroll Without the Mouse in Firefox and Evolution Mail Windows ...... 69 8. Optimize Startup for Faster Boot Times ...... 69 9. Graph the System Bootup Performance ...... 73 10. Change ’s Printing Font ...... 74 11. Shrink or Enlarge Images at the Command Line . . . . 75 12. View All a Digital Photo’s Technical Information . . . . 76 13. Have Ubuntu Speak to You ...... 76 14. Instantly Search for Files in Nautilus ...... 77 CONTENTS 8

15. Take Photos or Record Videos with Your Webcam . . . 77 16. Add RAR File Compression Support to Ubuntu . . . . . 78 17. Add a Swap File or Expand Existing Swap Space . . . . 78 18. Get Rid of the Virtual Console Legal Boilerplate . . . . 80 19. Make Wubi Installations of Ubuntu Run Faster . . . . 80 20. Make Website or Email Links Automatically Install Software ...... 81 21. Make Fonts Look Superb ...... 82 22. Download Updates Faster ...... 83 23. Slow Down a Touchpad’s Scrolling ...... 84 24. Ensure Your Windows Partition Is Always Available Under Ubuntu ...... 85 25. Improve the GNOME Terminal Look and Feel ...... 86 26. Ensure Ubuntu Always Knows the Time ...... 87 27. Get More Data onto CD-R Discs ...... 87 28. Share Files Across the Network (Without Tearing Your Hair Out) ...... 88 29. Save Ink When Printing ...... 90 30. Browse the Web from the Command Line ...... 91 31. Create an “Ubuntu Install” USB Stick ...... 92 32. Add a Menu Entry for Ubuntu’s Compression Tool . . . 93 33. Quickly Run Applications Without Opening a Termi- nal Window ...... 94 34. Instantly Search Google for Any Word or Phrase . . . . 94 35. Ensure You’re Informed About the Newest Releases of Ubuntu ...... 96 36. Create a File Delete Command That Uses the Trash . . 96 37. Configure Ubuntu’s Firewall ...... 97 38. Repair Windows from Within Ubuntu ...... 102 39. Empty the Trash Even If Told You Can’t ...... 102 40. Log On Automatically After Bootup ...... 103 41. Use an Alternative Wifi Connection Manager ...... 103 42. Make Evolution More Like Outlook (Just a Little Bit) . 105 43. Give Ubuntu a Static IP Address ...... 106 44. Format a USB Memory Stick (or Camera Memory Card) 108 45. Protect Ubuntu So It Can’t Be Booted Without a Pass- word ...... 110 46. Dump the Text on a Virtual Console to a File ...... 113 47. Eliminate the Time Period During Which sudo/gksu Powers Hang Around ...... 114 48. Access Ubuntu Files from Windows ...... 115

CLICK HERE to purchase this book now. CONTENTS 9

49. Kill a Crashed GUI ...... 116 50. Make Ubuntu Safe for Children to Use ...... 117 51. Run Two (or More) Desktops at the Same Time . . . . . 120 52. Go Completely Full-Screen in Virtually Any Application 121 53. Make Calculator Round Up (or Down) to Two Digits . . 122 54. Follow the Moon’s Phases ...... 122 55. Import Internet Explorer Settings into Firefox . . . . . 123 56. Drag and Drop Files onto the Terminal Window . . . . 123 57. Use Older Digital Cameras with Ubuntu ...... 123 58. Use the Ultra-quick to Out Commands . . 125 59. Install All the Program Compilation Tools You’ll Need . 125 60. Avoid Network Slowdowns and Incompatibilities . . . . 126 61. Print at the Command Line ...... 127 62. Find the Ubuntu Version and Code Name ...... 127 63. Get Your Webcam Working in Ubuntu ...... 128 64. Downgrade to Firefox 2 ...... 128 65. Install All the Multimedia Playback Codecs You’ll Ever Need ...... 129 66. Get Better DVD Movie Playback ...... 130 67. Run the Terminal with a Single Keypress ...... 131 68. See the APT Cow ...... 131 69. See What Firefox Plug-ins Are Installed ...... 132 70. Kill the Network Connection Instantly ...... 132 71. Post Blog Entries from your Ubuntu Desktop ...... 132 72. Intelligently Select Only the Files You Want ...... 133 73. Temporarily Disable a User Account ...... 134 74. Take Complete Control of Desktop Effects and Anima- tions ...... 135 75. Do Some Desktop Publishing ...... 137 76. Control Volume Levels at the Command Prompt . . . . 137 77. Search the Ubuntu File System ...... 138 78. Remove the “Bad Password” Wait Period ...... 141 79. Make Desktop Icons Really Big ...... 142 80. Run Ubuntu...Without the Components! . . . . . 142 81. Instantly Hide a File or Folder ...... 143 82. Scan for Viruses ...... 143 83. Temporarily Log In as the Root User at the Command Line ...... 146 84. Start the Screensaver from the Command Line . . . . . 147 85. Get the Most Out of (or into) a Nautilus Window . . . . 147 86. View Images at the Command Line ...... 147

CLICK HERE to purchase this book now. CONTENTS 10

87. Administer the Printer from a Web Browser ...... 148 88. Move a Window Without Clicking the Title Bar . . . . . 148 89. Connect to Shared Folders from the Command Line . . 149 90. Deactivate Caps Lock ...... 150 91. Format Floppies ...... 151 92. Switch to a Lightweight File Manager ...... 151 93. Use in Gedit ...... 153 94. Stop ZIP Files That Are Emailed to Colleagues from Getting Lost ...... 154 95. Use an Alternative Email Client ...... 154 96. Ensure People Hear You When Using a Microphone . . 156 97. Quickly Browse to a Location ...... 156 98. Turn Off the Beep ...... 157 99. Add a Second Hard Disk ...... 157 100. Update Ubuntu in the Background ...... 159 101. Install 465 Open Source Fonts ...... 159 102. Be Careful Not to Badly Name Files/Folders in Your Windows Partition ...... 160 103. Make Your Windows Partition Read-Only ...... 160 104. Stop Nautilus from Neatly Arranging Icons ...... 161 105. Run GUI Programs from a Terminal Window Without Tying Up Input ...... 161 106. Set the CPU Speed from the Desktop ...... 162 107. Switch to , , or Without Installing from Scratch ...... 163 108. SSH into Ubuntu from Windows ...... 163 109. Recover a Damaged Desktop ...... 164 110. Recover a Damaged Desktop #2 ...... 164 111. Enable the Root User ...... 164 112. Quickly Create Graphical Text Banners ...... 165 113. Securely Erase Data ...... 166 114. Play Emacs Games ...... 168 115. Fix Video Playback Problems ...... 168 116. Turn Any Text File into a PDF at the Command Line . 168 117. Avoid Repetitive Strain Injury When Using Ubuntu . . 169 118. Uninstall Ubuntu ...... 169 119. Network Ubuntu, Mac, and Windows ...Without Doing Anything ...... 172 120. Access ISO Images As If They Were Disk Drives . . . . 172 121. Improve Ubuntu’s Microsoft Office 2007 File Support . 173 122. Use a Friendly Version of ...... 174

CLICK HERE to purchase this book now. CONTENTS 11

123. Get Around Partitioning Errors If Using Boot Camp on Macs ...... 174 124. Have Macs Correctly Refer to Ubuntu in Dual-Boot Mode 175 125. Sleep, Ubuntu, Sleep! ...... 175 126. Instantly Create an HTML Slideshow of Photos . . . . . 176 127. Reveal the Desktop ...... 176 128. Set Hard Disk Power-Saving ...... 177 129. View the GNOME Desktop Version ...... 178 130. Avoid GNOME Startup Errors ...... 178 131. Use FTP Under Ubuntu ...... 179 132. Switch to Old-Fashioned Tree View in Nautilus . . . . . 180 133. Kill Any Crashed Program ...... 181 134. Increase the Number of Documents Remembered by Gedit ...... 182 135. Utilize All of a Sound Card’s Features ...... 182 136. Monitor Network Speed ...... 183 137. Make the Command Prompt Colorful ...... 184 138. Make Windows Permanently Available ...... 185 139. Give the Boot Menu Wallpaper ...... 186 140. Access All Removable Storage from the Command Line 188 141. Reconfigure Your Graphics Card from the Ground Up . 189 142. Unlock the Package Database ...... 190 143. Administer Ubuntu Using a Web Browser from Any Computer (or ) ...... 190 144. Give Nautilus Windows Their Own Wallpaper ...... 193 145. Create an Encrypted File Store Accessible from Any Operating System ...... 193 146. Find Out How Much Disk Space Is Available ...... 197 147. Make Ubuntu Blue (or Dark Gray or Dark Brown) . . . 198 148. Use Versions of Ubuntu That Are Entirely 199 149. Install OpenOffice.org’s Database Component . . . . . 200 150. Monitor Your Computer’s Temperature and Fan Speeds 200 151. Print Multiple Photos on One Sheet of Paper ...... 201 152. Try Some Alternative Web Browsers ...... 201 153. Quickly Hide/Unhide Windows Using the Keyboard . . 202 154. Convert Images from One Format to Another at the Command Line ...... 203 155. Significantly Expand Gedit’s Functionality ...... 203 156. Make New Mail Windows Taller ...... 204 157. Avoid Making Badly Burned CD-R/RW Discs ...... 204

CLICK HERE to purchase this book now. CONTENTS 12

158. Import Email Messages from Outlook and/or Outlook Express ...... 205 159. Use the Mac OS “Quit” Keyboard Shortcut ...... 206 160. Switch to bash If sh Is in Use ...... 206 161. Instantly Edit a File When You’re Viewing It in . . 207 162. Access Ubuntu’s Desktop from Any Computing Device 207 163. Remove the Annoying Delay When Installing Firefox Extensions ...... 208 164. View Technical Details of Your PC’s Hardware . . . . . 208 165. Switch to Old-Fashioned “Spatial Browsing” Mode . . . 209 166. Clear the Package Cache ...... 210 167. Search man Pages ...... 210 168. Convert a PDF to an Image ...... 211 169. Use a Dial-Up Modem ...... 211 170. Steal the Windows (or Mac OS) Fonts ...... 212 171. Use Unusual Characters or Symbols ...... 214 172. Encrypt and Sign Emails ...... 215 173. Get a Nice Trash Can on the Desktop ...... 219 174. Create .zip Files Using Maximum Compression . . . . . 220 175. Create an Ubuntu “Updates” CD/DVD ...... 220 176. Stop Ubuntu “Graying Out” Stalled Program Windows Quickly ...... 222 177. Get a High-Quality (and Free) Command-Line Word Processor with Microsoft Word ...... 222 178. Create a “Superuser Terminal” Shortcut ...... 224 179. Find Out Who You Are! ...... 225 180. Install Ubuntu Partner Software ...... 225 181. Use a GUI Version of vim ...... 226 182. Rescue a Crashed GUI ...... 226 183. See a Quote of the Day Whenever You Log In ...... 227 184. Make GNOME System Monitor Appear When Ctrl+Alt+ Delete Is Hit ...... 229 185. Change Your Computer’s Name (Hostname) ...... 230 186. Reduce the Wubi Boot Delay ...... 231 187. Swap Around the Minimize, Maximize, and Close But- tons ...... 232 188. Add an Uber-Start Button to Ubuntu ...... 232 189. View Technical Details of PDF Files ...... 233 190. Connect to a Remote Computer As If You Were Sitting in Front of It ...... 233 191. Change Ubuntu’s System Sounds ...... 236

CLICK HERE to purchase this book now. CONTENTS 13

192. Move Around the Command Line Like a Pro ...... 237 193. “Scroll” a Virtual Console ...... 237 194. Do Math at the Command Line ...... 238 195. Create Keyboard Shortcuts That Use the Windows Key 239 196. Create a Text File Without a ...... 240 197. Turn Off the OpenOffice.org Splash Screen ...... 241 198. See Which Virtual Console You’re Working At ...... 241 199. Periodically Change the Desktop Wallpaper ...... 242 200. Get Warned When sudo Powers Hang Around . . . . . 243 201. Add a “Similar Words” Sidebar to the Dictionary . . . . 243 202. Add Drop Shadows to Screenshots ...... 244 203. Create a Backup ISO Image of Almost Any Physical CD/DVD ...... 244 204. Change Firefox’s Spell-Checker Language ...... 245 205. Take Full Control of PulseAudio Sound Output . . . . . 245 206. Use the Command Prompt to Sleep, Hibernate, Shut Down, or Reboot ...... 246 207. Mirror Commands and Output Across Different Ter- minal Windows ...... 247 208. Instantly View a Load of Images as a Slideshow . . . . 248 209. Use a Windows-Style Start Button and Taskbar . . . . 249 210. Change Your Password ...... 251 211. Convert Hex to Decimal (and Vice Versa) ...... 251 212. Quickly Save Pictures on Websites ...... 253 213. Quickly Send Web Links by Email ...... 253 214. Sharpen Images at the Command Line ...... 254 215. View at the Command Line ...... 255 216. Run Windows Programs Under Ubuntu ...... 255 217. Uninstall Ubuntu If Wubi Has Been Used ...... 257 218. See a Visual Representation of File and Folder Locations 258 219. Create Text Banners ...... 259 220. Use a Macintosh OS X–like Dock ...... 261 221. Process Words at the Command Line ...... 262 222. View a Calendar at the Command Prompt ...... 263 223. Repair Ubuntu File System Errors ...... 264 224. Clone Your Ubuntu Installation onto a New Hard Disk 265 225. Create a Boot Log to Help Solve Startup Problems . . . 269 226. Install a Personal FTP Server for File Sharing ...... 270 227. Shut Down, Reboot, Hibernate, or Sleep Ubuntu with a Single Click ...... 274 228. Delete Files Rather Than Trash Them ...... 275

CLICK HERE to purchase this book now. CONTENTS 14

229. Yank a USB Stick Even If You’re Told You Shouldn’t . . 276 230. Rename Many Files at Once (aka Bulk Rename) . . . . 276 231. Get an Alternative Media Player ...... 278 232. Compare Two Files to See Whether They’re Different . 282 233. Use the Mouse at the Virtual Console (complete with Copy and Paste) ...... 282 234. See a Progress Display as the Desktop Loads ...... 283 235. Get Free-of-Charge Ubuntu CDs ...... 284 236. Make the GNOME Terminal Window Translucent . . . 284 237. Automate the Downloading and Installation of New Theme Components ...... 285 238. Burn Ubuntu CD Images (ISOs) Using Windows—for Free ...... 286 239. Quickly Create Links to Files, Folders, and/or Appli- cations ...... 287 240. Monitor CPU Usage ...... 288 241. See Whenever Caps Lock Is Active ...... 289 242. Make Files and Folders Entirely Private ...... 289 243. Get Quick Access to Stuff You’re Working On ...... 290 244. Insert Command-Line Output and Files into the Clip- board ...... 291 245. Have a Cow Talk to You ...... 292 246. Get Notified When New Mail Arrives ...... 292 247. Increase Output “Remembered” by GNOME Terminal . 293 248. Use Ubuntu’s Version of Microsoft Paint ...... 294 249. Have OpenOffice.org Save in Microsoft Office Format by Default ...... 294 250. Password-Protect and Encrypt Files ...... 295 251. Add Notes to Any File/Folder ...... 299 252. Encrypt Files So That Only the Recipient Can Open Them ...... 300 253. See Your File-Browsing History ...... 301 254. Define Your Own Menu Shortcut Keys ...... 301 255. Always Know Your IP Address ...... 302 256. See the Size of Files/Folders on the Desktop ...... 303 257. View Technical Details of Any Multimedia File . . . . . 303 258. Convert PDFs and Images to Flash Slideshows . . . . . 304 259. Create an Alias to Save Typing Long Commands . . . . 305 260. Send Genuine Smileys in Your Emails ...... 306 261. Add an “Open in ” Option to Nautilus’s Right- Click Menu ...... 307

CLICK HERE to purchase this book now. CONTENTS 15

262. Make Windows Bootable If Things Go Wrong During Ubuntu Installation ...... 307 263. Edit the Name and Artist Information of MP3 Files . . . 308 264. Never Touch the Mouse While Using Ubuntu (Well, Almost) ...... 309 265. Alter Image Viewer’s Zoom Speed ...... 310 266. Install Skype ...... 310 267. Arrange Output into Columns ...... 311 268. View Images Without a Graphical Environment . . . . . 312 269. Synchronize Files Between a Laptop and Desktop PC . 312 270. Rename Files Quickly ...... 316 271. Have sudo Insult You ...... 316 272. Make Nautilus Display “Traditional” File Permissions . 317 273. See the GNOME Fish ...... 318 274. Use Desktop Widgets ...... 319 275. Read E-books ...... 321 276. Make (Almost) Any Wifi Card Work with Ubuntu . . . . 321 277. Connect to the Remote Desktop of a Windows Vista Computer ...... 326 278. Use Ubuntu on Your Games Console ...... 327 279. Use a “Legal” MP3 Codec ...... 328 280. Use Look-a-Likes of the Microsoft Fonts ...... 328 281. Play Old MS-DOS Games ...... 329 282. Install Google Applications ...... 330 283. Install MS Comic Sans–Style Fonts ...... 334 284. Use Alternative Office Applications ...... 334 285. Have the Firefox Robot Talk to You ...... 337 286. Back Up Your Data ...... 337 287. Use the Ubuntu Install CD as a General-Purpose Par- titioning Tool ...... 342 288. Give Old Macintosh Computers a New Lease on Life . . 342 289. Use Absolutely Any Picture as an Icon ...... 343 290. Install the GNOME Wallpapers ...... 343 291. Zoom In for More Info in Nautilus ...... 344 292. Play MP3/Ogg Files at the Command Line ...... 344 293. Optimize Ubuntu’s Performance ...... 345 294. Tweak Ubuntu into Oblivion ...... 346 295. Do Just About Anything to a File by Right-Clicking It . 348 296. Get Notified of New Gmail Messages ...... 351 297. OCR Scanned Text ...... 352 298. Use Ubuntu’s Movie Player to Watch YouTube Movies . 354

CLICK HERE to purchase this book now. CONTENTS 16

299. Turn Your Desktop into Your /home Folder ...... 354 300. Avoid Programs Quitting When the Terminal Is Closed 355 301. Allow Terminal Server Client to Access VNC Desktops . 355 302. Search All of Ubuntu’s “Supported” Software ...... 356 303. Install Windows on a Computer That Has Ubuntu on It 356 304. Turn Your Computer into a Egg Timer ...... 360 305. Create a Portable USB Stick Installation of Ubuntu . . 360 306. Enhance the Copy and Paste Clipboard ...... 364 307. Be Told When Your Tea Has Brewed ...... 366 308. Avoid Bad Formatting When Viewing OpenOffice.org Files on Windows ...... 366 309. Fix USB Key Sticks That Wrongly Report They’re Full . 367 310. Use Ubuntu’s Built-in Download Manager ...... 368 311. Avoid an F-Spot Startup Error ...... 369 312. Record Your Desktop ...... 370 313. Take Screenshots in Any Format ...... 371 314. Trace Network Routes ...... 371 315. Automatically Scroll PDF Files ...... 372

Index 373

CLICK HERE to purchase this book now. The Pragmatic Bookshelf The Pragmatic Bookshelf features books written by developers for developers. The titles continue the well-known Pragmatic style and continue to garner awards and rave reviews. As development gets more and more difficult, the Pragmatic Programmers will be there with more titles and products to help you stay on top of your game.

Visit Us Online Ubuntu Kung Fu’s Home Page http://pragprog.com/titles/ktuk from this book, errata, and other resources. Come give us feedback, too!

Register for Updates http://pragprog.com/updates Be notified when updates and new books become available.

Join the Community http://pragprog.com/community Read our weblogs, join our online discussions, participate in our mailing list, interact with our wiki, and benefit from the experience of other Pragmatic Programmers.

New and Noteworthy http://pragprog.com/news Check out the latest pragmatic developments in the news.

Buy the Book If you liked this PDF, perhaps you’d like to have a paper copy of the book. It’s available for purchase at our store: pragprog.com/titles/ktuk.

Contact Us Phone Orders: 1-800-699-PROG (+1 919 847 3884) Online Orders: www.pragprog.com/catalog Customer Service: [email protected] Non-English Versions: [email protected] Pragmatic Teaching: [email protected] Author Proposals: [email protected]