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
\vspace{-100pt} % Prevent text below from moving out of the way
31
+
\end{wrapfigure}
32
+
33
+
\normalfont\Huge\bfseries UWCS Linux 101 Cheatsheet
34
+
35
+
\normalfont\LARGE Programs, Commands \& Tips
36
+
\normalsize
37
+
38
+
\section*{Programs}
39
+
40
+
You usually just need to type the name of a program into the terminal to run it, with a few exceptions. You can usually pass a filepath as an argument too. Here are some examples:
\large PDF Viewers \normalfont & \texttt{okular}, \texttt{evince} \\
50
+
\end{tabular}
51
+
52
+
\raggedright
53
+
54
+
We'd recommend exploring each of these applications in your own time, and find the ones you prefer. Some offer more functionality, others offer ease of use.
55
+
56
+
\section*{Tips}
57
+
58
+
You can clear the shell either by typing \texttt{clear}, or using the shortcut \texttt{Ctrl+L}.
59
+
60
+
You can navigate through your command history using the up and down arrow keys.
61
+
62
+
You can press tab to autocomplete the name of a file, if there is no ambiguity.
63
+
64
+
Generally, you should try to avoid creating directories with a space character in their names.
65
+
This is because arguments passed to a command are separated by spaces.
66
+
If you do, you'll need to surround the name in quotes or put a backslash before every space.
67
+
68
+
If you're running Python, be careful to pick the correct version of it!
69
+
\texttt{python} refers to Python 2, \texttt{python3} to Python 3.6, and we also have \texttt{python3.8}.
70
+
71
+
The method to exit the shell program you're currently using can vary depending on what it is.
72
+
Three of the most common ways to exit are \texttt{Ctrl+C}, \texttt{Ctrl+Z}, and \texttt{q}.
73
+
74
+
The same issue carries over to using the built-in command documentation.
75
+
Although we used \texttt{man} in the lab, this won't always work - two alternatives are the \texttt{---help} flag and \texttt{info} command.
76
+
77
+
If you want to install an IDE with more features such as IntelliJ, PyCharm, or Eclipse, you can
78
+
- but be mindful not to run out of storage space when doing so!
79
+
You get 6GB in your first year, this is raised by 3GB for each subsequent year of your degree.
80
+
To see how much you've got left, use the \texttt{quota} command.
81
+
82
+
Although it might seem pointless to use the terminal when you have a file explorer like Dolphin available, it doesn't offer as much functionality. Not only that, but over time you'll find that it might be faster to navigate using the terminal...
83
+
84
+
\newpage
85
+
86
+
\section*{Commands and Options}
87
+
88
+
(You can compose all single-letter command options: \texttt{-a} and \texttt{-l} can instead be \texttt{-al})
89
+
90
+
\Large\texttt{help} \normalsize\\
91
+
Built-in function help
92
+
93
+
\Large\texttt{ls <path>} \normalsize\\
94
+
List directory contents of the specified path
95
+
96
+
\qquad\texttt{-l} | Output in a detailed format \\
97
+
\qquad\texttt{-R} | Recursively list the contents of subdirectories \\
98
+
\qquad\texttt{-t} | Sort in order of when the file was last modified
99
+
100
+
\Large\texttt{cd <path>} \normalsize\\
101
+
Change directory
102
+
103
+
\Large\texttt{touch <filepath>} \normalsize\\
104
+
Make empty files
105
+
106
+
\Large\texttt{mkdir <filepath>} \normalsize\\
107
+
Make directories
108
+
\begin{itemize}
109
+
\item\texttt{-p} | Create intermediate directories as required (if not used, full path must exist)
110
+
\end{itemize}
111
+
112
+
\Large\texttt{rm <filepath>} \normalsize\\
113
+
Remove directory entities
114
+
\begin{itemize}
115
+
\item\texttt{-r} | Recursively attempt to remove each subdirectory and file.
116
+
\item\texttt{-f} | Remove files without confirmation, if applicable
Copy file name to clipboardExpand all lines: lab.tex
+37-20Lines changed: 37 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -109,10 +109,12 @@ \section*{Creation and Deletion}
109
109
Removes the specified file or directory.
110
110
If non-empty, \bfseries all contents are deleted. \normalfont
111
111
112
-
Flags are optional arguments declared after the command name that add additional functionality. To view a command's full list of arguments, you can type \texttt{man <command>}.
112
+
Flags are optional arguments declared after the command name that add additional functionality.
113
+
To view a command's full list of arguments, you can type \texttt{man <command>}.
113
114
114
115
\bfseries Task 2: \normalfont
115
-
With all of this in mind, it’s time to make some files and folders! We'll walk you through the process of replicating (then partially deleting) the folder structure below.
116
+
With all of this in mind, it’s time to make some files and folders!
117
+
We'll walk you through the process of replicating (then partially deleting) the folder structure below.
116
118
117
119
\begin{verbatim}
118
120
~\
@@ -127,13 +129,11 @@ \section*{Creation and Deletion}
127
129
128
130
While in the home directory, we create the \texttt{foo} directory and it's \texttt{bar.baz} file:
129
131
130
-
\begin{verbatim}
131
-
mkdir foo
132
-
touch foo/bar.baz
133
-
\end{verbatim}
132
+
\qquad\texttt{mkdir foo} \\
133
+
\qquad\texttt{touch foo/bar.baz}
134
134
135
-
To create the \texttt{public$\_$html} directory and its contents, a similar pattern is followed.
136
-
You might think to immediately create both folders using \texttt{mkdir public$\_$html/css}, but this will fail, as \texttt{public$\_$html} does not exist yet.
135
+
To create the \texttt{public\_html} directory and its contents, a similar pattern is followed.
136
+
You might think to immediately create both folders using \texttt{mkdir public\_html/css}, but this will fail, as \texttt{public$\_$html} does not exist yet.
137
137
We can override this behaviour with the \texttt{-p} flag, which creates intermediate directories when required.
138
138
From here, try creating \texttt{index.html} and \texttt{app.css} for yourself.
139
139
@@ -155,7 +155,8 @@ \section*{Editing Files}
155
155
And, just like a programmer's preferred distribution of Linux, it's a large point of contention among us!
156
156
For this lab, we'll be using the fairly modern but basic \texttt{atom} text editor.
157
157
158
-
\bfseries Task 4: \normalfont Using the \texttt{atom <file path>} command to open a file, open up the \texttt{index.html} file we created and insert some HTML.
158
+
\bfseries Task 4: \normalfont
159
+
Using the \texttt{atom <file path>} command to open a file, open up the \texttt{index.html} file we created and insert some HTML.
The \texttt{l} flag for the \texttt{ls} command is very useful, as it shows us detailed information on files and folders. For example, we can see who owns it, the group it belongs to, the size in bytes, and when it was last modified. But what we're interested in is the permissions. They determine not only who can access what, but how:
188
+
The \texttt{l} flag for the \texttt{ls} command is very useful, as it shows us detailed information on files and folders.
189
+
For example, we can see who owns it, the group it belongs to, the size in bytes, and when it was last modified.
190
+
But what we're interested in is the permissions.
191
+
They determine not only who can access what, but how:
These permissions can be modified using the \texttt{chmod} command.
216
220
217
-
The syntax for using \texttt{chmod} is extensive, with two main ways to achieve the same goal. The
218
-
first explicitly states the permissions for each permission group, like so:
221
+
The syntax for using \texttt{chmod} is extensive, with two main ways to achieve the same goal.
222
+
The first explicitly states the permissions for each permission group, like so:
219
223
220
224
\qquad\texttt{chmod u=rwx,g=rx,o=r <file path>}
221
225
222
226
The second way uses an octal digit to represent each permission group:
223
227
224
228
\qquad\texttt{chmod 754 <file path>}
225
229
226
-
Each digit represents user, group and other permissions respectively. These digits are calculated by taking 0, and adding values to it depending on wanted permissions. \\
230
+
Each digit represents user, group and other permissions respectively.
231
+
These digits are calculated by taking 0, and adding values to it depending on wanted permissions. \\
227
232
+4 for read, +2 for write, and +1 for execute.
228
233
229
-
The \texttt{-R} option can be used to perform a recursive permission change. This will modify all files and sub-directories in the directory you specify with your chosen permissions.
234
+
The \texttt{-R} option can be used to perform a recursive permission change.
235
+
This will modify all files and sub-directories in the directory you specify with your chosen permissions.
230
236
231
-
\bfseries Task 5: \normalfont Fix the permissions for your web page. For \texttt{index.html}, give the user read and write permissions, and let the other two permission groups read. Everything else in the \texttt{public$\_$html} directory (including the directory itself) should be set to \texttt{rwx} for the user, and \texttt{rw} for the other two permission groups. Make sure everything is correct afterwards.
237
+
\bfseries Task 5: \normalfont
238
+
Fix the permissions for your web page.
239
+
For \texttt{index.html}, give the user read and write permissions, and let the other two permission groups read.
240
+
Everything else in the \texttt{public$\_$html} directory (including the directory itself) should be set to \texttt{rwx} for the user, and \texttt{rw} for the other two permission groups.
241
+
Make sure everything is correct afterwards.
232
242
233
243
Now, time to see our public web page in all of its underwhelming glory! \\
234
244
This concludes the main part of the lab.
235
245
236
246
\section*{Bonus Tasks}
237
247
238
-
\bfseries B1: \normalfont Navigate to the \texttt{public$\_$html} folder. What do you think these commands do?
248
+
\bfseries B1: \normalfont
249
+
Execute these commands in the \texttt{public$\_$html} folder.
\bfseries B2: \normalfont To help organise your work, try creating a \texttt{modules} directory. You might also want to add sub-directories within it for the ones you're going to take, such as \texttt{cs118} and \texttt{cs126}.
258
+
\bfseries B2: \normalfont
259
+
To help organise your work, try creating a \texttt{modules} directory.
260
+
You might also want to add sub-directories within it for the ones you're going to take, such as \texttt{cs118} and \texttt{cs126}.
247
261
248
-
\bfseries B3: \normalfont Your web page works, but it might be a bit... lacking? Try using another editor, such as Visual Studio Code (\texttt{code} in the terminal) to improve it. Feel free to open up a web browser and look up some HTML tags ...or even ask the people around you?
262
+
\bfseries B3: \normalfont
263
+
Your web page works, but it might be a bit... lacking?
264
+
Try using another editor, such as Visual Studio Code (\texttt{code} in the terminal) to improve it.
265
+
Feel free to open up a web browser and look up some HTML tags ...or even ask the people around you?
0 commit comments