You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tutorials/the-terminal/index.html
+33-27Lines changed: 33 additions & 27 deletions
Original file line number
Diff line number
Diff line change
@@ -76,7 +76,7 @@
76
76
<body>
77
77
<main>
78
78
<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 <codeclass="small-caps">file</code>and <codeclass="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>
<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>
89
89
90
90
<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 <spanclass="small-caps">vs</span>Code, assuming the shell commands have been installed. Typing <kbd>code .</kbd> opens the current folder in <spanclass="small-caps">vs</span>Code, and typing <kbd>code <spanclass="small-caps">file</span></kbd> opens <codeclass="small-caps">file</code> in <spanclass="small-caps">vs</span> Code.</dd>
92
92
93
-
<dt><kbd>cat FILE</kbd></dt>
94
-
<dd>Displays the contents of <code>FILE</code>, then returns control to The Terminal.</dd>
<dd>Displays the contents of <codeclass="small-caps">file</code>, then returns control to The Terminal.</dd>
95
95
96
96
<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/<spanclass="small-caps">your_name</span></code>. Typing <kbd>cd <spanclass="small-caps">folder</span></kbd> changes into <codeclass="small-caps">folder</code> and typing <kbd>cd ../<spanclass="small-caps">folder</span></kbd> changes into a directory called <codeclass="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>
98
98
99
99
<dt><kbd>clear</kbd></dt>
100
100
<dd>Clears the screen of any content, placing the cursor at the top of The Terminal’s window.</dd>
101
101
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>
<dd>Copies the file <code><spanclass="small-caps">file</span>.txt</code> to a new file called <code><spanclass="small-caps">copy-of-file</span>.txt</code></dd>
104
104
105
-
<dt><kbd>head FILE.html</kbd></dt>
106
-
<dd>Shows the first 10 lines of <code>FILE.html</code></dd>
<dd>Shows the first 10 lines of <code><spanclass="small-caps">file</span>.html</code></dd>
107
107
108
108
<dt><kbd>history</kbd></dt>
109
109
<dd>Displays a history of all the commands typed into The Terminal.</dd>
110
110
111
111
<dt><kbd>ls</kbd></dt>
112
112
<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>
113
113
114
-
<dt><kbd>man COMMAND</kbd></dt>
115
-
<dd>Displays the manual for <code>COMMAND</code>.</dd>
<dd>Displays the manual for <codeclass="small-caps">command</code>.</dd>
116
116
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>
<dd>Creates a new folder called <codeclass="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 <codeclass="small-caps">a</code>, <codeclass="small-caps"><codeclass="small-caps">b</code></code>, and <codeclass="small-caps">c</code> don’t exist. Running <kbd>mkdir -p <spanclass="small-caps">a/b/c</span></kbd> would create folder <codeclass="small-caps">c</code> inside folder <codeclass="small-caps">b</code> inside folder <codeclass="small-caps">a</code>.</dd>
119
119
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>
<dd>Moves <codeclass="small-caps">file</code> inside <codeclass="small-caps">folder</code>. <code>mv</code> is also used to rename a file. For example, <kbd>mv <spanclass="small-caps">file</span><spanclass="small-caps">file_with_new_name</span></kbd> renames <codeclass="small-caps">file</code> → <codeclass="small-caps">file_with_new_name</code></dd>
122
122
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>
<dd>Render the contents of <codeclass="small-caps">file</code> one screenful at a time. Type<kbd>q</kbd> to exit.</dd>
125
125
126
126
<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<spanclass="small-caps">os</span>’s Finder. Also does things like open a <codeclass="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>
128
128
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>
<dd>Removes <codeclass="small-caps">file</code>. Some Linux and mac<spanclass="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 <spanclass="small-caps">file</span></kbd> would ask if you want to <code>remove <spanclass="small-caps">file</span>?</code>.<br><br>To recursively remove a folder, run <kbd>rm -r <spanclass="small-caps">folder</span></kbd>; and, to forcefully and recursively remove a directory without interaction, run <kbd>rm -fr <spanclass="small-caps">folder</span></kbd>.</dd>
131
131
132
-
<dt><kbd>sudo COMMAND</kbd></dt>
133
-
<dd>Run <code>COMMAND</code> as the current user with privileged access.</dd>
<dd>Creates a new, empty file called <codeclass="small-caps">file</code>. If <codeclass="small-caps">file</code> exists, <code>touch</code> does nothing.</dd>
<dd>Provides info about whether <codeclass="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 <codeclass="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>
<dd>Locates and prints the path to <codeclass="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 <codeclass="small-caps">program</code>.</dd>
0 commit comments