COMS 6500 Notes. Ashlin Harris. 30 August MT vs. Alabama A&M this Saturday (3 September)

Similar documents
COMS 6100 Class note

COMS 6100 Class Notes 3

L A TEX for Psychological Researchers

An Interactive Introduction to L A TEX

Intro to LATEX I. Aaron Erlich POLS/CSSS 510, Why LATEX? Programming Document Structure Floats Tables Lists Math

Introduction to UNIX command-line

An Interactive Introduction to L A TEX. Part 1: The Basics. John Lees-Miller. writel A TEX

Become a L A TEX Guru

Essential Linux Shell Commands

DATA 301 Introduction to Data Analytics Command Line. Dr. Ramon Lawrence University of British Columbia Okanagan

Why learn the Command Line? The command line is the text interface to the computer. DATA 301 Introduction to Data Analytics Command Line

L A TEX Tutorial. 1 Introduction. 2 Running L A TEX. J. E. Rice. May 2010

Introduction to LaTeX. Paul Fodor Stony Brook University

Lab Working with Linux Command Line

CSE 303 Lecture 2. Introduction to bash shell. read Linux Pocket Guide pp , 58-59, 60, 65-70, 71-72, 77-80

Practical Session 0 Introduction to Linux

Chapter 4. Unix Tutorial. Unix Shell

COMP496/901: Academic Presentation and Writing Skills Using LaTeX

L A TEX. COMPSCI 111 / 111G Mastering Cyberspace: An introduction to practical computing. LaTeX. Development. Why?

LaTeX A Tutorial. Mohsen Alimomeni, 2010

Introduction to Linux

Math 235: Introduction to LaTeX

Latex Tutorial 1 L A TEX. 1.1 Text

L A TEX examples. a b c a b c b b a c b c c b a. This table was typeset with the following commands.

This lab exercise is to be submitted at the end of the lab session! passwd [That is the command to change your current password to a new one]

Introduction. File System. Note. Achtung!

An introduction to L A TEX for students

Shell Programming Overview

Intro to Linux. this will open up a new terminal window for you is super convenient on the computers in the lab

Introduction to UNIX. Logging in. Basic System Architecture 10/7/10. most systems have graphical login on Linux machines

An Interactive Introduction to L A TEX. Part 2: Structured Documents & More. Dr John D. Lees-Miller. writel A TEX.

Connecting to ICS Server, Shell, Vim CS238P Operating Systems fall 18

Std: XI CHAPTER-3 LINUX

Using UNIX. -rwxr--r-- 1 root sys Sep 5 14:15 good_program

L A TEX for Psychological Researchers

Using LaTex and BibTex to Write Academic Documents. Ligang He Department of Computer Science University of Warwick

Getting started with Latex

Assessments for CS students:

5/8/2012. Creating and Changing Directories Chapter 7

Introduction to UNIX command-line II

Introduction to the Linux Command Line

A Brief Introduction to the Linux Shell for Data Science

Introduction to LAT E X

Carnegie Mellon. Linux Boot Camp. Jack, Matthew, Nishad, Stanley 6 Sep 2016

Introduzione a LaTex. Fabrizio Messina

Introduction to Unix: Fundamental Commands

Linux File System and Basic Commands

Introduction to LAT E X

Linux Shell Script. J. K. Mandal

Advanced Linux Commands & Shell Scripting

Appendix B WORKSHOP. SYS-ED/ Computer Education Techniques, Inc.

Introduction: What is Unix?

Introduction to the UNIX command line

2) clear :- It clears the terminal screen. Syntax :- clear

When talking about how to launch commands and other things that is to be typed into the terminal, the following syntax is used:

Examples: Directory pathname: File pathname: /home/username/ics124/assignments/ /home/username/ops224/assignments/assn1.txt

Computer Systems and Architecture

Getting your department account

Unix/Linux Basics. Cpt S 223, Fall 2007 Copyright: Washington State University

Learning L A TEX. Patrick Lam

Getting Started with L A TEX

Files

Files and Directories

Introduction to L A TEX

PHYS-4007/5007: Computational Physics

Reading and manipulating files

Helen Cameron. A Brief Overview of LATEX

An Introduction to L A TEX

Outline. Structure of a UNIX command

Chapter-3. Introduction to Unix: Fundamental Commands

Introduction to Linux Part 1. Anita Orendt and Wim Cardoen Center for High Performance Computing 24 May 2017

Introduction to L A TEX

Helen Cameron. A Brief Overview of LATEX

History. Terminology. Opening a Terminal. Introduction to the Unix command line GNOME

What is LaTeX. Is a document markup language and document preparation system for the TeX typesetting program

CENG 334 Computer Networks. Laboratory I Linux Tutorial

CS CS Tutorial 2 2 Winter 2018

LAB #5 Intro to Linux and Python on ENGR

Computer Systems and Architecture

Physics REU Unix Tutorial

PDS Lab Section 16 Autumn Tutorial 1. Unix Commands pwd The pwd command displays the full pathname of the current directory.

CS 307: UNIX PROGRAMMING ENVIRONMENT KATAS FOR EXAM 1

Introduction to Supercomputing

David Helmbold, October 2005, Revised October 2007

What is T E X? T E X and L A T E X Document preparation tools. Setting and casting type. What Knuth was setting. Setting and casting type

Scripting Languages Course 1. Diana Trandabăț

First of all, these notes will cover only a small subset of the available commands and utilities, and will cover most of those in a shallow fashion.

Linux Command Line Primer. By: Scott Marshall

Table Of Contents. 1. Zoo Information a. Logging in b. Transferring files 2. Unix Basics 3. Homework Commands

L A TEX minicourse. dstowell, mag, sar, scannell,... September Typeset by FoilTEX

Programming Studio #1 ECE 190

Command Line Interface The basics

The Command Line. Matthew Bender. September 10, CMSC Command Line Workshop. Matthew Bender (2015) The Command Line September 10, / 25

Lab 1: Introduction to C, ASCII ART & the Linux Command Line

Table of contents. Our goal. Notes. Notes. Notes. Summer June 29, Our goal is to see how we can use Unix as a tool for developing programs

Basic Linux (Bash) Commands

User Guide Version 2.0

L A T E X Workshop. Bijulal D & Anu Thomas Industrial Engineering and Operations Research Indian Institute of Technology

Getting Started with L A T E X for a Technical Document or Thesis

Week 2 Lecture 3. Unix

Transcription:

COMS 6500 Notes Ashlin Harris 30 August 2016 1 General Remarks MT vs. Alabama A&M this Saturday (3 September) If you experienced problems connecting to https://www.cs.mtsu.edu/ on Monday, this may have been due to an outdated certificate. The CS Department has updated the certificate, so this issue should be resolved. 2 Course Reading: Code Complete 2.1 Quiz 1. What is code construction? metaphor that expresses an abstract, unfamiliar concept (coding) in terms of a concrete, familiar one (construction) puts emphasis on coding and debugging, less emphasis on planning and unit testing, and very little emphasis on architecture and maintenance aguably, a better metaphor for coding than letter writing, farming, etc. 2. What software metaphor did you like the best? The class preferred the construction metaphor. Letter writing may be a poor metaphor, since it is not uncommon to throw away manuscripts and start again. This is not (purposefully) common with software coding. Important work ought to be backed up off-site. This way, a disaster that would ruin the working copy and on-site backups will not destroy the project. If this advice ever helps you, credit goes to Dr. Hyrum Carroll. 1

3 L A TEX 3.1 General Remarks To compile L A TEX files, pdflatex is recommended. This may have to be repeated, as some L A TEX operations require an additional pass. For important documents, go ahead and compile a third time. Output can also be generated using latex example.tex; dvips example.dvi, but unless your department or publisher requires a.dvi or.ps file, it is best not to bother. The tilde ( ) is a special character in L A TEX. It designates a space that should not be enlarged or broken between lines. It can be reproduced in L A TEX using \textasciitilde ( ) or even $\sim$ ( ). \~ is typically not intended. Good examples of usage include $\sim$hcarroll for hcarroll and Dr.~Carroll for Dr. Carroll. All L A TEX examples and other files shown in class are publicly available on the course website, https://www.cs.mtsu.edu/~hcarroll/6100/calendar.html. For files on Dr. Carroll s website, you are encouraged to modify the ends of the URLs and search the parent directories for useful files. Dr. Carroll used a similar technique when considering the purchase of a salvaged car. The merchant only gave him web links to a select few pictures of the car before it was refurbished, but by altering the number in the URL, he was able to find about a dozen more. If a link is broken, feel free to snoop around in search of the correct file. 3.2 Review The preamble (section between \documentclass{... } and \begin{document} may contain \title{... }, \author{... }, \date{... }, etc. Depending on the document class, these are displayed when \maketitle is invoked. Package calls are also found here. 3.3 Simple Structures With L A TEX, lists can be constructed easily, and \items can be inserted effortlessly. Two types of lists (itemize and enumerate) are shown below. The following example is available at https://www.cs.mtsu.edu/~hcarroll/6100/ lectures/latex/simplestructures.tex. 2

.tex input \documentclass{article} \begin{document} Itemized list: \begin{itemize} \item Item one \item Item two \end{itemize} Enumerated list: \begin{enumerate} \item Item one \item Item two \end{enumerate} Itemized list: Item one Item two Enumerated list: 1. Item one 2. Item two \end{document} Since numbers are not explicitly specified, a list of type enumerate will be renumbered during compilation after an \item is inserted or deleted. No manual renumbering is ever required. 3.4 Centering Text is left delimited by default in L A TEX. Text can be centered as in the following snippet:.tex input Text is left delimited \\ by default in \\ \LaTeX. \begin{center} Text can be centered \\ as in the following\\ snippet: \end{center} Text is left delimited by default in L A TEX. Text can be centered as in the following snippet: 3.5 Verbatim L A TEXwill interpret special symbols and macros unless you tell it not to. This is a common source of confusion for those who are new to L A TEX. If you get a strange error message upon compilation, check for the following characters: # $ % ^ & _ { } ~ \ With one exception, these characters can be escaped by a backslash (e.g., \# for #). Since the sequence \\ is reserved for line breaks, use \textbackslash in- 3

stead. With some macros, whitespace that immediately follows is not displayed; if space is desired, add an empty set of curly braces. Consider the following examples:.tex input Here is the macro for \LaTeX: \\ \verb+\latex+ \\ \verb 2+2 \\ For larger passages, try this format: \begin{verbatim} $4.00, {}, my_file.txt, \\ ~hcarroll, this & that \\ end{verbatim} Here is the macro for L A TEX: \LaTeX 2+2 For larger passages, try this format: $4.00, {}, my_file.txt, \\ ~hcarroll, this & that \\ For individual lines, it is simple to use \verb. Some delimiter character must be provided. Of course, that character must not be present inside the line. For longer passages, it is appropriate to use \begin{verbatim} and \end{verbatim}. 3.6 Equations Arguably, one of the best features of L A TEX is its treatment of mathematical notations. Equations can be expressed easily and professionally. To embed mathematical characters in the text, use $... $. For equations that stand outside the paragraph, use \begin{equation}... end{equation}. Equations of this second type are numbered sequentially and can be referred to using labels. This way, there is never a need to renumber equations and redo references. Take, for instance, the following:.tex input Energy-momentum relation: \begin{equation} E^2=(pc)^2+(m_0c^2)^2 \label{e-m r} \end{equation} where $p$ is momentum. Of course,it follows from \eqref{e-m r} that \begin{equation} E=m_0c^2\text{ when }p=0 \end{equation} Energy-momentum relation: E 2 = (pc) 2 + (m 0 c 2 ) 2 (1) where p is the system s momentum. Of course, it follows from (1) that E = m 0 c 2 when p = 0 (2) 4

3.7 Images Images can be included using \includegraphics[... ]{file}. In the square brackets, options such as height can be assigned. In general, it is better to make the size of figures proportional to \textheight rather than a fixed value. With \begin{figure}... \end{figure} notation, a \caption{... } can be added, as well as a \label{... }. As with equations, figures can be referenced by their labels, avoiding tedious renumbering and potential misreferences. 3.8 Tables Tables in L A TEX are invoked using the following format: \begin{tabular}{[vertical lines and alignment]}... \end{tabular} A vertical bar ( ) designates a vertical line in the table and the justification of text in each cell is to the left (l), the right (r), or the center (c). The ampersand (&) moves to the next cell on the right, and a double backslash (\\) moves to the next row below. Horizontal lines are made using \hline. The following table shows these in action:.tex input \begin{tabular}{ l cc r } \hline $n$ & $n^2$ & $n^3$ & $n^2+n^3$ \\ \hline 0 & 0 & 0 & 0 \\ 1 & 1 & 1 & 2 \\ 2 & 4 & 8 & 12 \\ 3 & 9 & 27 & 36 \\ \vdots & \vdots & \vdots & \vdots \\ 10 & 100 & 1000 & 1100 \\ \vdots & \vdots & \vdots & \vdots \\ 100 & 10000 & 1000000 & 1010000 \\ \hline \end{tabular} n n 2 n 3 n 2 + n 3 0 0 0 0 1 1 1 2 2 4 8 12 3 9 27 36.... 10 100 1000 1100.... 100 10000 1000000 1010000 4 Linux Commands 4.1 Linux Commands I Review man show the manual for a command man man - read manual page for man man ls - read manual page for ls Enter - skip down 1 line in manual page 5

Space - skip down 1 screen in manual page Arrow keys may also be used to navigate the page. q - exit manual page ls l ist directory contents ls - list the contents of the current directory ls -a /bin - list all the contents of /bin ls -lh - display contents in long-listing format with human-readable file sizes cd change d irectory cd, cd - go to home directory cd my dir - go to my dir if it exists in current directory cd.. - go to parent directory, if it exists touch update a timestamp to current machine time cp copy a file mv move a file rm remove a file If the file doesn t exist, a blank file will be made. cp./a/b/this that - copy and rename this into the current directory cp -R./important files./test directory - recursively copy contents of important files into test directory mv good/idea.txt bad - move the file ideas.txt to directory bad, if it exists; otherwise, move the files to the current directory and rename it bad mv today.txt yesterday.txt - rename the file today.txt to yesterday.txt rm old.txt - remove the file old.txt rm -Rf temp dir/ - remove temp dir, Recursively deleting its contents and f orcefully deleting without confirmation rm * - delete all the files in a directory, but only if the user has permission to do so mkdir make a directory mkdir Programs - make a new directory Programs mkdir Programs/1 Programs/2 Programs/3 Programs/Final - make several new directories 6

rmdir remove an empty directory rmdir./coms/testing - remove testing if it is an empty directory rmdir * - remove all empty directories in the current directory 4.2 Linux Commands II Exercise and Review 1. Display the name of the current directory. pwd We will learn how to put this information in the prompt. 2. Display the path of mkdir. which mkdir This command looks through the variable $PATH and returns the first directory that contains mkdir. Tab completion can show if the command is present on your machine. 3. Execute the last command that started with mak.!mak 4. Execute the third to last command used.!-3 Press the Up Arrow three times, then Enter. 5. Print to the screen the contents of all of the.txt files in the current directory. cat *.txt - concatenates the contents of all files in the directory that match the regular expression, sending it all to standard output 6. Display the filename of just the last file from the previous command.!$ 7. View the contents of the file researchideas.txt one screen full at a time. more researchideas.txt less researchideas.txt less is like more, but there are some differences. For instance, less supports backwards scolling, while more does not. As a general rule, less is more. Students should be familiar with all the commands covered in class and be able to use them without resorting to a reference. 7

4.3 Linux Commands III ssh secure shell scp secure copy ssh abc1d@herschel.cs.mtsu.edu - connect to a remote MTSU server using account abc1d scp abc1d@herschel.cs.mtsu.edu:some/remote/directory/file some/local/directory - copy file to the local machine sftp secure-shell transfer f ile protocol du disk usage sftp abc1d@herschel.cs.mtsu.edu - open sftp connection to remote account with interactive prompt?, help - see list of commands for the sftp prompt pwd, cd, ls - same as before, but apply to remote machine lpwd, lcd, lls - local versions of the above commands get remote file.txt - copy remote file.txt to the local machine put local file.txt - copy local file.txt to the remote machine exit - exit the remote connection du - show disk usage for all directories in the current directory du sort -n - same as above, but sorted numerically by size du -h - sams as du, but with human-readable file sizes sort sorts a list alphabetically by line sort names.txt - sort the lines in the file names.txt sort numbers.txt - sort the lines in numbers.txt alphabetically (e.g., 80 comes before 9) sort -n numbers.txt - same as above, but sorted by number uniq uniq does not search the entire file for matching lines. It only detects matches in subsequent lines. For this reason, unsorted input is almost invariably piped from sort first. Alternatively, use sort -u instead of uniq. uniq -c file.txt - count the instances of each line and append the number to the front of the line uniq -d file.txt - print only d uplicate lines uniq -i file.txt - ignore case (e.g., word, Word, word, and WOrD are considered duplicates) 8

echo display input to standard output echo Hello - print Hello to the screen echo $PATH - print the variable $PATH to the screen echo *.txt - print the names of all.txt files in the current directory 9