Skip to content

Commit e3f2f18

Browse files
committed
Update terminal tutorial
1 parent fbb088f commit e3f2f18

File tree

1 file changed

+33
-27
lines changed

1 file changed

+33
-27
lines changed

tutorials/the-terminal/index.html

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
<body>
7777
<main>
7878
<h1>Basic Terminal Tutorial</h1>
79-
<p>In the examples below, items in <code>CAPS</code> are filler content representing an actual file or folder on your computer. Items you type into The Terminal appear in <kbd>light blue</kbd>.</p>
79+
<p>In the examples below, content in small capital letters set in a monospace typeface, such as <code class="small-caps">file</code> and <code class="small-caps">folder</code>, indicate filler content, such as a file or folder from your computer. Content you’d type into The Terminal is also set in a monospace typeface, but surrounded by a <kbd>light blue</kbd> background.</p>
8080
<dl>
8181
<dt><kbd>./</kbd></dt>
8282
<dd>The current directory.</dd>
@@ -85,58 +85,64 @@ <h1>Basic Terminal Tutorial</h1>
8585
<dd>The parent of the current directory.</dd>
8686

8787
<dt><kbd>alias</kbd></dt>
88-
<dd>Displays all aliases (keyboard shortcuts), usually in a file called <code>.bash_aliases</code>, assigned to commands. <strong>Note</strong>: To run the default version of any command to which an alias has been assigned, precede it with a backslash (<code>\</code>). For example, <kbd>\rm</kbd> would bypass my alias of <code>'rm -i'</code>.</dd>
88+
<dd>Displays all aliases (keyboard shortcuts), usually in a file called <code>.bash_aliases</code>, assigned to commands. <strong>Note</strong>: To run the default version of any command to which an alias has been assigned, precede it with a backslash (<code>\</code>). For example, running <kbd>\rm</kbd> in my terminal would bypass my alias of <code>'rm -i'</code>.</dd>
8989

9090
<dt><kbd>code</kbd></dt>
91-
<dd>Launches VS Code, assuming the shell commands have been installed. Typing <kbd>code .</kbd> opens the current folder in VS Code, and typing <kbd>code FILE</kbd> opens <code>FILE</code> in VS Code.</dd>
91+
<dd>Launches <span class="small-caps">vs</span> Code, assuming the shell commands have been installed. Typing <kbd>code .</kbd> opens the current folder in <span class="small-caps">vs</span> Code, and typing <kbd>code <span class="small-caps">file</span></kbd> opens <code class="small-caps">file</code> in <span class="small-caps">vs</span> Code.</dd>
9292

93-
<dt><kbd>cat FILE</kbd></dt>
94-
<dd>Displays the contents of <code>FILE</code>, then returns control to The Terminal.</dd>
93+
<dt><kbd>cat <span class="small-caps">file</span></kbd></dt>
94+
<dd>Displays the contents of <code class="small-caps">file</code>, then returns control to The Terminal.</dd>
9595

9696
<dt><kbd>cd</kbd></dt>
97-
<dd>Changes directory to your home folder, which likely is <code>~/Users/YOUR_NAME</code>. Typing <kbd>cd FOLDER</kbd> changes into <code>FOLDER</code> and typing <kbd>cd ../FOLDER</kbd> changes into a directory called <code>FOLDER</code> in the current directory’s parent. Typing <kbd>cd</kbd> from anywhere in your directory tree will take you home.</dd>
97+
<dd>Changes directory to your home folder, which is likely <code>~/Users/<span class="small-caps">your_name</span></code>. Typing <kbd>cd <span class="small-caps">folder</span></kbd> changes into <code class="small-caps">folder</code> and typing <kbd>cd ../<span class="small-caps">folder</span></kbd> changes into a directory called <code class="small-caps">folder</code> in the current directory’s parent. Typing <kbd>cd</kbd> from anywhere in your directory tree will take you home.</dd>
9898

9999
<dt><kbd>clear</kbd></dt>
100100
<dd>Clears the screen of any content, placing the cursor at the top of The Terminal’s window.</dd>
101101

102-
<dt><kbd>cp FILE.txt COPY-OF-FILE.txt</kbd></dt>
103-
<dd>Copies the file <code>FILE.txt</code> to a new file called <code>COPY-OF-FILE.txt</code></dd>
102+
<dt><kbd>cp <span class="small-caps">file</span>.txt <span class="small-caps">copy-of-file</span>.txt</kbd></dt>
103+
<dd>Copies the file <code><span class="small-caps">file</span>.txt</code> to a new file called <code><span class="small-caps">copy-of-file</span>.txt</code></dd>
104104

105-
<dt><kbd>head FILE.html</kbd></dt>
106-
<dd>Shows the first 10 lines of <code>FILE.html</code></dd>
105+
<dt><kbd>head <span class="small-caps">file</span>.html</kbd></dt>
106+
<dd>Shows the first 10 lines of <code><span class="small-caps">file</span>.html</code></dd>
107107

108108
<dt><kbd>history</kbd></dt>
109109
<dd>Displays a history of all the commands typed into The Terminal.</dd>
110110

111111
<dt><kbd>ls</kbd></dt>
112112
<dd>Displays the files and folders in the current directory, excluding those that start with a dot. Typing <kbd>ls -a</kbd> lists all files and folders that start with and without a dot. And, typing <kbd>ls -d .*</kbd> lists only files and folders that start with a dot.</dd>
113113

114-
<dt><kbd>man COMMAND</kbd></dt>
115-
<dd>Displays the manual for <code>COMMAND</code>.</dd>
114+
<dt><kbd>man <span class="small-caps">command</span></kbd></dt>
115+
<dd>Displays the manual for <code class="small-caps">command</code>.</dd>
116116

117-
<dt><kbd>mkdir NEW_FOLDER</kbd></dt>
118-
<dd>Creates a new folder called <code>NEW_FOLDER</code> in the current directory. Using the <code>-p</code> flag creates intermediate folders. For example, to create folder <code>C</code> inside folder <code>B</code> inside folder <code>A</code>, none of which exists, you’d run <kbd>mkdir -p A/B/C</kbd>.</dd>
117+
<dt><kbd>mkdir <span class="small-caps">new_folder</span></kbd></dt>
118+
<dd>Creates a new folder called <code class="small-caps">new_folder</code> in the current directory. Using the <code>-p</code> flag creates any non-existing intermediate folders without having to create each of the intermediate folders individually. For example, assume folders <code class="small-caps">a</code>, <code class="small-caps"><code class="small-caps">b</code></code>, and <code class="small-caps">c</code> don’t exist. Running <kbd>mkdir -p <span class="small-caps">a/b/c</span></kbd> would create folder <code class="small-caps">c</code> inside folder <code class="small-caps">b</code> inside folder <code class="small-caps">a</code>.</dd>
119119

120-
<dt><kbd>mv FILE FOLDER/</kbd></dt>
121-
<dd>Moves <code>FILE</code> inside <code>FOLDER</code>. <code>mv</code> is also used to rename a file. For example, <kbd>mv FILE FILE_WITH_NEW_NAME</kbd> renames <code>FILE</code><code>FILE_WITH_NEW_NAME</code></dd>
120+
<dt><kbd>mv <span class="small-caps">file</span> <span class="small-caps">folder</span>/</kbd></dt>
121+
<dd>Moves <code class="small-caps">file</code> inside <code class="small-caps">folder</code>. <code>mv</code> is also used to rename a file. For example, <kbd>mv <span class="small-caps">file</span> <span class="small-caps">file_with_new_name</span></kbd> renames <code class="small-caps">file</code><code class="small-caps">file_with_new_name</code></dd>
122122

123-
<dt><kbd>more FILE</kbd></dt>
124-
<dd>Render the contents of <code>FILE</code> one screenful at a time. You will need to type <kbd>q</kbd> to exit.</dd>
123+
<dt><kbd>more <span class="small-caps">file</span></kbd></dt>
124+
<dd>Render the contents of <code class="small-caps">file</code> one screenful at a time. Type <kbd>q</kbd> to exit.</dd>
125125

126126
<dt><kbd>open .</kbd></dt>
127-
<dd>Opens the current folder in Mac OS X’s Finder. (This is a Mac-only command.)</dd>
127+
<dd>Opens the current folder (<code>.</code>) in mac<span class="small-caps">os</span>’s Finder. Also does things like open a <code class="small-caps">url</code> in a browser. For example, <kbd>open https://github.com/code-warrior</kbd> launches the web address in your default browser. (In Cygwin, <code>open</code>’s equivalent is <code>cygstart</code> and in Ubuntu it’s <code>xdg-open</code>.)</dd>
128128

129-
<dt><kbd>rm FILE</kbd></dt>
130-
<dd>Removes <code>FILE</code>. Some Linux and Mac OS systems don’t have a guard on the <code>rm</code> command, meaning that the user isn’t asked to verify the removal of a file. Because files removed with <code>rm</code> aren’t retrievable, use the <code>-i</code> flag so you can verify that, indeed, you want to remove a file. For example, <kbd>rm -i FILE</kbd> would ask if you want to <code>remove FILE?</code>.<br><br>To recursively remove a folder, run <kbd>rm -r FOLDER</kbd>; and, to forcefully and recursively remove a directory without interaction, run <kbd>rm -fr FOLDER</kbd>.</dd>
129+
<dt><kbd>rm <span class="small-caps">file</span></kbd></dt>
130+
<dd>Removes <code class="small-caps">file</code>. Some Linux and mac<span class="small-caps">os</span> systems don’t have a guard on the <code>rm</code> command, meaning that the user isn’t asked to verify the removal of a file. Because files removed with <code>rm</code> aren’t retrievable, use the <code>-i</code> flag so you can verify that, indeed, you want to remove a file. For example, <kbd>rm -i <span class="small-caps">file</span></kbd> would ask if you want to <code>remove <span class="small-caps">file</span>?</code>.<br><br>To recursively remove a folder, run <kbd>rm -r <span class="small-caps">folder</span></kbd>; and, to forcefully and recursively remove a directory without interaction, run <kbd>rm -fr <span class="small-caps">folder</span></kbd>.</dd>
131131

132-
<dt><kbd>sudo COMMAND</kbd></dt>
133-
<dd>Run <code>COMMAND</code> as the current user with privileged access.</dd>
132+
<dt><kbd>sudo <span class="small-caps">command</span></kbd></dt>
133+
<dd>Run <code class="small-caps">command</code> as the current user with privileged access.</dd>
134134

135-
<dt><kbd>tail FILE.html</kbd></dt>
136-
<dd>Shows the last 10 lines of <code>FILE.html</code></dd>
135+
<dt><kbd>tail <span class="small-caps">file</span></kbd></dt>
136+
<dd>Shows the last 10 lines of <code><span class="small-caps">file</span></code></dd>
137137

138-
<dt><kbd>touch FILE</kbd></dt>
139-
<dd>Creates a new, empty file called <code>FILE</code>. If <code>FILE</code> exists, <code>touch</code> does nothing.</dd>
138+
<dt><kbd>touch <span class="small-caps">file</span></kbd></dt>
139+
<dd>Creates a new, empty file called <code class="small-caps">file</code>. If <code class="small-caps">file</code> exists, <code>touch</code> does nothing.</dd>
140+
141+
<dt><kbd>type <span class="small-caps">program</span></kbd></dt>
142+
<dd>Provides info about whether <code class="small-caps">program</code> is an alias, command, function, etc. Combine the <code>-all</code> flag — for “all locations” — with <code>type</code> to see everything associated with <code class="small-caps">program</code>. For example, <kbd>type -all ls</kbd> reveals on my system that <code>ls</code> is aliased to <code>`ls --color=auto'</code> and that it resides at <code>/bin/ls</code> in my file system.</dd>
143+
144+
<dt><kbd>which <span class="small-caps">program</span></kbd></dt>
145+
<dd>Locates and prints the path to <code class="small-caps">program</code>. For example, if you wanted to know where the <code>touch</code> program was installed, <kbd>which ls</kbd> might respond with <code>/bin/ls</code>. Consider aliasing <code>which</code> to <kbd>type -all</kbd> in order to get more info about <code class="small-caps">program</code>.</dd>
140146
</dl>
141147
</main>
142148
</body>

0 commit comments

Comments
 (0)