Import historic posters from /users/posters on caffeine.
[mspang/posters-archive.git] / handouts / unix2.tex.orig
1 \documentstyle[fullpage,twoside]{article} 
2 \input psfig
3 %% great for xdvi: \psdraft
4 \begin{document}
5 %% \magstep5   %% A TeX command.  Use pslatex, dvipost and ghostview to preview
6 \pagestyle{empty}
7 \begin{center}
8 \newcounter{tutorialnum}
9 \setcounter{tutorialnum}{2}
10 {\Huge Unix \Roman{tutorialnum} Reference Sheet}
11 \vspace{.2in}
12 \end{center}
13 \section{Commands}
14 \begin{description}
15     \item[\texttt{ls -F}:] gives the file type (`/' for directories,
16     `*' for executable files, `@' for symbolic links).  
17     \item[\texttt{ls-F}:] is a tcsh built-in command, which gives the same output
18     as above.
19     \item[\texttt{ls -a}:] lists all files including files beginning with a dot.
20     \item[\texttt{ls -A}:] lists all files as above except for the directories
21     . and .. (representing your current and parent directories).
22     \item[\texttt{ls -s}:] lists files with size in kilobytes.
23     \item[\texttt{ls -C}:] gives output in columns.
24     \item[\texttt{ls -R}:] recursively enters directories, and lists all
25     the files found within.
26     \item[\texttt{ls -FRACs}:] shows the size of all the files in this
27         directory and all sub-directories.
28     \item[\texttt{du}:] shows the size of all directories from here down.
29     \item[\texttt{ps}:] shows your processes.
30     \item[\texttt{ps -x}:] show all the processes executing on this
31         machine.
32     \item[\texttt{ps -aux}:] show everyone's processes on this machine.
33     \item[\texttt{kill \itshape{process}}:] sends a signal to a process (ending
34         it).
35     \item[\texttt{ruptime}:] show uptime statistics on all local machines.
36     \item[\texttt{rwho}:] shows everyone who is logged on.
37     \item[\texttt{rlogin \itshape{machinename}}:] log into a computer.
38     \item[\texttt{finger \itshape{user}\textrm{@}\itshape{machine}}:] find out
39     information about a user (also \texttt{f}).
40     \item[\texttt{finger \textrm{@}\itshape{machine}}:] find out about all users
41         on a given machine.
42     \item[\texttt{finger \itshape{user}}:] find out about a user on
43         the local machine.
44     \item[\texttt{users}:] short list of all users on the local machine
45         (also \texttt{u})
46     \item[\texttt{find . -name "\itshape{pattern}" -print}:] search for
47         a filename containing the \texttt{\itshape{pattern}} in this
48         directory, and all subdirectories.
49     \item[\texttt{rm \itshape{filename}}:] remove the file named
50         \texttt{\itshape{filename}}.
51     \item[\texttt{cut -f\# -d\itshape{c}}:] cut out column \texttt{\#} using
52         \texttt{\itshape{c}} as a delimiter.
53     \item[\texttt{grep \itshape{pattern files}}:] look through
54         \texttt{\itshape{files}} for \texttt{\itshape{pattern}}.
55     \item[\texttt{tail}:] list the end of a file.
56     \item[\texttt{head}:] show the first few lines of a file.
57     \item[\texttt{clear}:] clears the screen.
58     \item[\texttt{expand}:] expands the tabs in your input.
59     \item[\texttt{ping \itshape{machine}}:] figures out if
60         \texttt{\itshape{machine}} is connected to your machine.
61     \item[\texttt{ping -s machine}:] measures how fast the link is to
62         \texttt{\itshape{machine}}.
63     \item[\texttt{man \itshape{command}}:] looks for a manual page.
64     \item[\texttt{man -k \itshape{keyword}}:] searchs for commands which
65         relate to \texttt{\itshape{keyword}} (also \texttt{apropos}).
66     \item[\texttt{top}:] list continuously the top CPU users (q to quit).
67     \item[\texttt{more}:] list a file, search through a file, even start
68         editing a file.
69     \item[\texttt{ls -l \itshape{file}}:] list permissions, date size and
70         other info about a file.
71     \item[\texttt{chmod a+r \itshape{file}}:] allow everyone to read the file
72         file (same as ugo+r).
73     \item[\texttt{chmod o-r \itshape{file}}:] don't allow others to read file.
74     \item[\texttt{chmod u+x \itshape{file}}:] allow the user to execute a file
75         (useful for scripts).
76     \item[\texttt{wc \itshape{file}}:] count the number of lines, words and
77         characters in a file or files.
78     \item[\texttt{cat \itshape{file}}:] print the contents of a file to your
79         screen (or add files together).
80     \item[\texttt{exit}:] logout.
81 \end{description}
82
83 \section{Shell Features}
84 \begin{description}
85     \item[\texttt{history}:] list commands you've used recently.
86     \item[\texttt{jobs}:] list commands you have started.
87     \item[\texttt{kill \%\%}:] kill the most recent command.
88     \item[\texttt{kill \%$\#$}:] kill job $\#$.
89     \item[\texttt{set}:] display your environment variables.
90     \item[\texttt{set \itshape{name}=\itshape{value}}:] set the variable
91     \texttt{\itshape{name}} to the value \texttt{\itshape{value}}.
92     \item[\texttt{setenv}:] display your environment variables (also env).
93     \item[\texttt{setenv \itshape{NAME VALUE}}:] set the variable
94     \texttt{\itshape{NAME}} to \texttt{\itshape{VALUE}}.
95     \item[\texttt{foreach name ( \itshape{pattern} )}:] set \texttt{name} to
96         values in \texttt{\itshape{pattern}}, and do each command until end.
97     \item[\texttt{$\hat{ }$ Z}:] stop a job.
98     \item[\texttt{$\hat{ }$ C}:] send a kill signal to the foreground process.
99     \item[\texttt{$\hat{ }$ D}:] end of file.
100     \item[\texttt{$\hat{ }$ $\backslash$}:] send abort signal to the
101         foreground process.
102     \item[\texttt{fg \%$\#$}:] boring job $\#$ to the foreground.
103     \item[\texttt{\itshape{command} \&}:] run the command
104     \texttt{\itshape{command}} in the background.
105     \item[\texttt{bg \%$\#$}:] restart a stopped job $\#$ in the background.
106     \item[\texttt{nice -$\#$ \itshape{command}}:] start
107         \texttt{\itshape{command}} with a lowered priority.
108     \item[\texttt{source \itshape{script}}:] execute a script called
109         \texttt{\itshape{script}}.
110     \item[\texttt{echo \itshape{whatever}}:] prints \texttt{\itshape{whatever}}.
111     \item[\texttt{`\itshape{command}`}:] insert the output of
112         \texttt{\itshape{command}} into your command.
113 \end{description}
114
115 \section{Shell Pipes and other routes}
116 \begin{description}
117     \item[\texttt{\itshape{command1} \upshape{|} \itshape{command2}}:] pipes
118     the output of \texttt{\itshape{command1}} to the input of
119         \texttt{\itshape{command}}.
120     \\I.e.~\texttt{finger~jarnott\textrm{@}calum~|~head}.
121     \item[\texttt{\itshape{command} \upshape{>} \itshape{file}}:] take
122         \texttt{\itshape{command}}'s output and put it into the file
123         \texttt{\itshape{file}}.
124     \item[\texttt{\itshape{command} \upshape{<} \itshape{file}}:] get
125         \texttt{\itshape{command}}'s input from the file \texttt{\itshape{file}}.
126     \item[\texttt{\itshape{command} \upshape{>>} \itshape{file}}:] append
127         \texttt{\itshape{command}}'s output to the file \texttt{\itshape{file}}.
128     \item[\texttt{\itshape{command} \upshape{>\&} \itshape{file}}:] redirect
129         output and error output from \texttt{\itshape{command}} to
130         \texttt{\itshape{file}}.
131     \item[\texttt{\itshape{command1} \upshape{|\&} \itshape{command2}}:]
132         redirect standard output and standard error from
133         \texttt{\itshape{command1}} to \texttt{\itshape{command2}}.
134 \end{description}
135
136 \vspace{.2in}
137 \begin{center}
138 {\LARGE MC 3036/3037}
139 \vspace{.4in}
140
141 \psfig{figure=csclogo.ps,height=2in}
142 \end{center}
143 \end{document}