summaryrefslogtreecommitdiff
path: root/pocketHelp.html
blob: 21c70913eb2d04b031a57afcb23e4648c1d5836c (plain)
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
  2. "http://www.w3.org/TR/html4/strict.dtd">
  3. <html lang="en">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  6. <title>pocket wiki - Terminal commands</title>
  7. <meta name="author" content="Natalie Downe">
  8. <!-- Date: 2009-05-23 -->
  9. <link rel="stylesheet" href="css/main.css" type="text/css">
  10. <link rel="stylesheet" href="css/print.css" type="text/css" media="print">
  11. <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
  12. <script type="text/javascript" src="js/dynamic.js"></script>
  13. </head>
  14. <body>
  15. <div id="book">
  16. <div id="page1" class="page">
  17. <div class="inner">
  18. <h1><span>pocket wiki</span>Terminal commands</h1>
  19. <div class="footer">
  20. <p>This book belongs to:</p><br><br>
  21. <hr>
  22. </div>
  23. </div>
  24. </div>
  25. <div id="page2" class="page">
  26. <div class="inner">
  27. <h2>navigate the file tree</h2>
  28. <p><span class="micro">changing directory to <code>dirname</code></span>
  29. <code>cd dirname</code>
  30. </p>
  31. <p><span class="micro">move up a directory in the tree</span>
  32. <code>cd ..</code>
  33. <span class="micro">dont forget you can drag a folder in from the finder to get a path to that directory</span>
  34. </p>
  35. <p><span class="micro">go back to the last directory I was in</span>
  36. <code>cd -</code>
  37. </p>
  38. <p><span class="micro">where am I? (present working directory)</span>
  39. <code>pwd</code>
  40. </p>
  41. <p><span class="micro">list what's in this directory</span>
  42. <code>ls</code>
  43. </p>
  44. <p><span class="micro">now give me more information in the listing</span>
  45. <code>ls -lah</code>
  46. </p>
  47. <p><span class="micro">ssh to server</span>
  48. <code>ssh user@domain.com</code>
  49. </p>
  50. </div>
  51. </div>
  52. <div id="page3" class="page">
  53. <div class="inner">
  54. <h2>find <abbr class="amp" title="and">&amp;</abbr> open</h2>
  55. <p><span class="micro">list all files recursively in subdomains</span>
  56. <code>find .</code>
  57. </p>
  58. <p><span class="micro">find all files with '<code>.css</code>' in the name</span>
  59. <code>find . | grep .css</code>
  60. </p>
  61. <p><span class="micro">find the string '<code>prose</code>' in the contents of all the files in this directory</span>
  62. <code>grep -r "prose" .</code>
  63. </p>
  64. <p><span class="micro">open a file as if you had double clicked it in the finder (mac only)</span>
  65. <code>open filename</code>
  66. </p>
  67. <p><span class="micro">open the current directory in the finder</span>
  68. <code>open .</code>
  69. </p>
  70. <p><span class="micro">make a directory called <code>dirname</code></span>
  71. <code>mkdir dirname</code>
  72. </p>
  73. <p><span class="micro">create a file called <code>filename</code> if it doesnt exist or update last modified date if it does</span>
  74. <code>touch filename</code>
  75. </p>
  76. </div>
  77. </div>
  78. <div id="page4" class="page">
  79. <div class="inner">
  80. <h2>move, remove <abbr class="amp" title="and">&amp;</abbr> copy</h2>
  81. <p><span class="micro">move or rename a file or directory</span>
  82. <code>mv oldname newname</code>
  83. </p>
  84. <p><span class="micro">remove a file</span>
  85. <code>rm filename</code>
  86. </p>
  87. <p><span class="micro">remove a directory and all its contents. <strong>BE VERY CAREFUL!</strong> you could easily delete everything!</span>
  88. <code>rm -rf dirname</code>
  89. </p>
  90. <p><span class="micro">copy a file</span>
  91. <code>cp oldfilename newfilename</code>
  92. </p>
  93. <p><span class="micro">copy a directory and everything in it</span>
  94. <code>cp -r olddirname newdirname</code>
  95. </p>
  96. <p><span class="micro">securely copy a file to / on a remote server</span>
  97. <code>scp file user@domain.com:</code>
  98. <span class="micro">you can also copy a directory using <code>scp -r</code></span>
  99. </p>
  100. </div>
  101. </div>
  102. <div id="page5" class="page">
  103. <div class="inner">
  104. <h2>subversion</h2>
  105. <p><span class="micro">check out a repository to the current directory</span>
  106. <code>svn co URL .</code>
  107. </p>
  108. <p><span class="micro">update local directory from repository</span>
  109. <code>svn up</code>
  110. </p>
  111. <p><span class="micro">are there new or modified files?</span>
  112. <code>svn status</code>
  113. </p>
  114. <p><span class="micro">add new files to the repository</span>
  115. <code>svn add filename</code>
  116. </p>
  117. <p><span class="micro">remove a file from subversion</span>
  118. <code>svn remove filename</code>
  119. </p>
  120. <p><span class="micro">mark a previously conflicted file as resolved</span>
  121. <code>svn resolved filename</code>
  122. </p>
  123. <p><span class="micro">who changed what line number of this file</span>
  124. <code>svn blame filename</code>
  125. </p>
  126. <p><span class="micro">commit all changes in this directory</span>
  127. <code>svn commit -m "commit msg"</code>
  128. </p>
  129. </div>
  130. </div>
  131. <div id="page6" class="page">
  132. <div class="inner">
  133. <h2>subversion <abbr class="amp" title="and">&amp;</abbr> download</h2>
  134. <p><span class="micro">is this directory checked out from svn? and where?</span>
  135. <code>svn info</code>
  136. </p>
  137. <p><span class="micro">show everything that has changed</span>
  138. <code>svn diff</code>
  139. </p>
  140. <p><span class="micro">show what has changed in one file</span>
  141. <code>svn diff filename</code>
  142. </p>
  143. <p><span class="micro">open text editor in order to specify which files to ignore from svn</span>
  144. <code>svn propedit svn:ignore .</code>
  145. </p>
  146. <p><span class="micro">download a file to the current directory</span>
  147. <code>wget URL</code>
  148. </p>
  149. <p><span class="micro">show the contents of a file in the terminal</span>
  150. <code>curl URL</code>
  151. </p>
  152. </div>
  153. </div>
  154. <div id="page7" class="page">
  155. <div class="inner">
  156. <h2>help <abbr class="amp" title="and">&amp;</abbr> information</h2>
  157. <p><span class="micro">run any command as root</span>
  158. <code>sudo your-command-here</code>
  159. </p>
  160. <p><span class="micro">get help for any command, eg <code>svn</code></span>
  161. <code>svn --help</code>
  162. </p>
  163. <p><span class="micro">what is the uptime of this computer</span>
  164. <code>uptime</code>
  165. </p>
  166. <p><span class="micro">what is the size of the current directory and all the contents</span>
  167. <code>du -h</code>
  168. </p>
  169. <p><span class="micro">cancel the command you were currently typing</span>
  170. <code>ctrl + c</code>
  171. </p>
  172. <p><span class="micro">go to the beginning of the line in the terminal</span>
  173. <code>ctrl + a</code>
  174. </p>
  175. <p><span class="micro">go to the end of the line in the terminal</span>
  176. <code>ctrl + e</code>
  177. </p>
  178. </div>
  179. </div>
  180. <div id="page8" class="page lines">
  181. </div>
  182. </div>
  183. </body>
  184. </html>