• No results found

Essential Linux and HTML! Computer Science for Bioinformatics, ! F. Pineda

N/A
N/A
Protected

Academic year: 2021

Share "Essential Linux and HTML! Computer Science for Bioinformatics, ! F. Pineda"

Copied!
31
0
0

Loading.... (view fulltext now)

Full text

(1)

Essential Linux and HTML

!

Computer Science for Bioinformatics, 140.636!

(2)

Unix Historical background

n  Unix originally developed in late 60’s-70 at AT&T

Sources released to Universities where Unix caught on in CS departments. Notably UC Berkeley (BSD Unix)

n  Linux (open source Unix) originally developed by Linus Torvalds

(Finland) and released under a GNU (free software) license ~1992.

n  A host of fellow geeks found it cool and started to to help in the

development.

n  Now a major operating system that is “free” as in “speech” & as in “beer”.

http://stein.cshl.org/genome_informatics/unix1/

(3)

Essential unix concepts

The file system

Devices e.g. Keyboard, printer screen, ethernet, mouse, etc. unix Kernel Shell

(accepts typed commands)

GUI

accepts point & click commands

Processes

e.g. editors, word processors,

spreadsheets, scripts, etc.

(4)

/

boot

bin dev etc home2 lib mnt opt proc root sbin tmp usr var vmlinux

140.636F08 faculty stu08-01 stu08-02 stu08-00 Stu08-03 bin local fernando private_html public_html home public example.txt

The hierarchical file system

The file system is a tree

(5)

Navigating the hierarchical file system

1.  Navigation commands

n  ls -- list directory contents

n  pwd -- prints the absolute path to the working directory

n  cd -- change directory to a directory specified by a path

n  df -- free disk space

n  du -- disk usage statistics

2.  Paths

n  Absolute path

n  A fully qualified path must be specified from the root directory

n  / is the symbol for the root directory

n  Relative path

n  Always defined relative to the current working directory

n  . is the symbol that means the working directory

n  .. is the symbol that means the directory above the working directory

n  Executing an executable that resides in the current working directory

(6)

Review: commands to get around the file system

n  pwd the command that tells you where

you are, i.e. print working directory

n  ls the command that lists the contents !

of the current directory

n  cd the command that changes the !

current directory. In other words !

it is how you move around the !

file system

Critical to memorize these three navigation commands!

(7)

Files permissions

n  to see what permissions a file has use ls

command with -l option:

n  ls -l filename

n  to change file permissions use the chmod

command (see linux quickstart notes)

read write execute user

read write execute group

read write execute other

filetype

(8)

simple commands

n  Command Syntax: command [options] parameters!

n  Options

n  An option is a way of telling Linux to perform a command in a particular way (like pressing alt-key while clicking a mouse)

n  Typically a minus sign followed by one or more characters and sometimes an argument!

n  Parameters

(9)

some example commands

wc hello1.sh

wc -l hellol.sh

wc -l *.sh

ls *.txt

Note the use of wildcards for simple filename patterns ? matches any single character

(10)

On-line help for commands

n 

man

command

n 

command

-help

(11)

Essential unix concepts

1. A process

Everything that “runs under unix is a process, e.g. commands, spreadsheets,

terminal windows, etc.

Relevant commands: ps, top

2. A file & the hierarchical file system

directories(folders), data files, applications. On the disk, everything is a file. Even directories! Files are not processes!

Relevant commands: ls, df

3. A shell

A shell is a process. The shell accepts command lines and feeds them to the unix kernel. Command lines consist of commands or programs to execute along with information needed to execute them

4.  Standard input/output

All processes have a standard input and a standard output

1.  redirection 2.  pipes

(12)

Processes

What processes am I running from my shells?!

ps

Which processes are using the most cpu?!

top

What are all processes running on the system?!

ps -A

What are all process that I am running?!

(13)

Standard input & output

two very important operating system concepts that you absolutely must understand

(14)

Standard I/O

n  Commands are processes, so they have a default standard input and

a default standard output !

!

!

!

n  For commands executed in shell window:

n  standard input is connected to the keyboard

n  standard output is connected to the screen

process

standard input standard output

shell process

STDIN STDOUT

(15)

When you invoke the Perl interpreter it is a process!

perl process

STDIN STDOUT

(16)

Redirection and pipes

two very important and related ideas that you absolutely must understand

(17)

Standard i/o streams can be

Redirected

n  The standard output of a command can be redirected to

a file by the “> redirector

ls process STDIN Storage device STDOUT graphics device ls -l results.txt STDOUT file ls -l > results.txt

(18)

Standard i/o streams can be

Redirected

n  a file can be redirected to the standard input of a command by the

<redirector. wc process STDOUT graphics device STDIN results.txt file wc -l < results.txt Keyboard device STDIN wc -l

(19)

a pipeline of processes

process1

file1.txt

STDOUT STDIN process2

file2.txt

(20)

a

pipeline

of processes

!

(

without the intermediate files)

(21)

Pipes

The standard output stream of one command can be piped to the standard input of another command by using the

pipe “|” symbol. No intermediate file is required.

Example: What does this do?

ls -l | wc -l

(22)

BASH

n  BASH(Bourne Again SHell) is a Unix shell and

command language

n  The syntax of the command language is: n  <command> <options> <arguments>

n  <command> is either a built-in command

(already in RAM) or the name of an executable file.

n  An executable file is either a executable binary or

a text file (known as a script) that is interpreted by an interpreter (which could be BASH).

(23)

BASH

!

variables

n  By convention environment variables are always

capitalized but in general variables needn’t be

n  To see values of all environment variables use the

env command without an argument

n  Values are set with ‘=‘ (no spaces)

n  Values are instantiated with ‘$’

n  Example:

MYVAR=“foo” echo $FOO

(24)

How the shell executes commands and applications

1.  Search for a command

1.  Is the command a built-in?

2.  Is the command a file in the current working directory?

3.  Is the command a file in one of the paths specified by the

PATH environment variable (demo)

2.  Execute the first executable file that is found

3.  The file must have “execute permission in order to be

executed, otherwise you will see a “permission error”

4.  An executable file is either an application binary or a

(25)

n  First line starts with ‘#!’ and tells bash where to

find the interpreter

n  Remaining lines are statements in the language

that the interpreter understands

n  Script must have execute permissions

Executable text files (scripts)

#!<absolute path to an interpreter> statements in interpreted language...

.

chmod u+x <script_name>

(26)

3 examples

echo “hello world!” #!/usr/bin/env perl

print “hello world!\n”;

#!/usr/bin/env python print (“hello world!”)

hello.sh hello.pl hello.py

env -- set environment and execute command, or print environment

(27)

How the shell executes a script

1.  If the executable is a text file, the shell treats it as a

script. A script must have a special first line

1.  The first line must start with #!, the rest of the first line is the

path to an executable interpreter 2.  The interpreter is launched

3.  The script file itself is passed to the standard input (STDIN)

of the the executing interpreter.

4.  The interpreter skips over the first line because it starts with a

(28)

HTML (very) quickstart

Just enough HTML to get started on your homework. Goal of the first assignment: to be able to turn in the

(29)

Global structure of an HTML

Document

1. HTML version information 2. Header

3. Body

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN

"http://www.w3.org/TR/html4/loose.dtd"> <HTML>

<HEAD>

<TITLE>My first HTML document</TITLE> </HEAD>

<BODY>

<P>Hello world!</P> </BODY>

(30)

Rudimentary HTML Syntax

and Rules

n  Elements

n  Tags come in pairs and describe content, e.g. <p>…</p>


<table>…</table>!

<img href=jhsphlogo.jpg> </img>

n  Attributes

n  parameters in tags that alter the behavior of the corresponding elements

n  Example html file:

(31)

URLs

n  Universal Resource Locators

n  <protocol>//<path>

http://www.cnn.com https://www.mtb.com

file:///users/sph140636/shared/homework1/index.html n  To view homework template

n  ssh into the cluster

n  start firefox

References

Related documents

EARLY CHILDHOOD EDUCATION SCHOOL OF EDUCATION STEVENS POINT, WI 54481 OLUYOMI OGUNNAIKE ASSISTANT PROFESSOR (715) 346-4742 UNIVERSITY OF WISCONSIN ECE PROGRAM 4-YEAR ECE

According to the CEN/CENELEC Internal Regulations, the national standards organizations of the following countries are bound to implement this European Standard: Austria,

For this purpose in this contribution a methodology for the pattern-based development and realization of business models in the context of Cyber-Physical Production Systems is

SWITCH ROOM FEMALE WC SHOWER FEMALE WC DIS’ WC MALE WC LIFT RECEPTION SHOWER CLEANER’S N OFFICE Ground Floor CLEANERS MEZZANINE.. OFFICE

Use this endorsement to provide workers compensation insurance and employers liability insurance for work on the Outer Continental Shelf subject to the Longshore and Harbor

WC Cross channel Precision Marketing Engine WC Triggers Result Ranking Landing page Faceted Navigation Product Recommend Business rules drive Search results 2 WC Search

The remainder of this paper is organised as follows: Section II discusses previous work, and Section III describes the operation of the LU benchmark and the CUDA programming model;

impairment or disability due to an injury arises .&#34; Thus, the court found no error in the ALJ's decision to award permanent income benefits from the date that the claimant