Unix. 1 tblgrant projects 0 Jun 17 15:40 doc1.txt. documents]$ touch doc2.txt documents]$ ls -l total 0

Similar documents
You should see something like this, called the prompt :

Exploring UNIX: Session 3

PHP. Downloading PHP. Uncompressing PHP. Unarchiving PHP

Unix background. COMP9021, Session 2, Using the Terminal application, open an x-term window. You type your commands in an x-term window.

Introduction to Unix: Fundamental Commands

Chapter-3. Introduction to Unix: Fundamental Commands

Introduction to Linux

Basic Unix Commands. CGS 3460, Lecture 6 Jan 23, 2006 Zhen Yang

Lab 1 Introduction to UNIX and C

Linux Essentials. Programming and Data Structures Lab M Tech CS First Year, First Semester

CSC209. Software Tools and Systems Programming.

CISC 220 fall 2011, set 1: Linux basics

Quick Start Guide. by Burak Himmetoglu. Supercomputing Consultant. Enterprise Technology Services & Center for Scientific Computing

Introduction to the Linux Command Line

CakePHP. Getting ready. Downloading CakePHP. Now that you have PHP installed let s create a place in htdocs for your CakePHP development:

Working with Basic Linux. Daniel Balagué

Week 2 Lecture 3. Unix

Introduction to Unix. University of Massachusetts Medical School. October, 2014

The Unix Shell. Permissions

Introduction to UNIX I: Command Line 1 / 21

Exercise Sheet 2. (Classifications of Operating Systems)

Introduction to Linux Workshop 1

Mills HPC Tutorial Series. Linux Basics I

CHAPTER 1 UNIX FOR NONPROGRAMMERS

Introduction to remote command line Linux. Research Computing Team University of Birmingham

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.

SECTION -C. Getting Started with UNIX

Introduction: What is Unix?

CS 460 Linux Tutorial

acmteam/unix.pdf How to manage your account (user ID, password, shell); How to compile C, C++, and Java programs;

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.

Refresher workshop in programming for polytechnic graduates General Java Program Compilation Guide

Pivotal Capgemini Just Do It Training HDFS-NFS Gateway Labs

CS : Computer Programming, Spring 2000 Programming Project #1: Thinking of a Number Due in class Thursday 27 January 2000

commandname flags arguments

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

Common UNIX Commands. Unix. User Interfaces. Unix Commands Winter COMP 1270 Computer Usage II 9-1. Using UNIX. Unix has a command line interface

CS246 Spring14 Programming Paradigm Notes on Linux

Introduction to Lab Practicals (Lab Intro 3) Access Control, Synchronisation and Remote Access

Files

EE516: Embedded Software Project 1. Setting Up Environment for Projects

-1- csh cd. cd alias!! ; set prompt=" pwd % " 16 cd. 17 cd.. 18 his /home% set prompt. alias. yasuoka : root :

Essential Linux Shell Commands

Unix Basics. Systems Programming Concepts

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

Introduction. File System. Note. Achtung!

Introduction to Linux for BlueBEAR. January

CENG 334 Computer Networks. Laboratory I Linux Tutorial

Introduction in Unix. Linus Torvalds Ken Thompson & Dennis Ritchie

Getting started with Hugs on Linux

Lab Working with Linux Command Line

Unix File System. Class Meeting 2. * Notes adapted by Joy Mukherjee from previous work by other members of the CS faculty at Virginia Tech

Unix Essentials. BaRC Hot Topics Bioinformatics and Research Computing Whitehead Institute October 12 th

Hitchhiker s Guide to VLSI Design with Cadence & Synopsys

Basics. proper programmers write commands

Introduction to the UNIX command line

CSC209. Software Tools and Systems Programming.

: the User (owner) for this file (your cruzid, when you do it) Position: directory flag. read Group.

CSCI 2132 Software Development. Lecture 4: Files and Directories

Introduction to UNIX command-line II

1. What statistic did the wc -l command show? (do man wc to get the answer) A. The number of bytes B. The number of lines C. The number of words

Unix/Linux Operating System. Introduction to Computational Statistics STAT 598G, Fall 2011

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

CSCI 161: Introduction to Programming I Lab 1b: Hello, World (Eclipse, Java)

Introduction Into Linux Lecture 1 Johannes Werner WS 2017

The Linux Command Line & Shell Scripting

Introduction to UNIX command-line

LING 408/508: Computational Techniques for Linguists. Lecture 5

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

DAVE LIDDAMENT INTRODUCTION TO BASH

UNIX File Hierarchy: Structure and Commands

A Big Step. Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers

CSc33200: Operating Systems, CS-CCNY, Fall 2003 Jinzhong Niu September 26, Nachos Overview

Exercise 1: Basic Tools

1 General Guidelines To the Instructor To the Student... 2

Basic Survival UNIX.

Hands-on Keyboard: Cyber Experiments for Strategists and Policy Makers

Quick Start Guide. by Burak Himmetoglu. Supercomputing Consultant. Enterprise Technology Services & Center for Scientific Computing

CS Fundamentals of Programming II Fall Very Basic UNIX

Introduction to Linux. Roman Cheplyaka

FREEENGINEER.ORG. 1 of 6 11/5/15 8:31 PM. Learn UNIX in 10 minutes. Version 1.3. Preface

Check the entries in the home directory again with an ls command and then change to the java directory:

Introduction to Lab Practicals (Lab Intro 3) Access Control, Synchronisation and Remote Access

INd_rasN SOME SHELL SCRIPTING PROGRAMS. 1. Write a shell script to check whether the name passed as first argument is the name of a file or directory.

Unix L555. Dept. of Linguistics, Indiana University Fall Unix. Unix. Directories. Files. Useful Commands. Permissions. tar.

Introduction to Unix - Lab Exercise 0

Scripting. Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers

Introduction to Linux

Unix basics exercise MBV-INFX410

Getting started with Hugs on Linux

ACS Unix (Winter Term, ) Page 92

Linux Operating System Environment Computadors Grau en Ciència i Enginyeria de Dades Q2

Computer Systems and Architecture

Basic UNIX commands. HORT Lab 2 Instructor: Kranthi Varala

Unix Filesystem. January 26 th, 2004 Class Meeting 2

genome[phd14]:/home/people/phd14/alignment >

Unix Tools / Command Line

Introduction to UNIX Command Line

UNIX Quick Reference

Linux File System and Basic Commands

Transcription:

Unix Each one of you will get an account on silo.cs.indiana.edu where you will do most of your work. You will need to become familiar with the Unix environment (file system and a number of Unix commands) on silo. We will guide you through an exercise below. We start by identifying where we are. We then check that we don t already have a folder named lab1 and create it. We move inside it, and create a folder named experiments inside. Move inside experiments and create two more folders there, next to each other. Call them documents and programs. Move inside the first and create two empty files with the names doc1.txt and doc2.txt. Next open the doc1.txt file and write your name in it or something that identifies you. Then open the second one and write something that we don t know about you, like I did below: [tblgrant@silo ~]$ pwd /u/tblgrant [tblgrant@silo ~]$ ls -ld lab1 ls: cannot access lab1: No such file or directory [tblgrant@silo ~]$ mkdir lab1 [tblgrant@silo ~]$ cd lab1 [tblgrant@silo lab1]$ mkdir experiments [tblgrant@silo lab1]$ cd experiments/ [tblgrant@silo experiments]$ mkdir documents [tblgrant@silo experiments]$ mkdir programs [tblgrant@silo experiments]$ ls -l drwx------ 2 tblgrant projects 4096 Jun 17 15:40 documents drwx------ 2 tblgrant projects 4096 Jun 17 15:40 programs [tblgrant@silo experiments]$ cd documents [tblgrant@silo documents]$ ls [tblgrant@silo documents]$ touch doc1.txt total 0 -rw------- [tblgrant@silo documents]$ touch doc2.txt total 0 -rw------- 1 tblgrant projects 0 Jun 17 15:40 doc1.txt 1 tblgrant projects 0 Jun 17 15:40 doc1.txt 1

2 -rw------- 1 tblgrant projects 0 Jun 17 15:40 doc2.txt [tblgrant@silo documents]$ pico -w doc1.txt -rw------- 1 tblgrant projects 26 Jun 17 15:40 doc1.txt -rw------- 1 tblgrant projects 0 Jun 17 15:40 doc2.txt [tblgrant@silo documents]$ cat doc1.txt [tblgrant@silo documents]$ pico -w doc2.txt -rw------- 1 tblgrant projects 26 Jun 17 15:40 doc1.txt -rw------- 1 tblgrant projects 85 Jun 17 15:42 doc2.txt There s a book by Moore and Mertens, "Tha Nature of Computation, that I like a lot. [tblgrant@silo documents]$ pico -w doc2.txt d doc2.txt -rw------- 1 tblgrant projects 94 Jun 17 15:43 doc2.txt There s a book by Moore and Mertens, entitled "The Nature of Computation" that I really like a lot. [tblgrant@silo documents]$ cat doc1.txt [tblgrant@silo documents]$ pwd /u/tblgrant/lab1/experiments/documents Now that you have your.txt files go to programs and create three folders. Name them perl, python and Java. Go into Java and write your first Java program using the code we provide below. Compile and run it with javac 1 and java 2. Notice that these commands are available without any additional setting. On the PCs in the STC labs we may need to set the PATH environment variable. We will need to set the PATH environment variable (and a few other environment variables) on the Unix account too, but not for compiling and running a Java program. [tblgrant@silo documents]$ pwd /u/tblgrant/lab1/experiments/documents [tblgrant@silo documents]$ cd.. [tblgrant@silo experiments]$ ls documents programs [tblgrant@silo experiments]$ cd programs/ [tblgrant@silo programs]$ mkdir python [tblgrant@silo programs]$ mkdir perl [tblgrant@silo programs]$ mkdir Java [tblgrant@silo programs]$ cd Java [tblgrant@silo Java]$ pico -w One.java 1 The Java compiler. 2 The Java interpreter.

3 [tblgrant@silo Java]$ ls -l -rw------- 1 tblgrant projects 114 Jun 17 15:44 One.java [tblgrant@silo Java]$ cat One.java public class One { public static void main(string[] args) { System.out.println("Welcome to Java!"); } } [tblgrant@silo Java]$ javac One.java [tblgrant@silo Java]$ java One Welcome to Java! [tblgrant@silo Java]$ pwd /u/tblgrant/lab1/experiments/programs/java Next move into each of the other two folders you have created for programs and write and run your first Python and Perl programs. Unlike the Java programs here the interpreter is called implicitly and the file needs to be executable. [tblgrant@silo Java]$ pwd /u/tblgrant/lab1/experiments/programs/java [tblgrant@silo Java]$ cd../python/ [tblgrant@silo python]$ pico -w one [tblgrant@silo python]$ ls -l -rw------- 1 tblgrant projects 34 Jun 17 15:45 one [tblgrant@silo python]$ chmod 700 one [tblgrant@silo python]$ ls -ld one -rwx------ 1 tblgrant projects 34 Jun 17 15:45 one [tblgrant@silo python]$./one Howdy. [tblgrant@silo python]$ cd.. [tblgrant@silo programs]$ cd perl [tblgrant@silo perl]$ pico -w one [tblgrant@silo perl]$ ls -ld one -rw------- 1 tblgrant projects 33 Jun 17 15:45 one [tblgrant@silo perl]$ cat one #!/usr/bin/perl print "Howdy."; [tblgrant@silo perl]$ chmod u+x one [tblgrant@silo perl]$ ls -ld one -rwx------ 1 tblgrant projects 33 Jun 17 15:45 one [tblgrant@silo perl]$./one Howdy.[tblgrant@silo perl]$ pwd /u/tblgrant/lab1/experiments/programs/perl Time has come to wrap up all of this work. Go back up into lab1 and look at all the files you have created. Use the du -a. command 3. Create an archive 3 By dot we indicate the current folder. Try man du as well

4 whoa.tar using the tar utility. Compress it with gzip. [tblgrant@silo perl]$ pwd /u/tblgrant/lab1/experiments/programs/perl [tblgrant@silo perl]$ cd.. [tblgrant@silo programs]$ pwd /u/tblgrant/lab1/experiments/programs [tblgrant@silo programs]$ cd../../ [tblgrant@silo lab1]$ du -a. 4./experiments/documents/doc2.txt 4./experiments/documents/doc1.txt 12./experiments/documents 4./experiments/programs/perl/one 8./experiments/programs/perl 4./experiments/programs/python/one 8./experiments/programs/python 4./experiments/programs/Java/One.java 4./experiments/programs/Java/One.class 12./experiments/programs/Java 32./experiments/programs 48./experiments 52. [tblgrant@silo lab1]$ tar cvf whoa.tar experiments/ experiments/ experiments/documents/ experiments/documents/doc2.txt experiments/documents/doc1.txt experiments/programs/ experiments/programs/perl/ experiments/programs/perl/one experiments/programs/python/ experiments/programs/python/one experiments/programs/java/ experiments/programs/java/one.java experiments/programs/java/one.class total 16 -rw------- 1 tblgrant projects 10240 Jun 17 15:46 whoa.tar [tblgrant@silo lab1]$ gzip whoa.tar -rw------- 1 tblgrant projects 888 Jun 17 15:46 whoa.tar.gz [tblgrant@silo lab1]$

5 Copy the compressed archive 4 to your ~/public folder. Make the archive itself readable (chmod 644) by everybody, make the ~/public folder accessible and readable to everybody (755, which is what a really public folder is supposed to be like) and make your home folder permissible (711) to those who try to access public resources that you ve made available to the world. d ~/public drwxr-xr-x 2 tblgrant projects 4096 Dec 9 2011 /u/tblgrant/public [tblgrant@silo lab1]$ cp whoa.tar.gz ~/public/ d ~/public/whoa.tar.gz -rw-r--r-- 1 tblgrant projects 888 Jun 17 15:47 /u/tblgrant/public/whoa.tar.gz [tblgrant@silo lab1]$ chmod 644 ~/public/whoa.tar.gz [tblgrant@silo lab1]$ chmod 755 ~/public [tblgrant@silo lab1]$ chmod 711 ~ [tblgrant@silo lab1]$ Now from my own account I will be able to access and grade your work: -bash-4.1$ pwd /u/dgerman/grading -bash-4.1$ ls alpha -bash-4.1$./alpha tblgrant 8 experiments/programs/python/one 16 experiments/programs/python 8 experiments/programs/perl/one 16 experiments/programs/perl 8 experiments/programs/java/one.java 8 experiments/programs/java/one.class 24 experiments/programs/java 64 experiments/programs 8 experiments/documents/doc1.txt 8 experiments/documents/doc2.txt 24 experiments/documents 96 experiments experiments/documents/doc1.txt experiments/documents/doc2.txt There s a book by Moore and Mertens, entitled "The Nature of Computation, that I like a lot. -bash-4.1$ 4 whoa.tar.gz