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
+60-33Lines changed: 60 additions & 33 deletions
Original file line number
Diff line number
Diff line change
@@ -42,20 +42,41 @@
42
42
padding:1px2px;
43
43
}
44
44
45
-
kbd,code {
46
-
font-size:1rem;
45
+
code {
46
+
background-color: transparent;
47
+
}
48
+
49
+
code .small-caps {
50
+
font-weight: bold;
47
51
}
48
52
49
53
dd {
50
-
margin-top:12px;
51
-
margin-bottom:28px;
54
+
margin-bottom:40px;
55
+
}
56
+
57
+
dt {
58
+
background-color:rgb(245,245,245);
59
+
border-radius:6px;
60
+
padding-left:8px;
61
+
line-height:32px;
62
+
}
63
+
64
+
samp {
65
+
font-family: monospace;
66
+
font-size:1rem;
67
+
}
68
+
69
+
.small-caps {
70
+
letter-spacing:.025rem;
71
+
/* font-size: 1.125rem; */
72
+
font-variant: small-caps;
52
73
}
53
74
</style>
54
75
</head>
55
76
<body>
56
77
<main>
57
78
<h1>Basic Terminal Tutorial</h1>
58
-
<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 keyboard aliases (shortcuts), usually in a file called <code>.bash_aliases</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>
68
89
69
-
<dt><kbd>atom</kbd></dt>
70
-
<dd>Launches Atom, assuming the shell commands have been installed. Typing <kbd>atom .</kbd> opens the current folder in Atom and typing <kbd>atom FILE</kbd> opens <code>FILE</code> in Atom.</dd>
90
+
<dt><kbd>code</kbd></dt>
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>
71
92
72
-
<dt><kbd>cat FILE</kbd></dt>
73
-
<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>
74
95
75
96
<dt><kbd>cd</kbd></dt>
76
-
<dd>Changes directory to your home folder, <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.</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>
77
98
78
99
<dt><kbd>clear</kbd></dt>
79
100
<dd>Clears the screen of any content, placing the cursor at the top of The Terminal’s window.</dd>
80
101
81
-
<dt><kbd>cp FILE.txt COPY-OF-FILE.txt</kbd></dt>
82
-
<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>
83
104
84
-
<dt><kbd>head FILE.html</kbd></dt>
85
-
<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>
86
107
87
108
<dt><kbd>history</kbd></dt>
88
-
<dd>Displays a history of all the typed commands into The Terminal.</dd>
109
+
<dd>Displays a history of all the commands typed into The Terminal.</dd>
89
110
90
111
<dt><kbd>ls</kbd></dt>
91
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>
92
113
93
-
<dt><kbd>man COMMAND</kbd></dt>
94
-
<dd>Displays the manual for <code>COMMAND</code>.</dd>
<dd>Displays the manual for <codeclass="small-caps">command</code>.</dd>
95
116
96
-
<dt><kbd>mkdir NEW_FOLDER</kbd></dt>
97
-
<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>
98
119
99
-
<dt><kbd>mv FILE FOLDER/</kbd></dt>
100
-
<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>
101
122
102
-
<dt><kbd>more FILE</kbd></dt>
103
-
<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>
104
125
105
126
<dt><kbd>open .</kbd></dt>
106
-
<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>
<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>
<dd>Run <codeclass="small-caps">command</code> as the current user with privileged access.</dd>
107
134
108
-
<dt><kbd>rm FILE</kbd></dt>
109
-
<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>Creates a new, empty file called <codeclass="small-caps">file</code>. If <codeclass="small-caps">file</code> exists, <code>touch</code> does nothing.</dd>
113
140
114
-
<dt><kbd>tail FILE.html</kbd></dt>
115
-
<dd>Shows the last 10 lines of<code>FILE.html</code></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>
116
143
117
-
<dt><kbd>touch FILE</kbd></dt>
118
-
<dd>Creates a new, empty file called<code>FILE</code>. If <code>FILE</code>exists, <code>touch</code> does nothing.</dd>
<dd>Locates and prints the path to<codeclass="small-caps">program</code>. For example, if you wanted to know where the <code>ls</code>program was installed, <kbd>which ls</kbd> would 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