Skip to content

Commit d945106

Browse files
committed
Added cheatsheet, modified B1
1 parent 229dd14 commit d945106

File tree

4 files changed

+176
-24
lines changed

4 files changed

+176
-24
lines changed

.github/workflows/lab.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@ jobs:
1010
- name: Setup Git repository
1111
uses: actions/checkout@v2
1212

13-
- name: Compile report
13+
- name: Compile Sheets
1414
uses: xu-cheng/latex-action@v2
1515
with:
16-
root_file: lab.tex
16+
root_file: |
17+
lab.tex
18+
cheatsheet.tex
1719
18-
- name: Upload artifact
20+
- name: Upload Artifacts
1921
uses: actions/upload-artifact@v2
2022
with:
2123
name: PDF
22-
path: lab.pdf
24+
path: |
25+
lab.pdf
26+
cheatsheet.pdf

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,3 +286,5 @@ TSWLatexianTemp*
286286
# option is specified. Footnotes are the stored in a file with suffix Notes.bib.
287287
# Uncomment the next line to have this generated file ignored.
288288
#*Notes.bib
289+
290+
*.pdf

cheatsheet.tex

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
\documentclass[a4paper,11pt,parskip=half-]{scrartcl}
2+
3+
% Packages
4+
5+
\usepackage[english]{babel}
6+
\usepackage{array}
7+
\usepackage{amsmath}
8+
\usepackage{ascii}
9+
\usepackage[colorlinks=true, allcolors=blue]{hyperref}
10+
\usepackage{graphicx}
11+
\usepackage[a4paper,top=2cm,bottom=2cm,left=2cm,right=2cm,marginparwidth=1.75cm]{geometry}
12+
\usepackage[defaultfam,tabular,lining]{montserrat}
13+
\usepackage[T1]{fontenc}
14+
\usepackage{wrapfig}
15+
16+
17+
\graphicspath{{images/}}
18+
\pagestyle{empty}
19+
\setkomafont{section}{\usefont{T1}{fvs}{b}{n}\Large}
20+
\renewcommand*\oldstylenums[1]{{\fontfamily{Montserrat-TOsF}\selectfont #1}}
21+
\renewcommand{\ttdefault}{pcr}
22+
\renewcommand{\arraystretch}{1.5}
23+
24+
25+
\begin{document}
26+
27+
\begin{wrapfigure}{r}{0.2\textwidth}
28+
\vspace{-10pt} % Move shield in line with text
29+
\includegraphics[width=0.9\linewidth]{shield.png}
30+
\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:
41+
42+
\centering
43+
\begin{tabular}{l|c}
44+
Type & Examples \\
45+
\hline
46+
\large Browsers \normalfont & \texttt{chrome}, \texttt{firefox}, \texttt{konqueror} \\
47+
\large Text Editors \normalfont & \texttt{atom}, \texttt{code}, \texttt{kate}, \texttt{gedit}, \texttt{vim}, \texttt{emacs}, \texttt{nano} \\
48+
\large File Explorers \normalfont & \texttt{dolphin}, \texttt{nautilus} \\
49+
\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
117+
\end{itemize}
118+
119+
\Large \texttt{cp <source file> <target file>} \normalsize \\
120+
Copy files from one location to another
121+
\begin{itemize}
122+
\item \texttt{-r} | Can copy directory contents recursively.
123+
\item \texttt{-n} | Do not overwrite any existing files.
124+
\item \texttt{-u} | Only copy if the source file is newer than the destination file.
125+
\end{itemize}
126+
127+
128+
129+
\end{document}

lab.tex

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,12 @@ \section*{Creation and Deletion}
109109
Removes the specified file or directory.
110110
If non-empty, \bfseries all contents are deleted. \normalfont
111111

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>}.
113114

114115
\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.
116118

117119
\begin{verbatim}
118120
~\
@@ -127,13 +129,11 @@ \section*{Creation and Deletion}
127129

128130
While in the home directory, we create the \texttt{foo} directory and it's \texttt{bar.baz} file:
129131

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}
134134

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.
137137
We can override this behaviour with the \texttt{-p} flag, which creates intermediate directories when required.
138138
From here, try creating \texttt{index.html} and \texttt{app.css} for yourself.
139139

@@ -155,7 +155,8 @@ \section*{Editing Files}
155155
And, just like a programmer's preferred distribution of Linux, it's a large point of contention among us!
156156
For this lab, we'll be using the fairly modern but basic \texttt{atom} text editor.
157157

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.
159160
Here's an example page:
160161

161162
\qquad \texttt{<!DOCTYPE html>} \\
@@ -184,7 +185,10 @@ \section*{Changing Permissions}
184185
-rw-r----- 1 u1234567 dcsugrad 42 Sep 16 19:37 important.txt
185186
\end{verbatim}
186187

187-
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:
188192

189193
\centering
190194
\begin{tabular}{l|l|l}
@@ -214,38 +218,51 @@ \section*{Changing Permissions}
214218

215219
These permissions can be modified using the \texttt{chmod} command.
216220

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:
219223

220224
\qquad \texttt{chmod u=rwx,g=rx,o=r <file path>}
221225

222226
The second way uses an octal digit to represent each permission group:
223227

224228
\qquad \texttt{chmod 754 <file path>}
225229

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. \\
227232
+4 for read, +2 for write, and +1 for execute.
228233

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.
230236

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.
232242

233243
Now, time to see our public web page in all of its underwhelming glory! \\
234244
This concludes the main part of the lab.
235245

236246
\section*{Bonus Tasks}
237247

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.
250+
What do you think they do?
239251

240252
\begin{enumerate}
241-
\item \large \texttt{cd .} \normalsize
242-
\item \large \texttt{ls -a} \normalsize
253+
\item \large \texttt{cd --} \normalsize
254+
\item \large \texttt{ls -lat > output.txt} \normalsize
243255
\item \large \texttt{grep p index.html} \normalsize
244256
\end{enumerate}
245257

246-
\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}.
247261

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?
249266

250267
\section*{What next?}
251268

0 commit comments

Comments
 (0)