Introduction to Unix - Lab Exercise 0

Similar documents
Tiny Instruction Manual for the Undergraduate Mathematics Unix Laboratory

Tutorial 1: Unix Basics

Using LINUX a BCMB/CHEM 8190 Tutorial Updated (1/17/12)

Getting Started With UNIX Lab Exercises

Using the Zoo Workstations

LAB 0: LINUX COMMAND LINE AND SVN

Homework #1: SSH. Step 1: From the start button (lower left hand corner) type Secure. Then click on the Secure Shell File Transfer Client.

Lab Working with Linux Command Line

Unix Tutorial Haverford Astronomy 2014/2015

Part I. Introduction to Linux

FILE MAINTENANCE COMMANDS

Introduction to Linux. Fundamentals of Computer Science

When you first log in, you will be placed in your home directory. To see what this directory is named, type:

Introduction to the UNIX command line

CSE115 Lab exercises for week 1 of recitations Spring 2011

Essential Linux Shell Commands

The Directory Structure

Unix tutorial. Thanks to Michael Wood-Vasey (UPitt) and Beth Willman (Haverford) for providing Unix tutorials on which this is based.

Session 1: Accessing MUGrid and Command Line Basics

CMSC 201 Spring 2017 Lab 01 Hello World

CS 2400 Laboratory Assignment #1: Exercises in Compilation and the UNIX Programming Environment (100 pts.)

BE CAREFUL! The Summer Research Student s Guide to UNIX

Helpful Tips for Labs. CS140, Spring 2015

CMSC 201 Spring 2018 Lab 01 Hello World

Unix File System. Learning command-line navigation of the file system is essential for efficient system usage

User Guide Version 2.0

You should see something like this, called the prompt :

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

Week Overview. Unix file system File types and file naming Basic file system commands: pwd,cd,ls,mkdir,rmdir,mv,cp,rm man pages

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

Linux File System and Basic Commands

Practical Session 0 Introduction to Linux

CENG 334 Computer Networks. Laboratory I Linux Tutorial

Protocols. Module UFCE Topic: Protocols and More HTML

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]

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

commandname flags arguments

Physics REU Unix Tutorial

Linux hep.wisc.edu

Python for Astronomers. Week 1- Basic Python

Mills HPC Tutorial Series. Linux Basics I

CS 307: UNIX PROGRAMMING ENVIRONMENT KATAS FOR EXAM 1

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

Introduction. File System. Note. Achtung!

Programming and Data Structure Laboratory (CS13002)

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

Linux at the Command Line Don Johnson of BU IS&T

ENCM 339 Fall 2017: Editing and Running Programs in the Lab

Lab 2A> ADDING USERS in Linux

UNIX Tutorial Two

CSCI 2132 Software Development. Lecture 4: Files and Directories

Click on the Start Icon. Click on All Programs

15-122: Principles of Imperative Computation

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

Linux Exercise. pwd answer: We call this directory (into which you get when you log in) your home directory.

Commands are in black

ORF 201 Computer Methods in Problem Solving. Lab 2: My House, My Home (Page)

Lab 1 Introduction to UNIX and C

CSE 101 Introduction to Computers Development / Tutorial / Lab Environment Setup

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering

Command Line Interface The basics

AMS 200: Working on Linux/Unix Machines

CpSc 1111 Lab 1 Introduction to Unix Systems, Editors, and C

Windows XP. A Quick Tour of Windows XP Features

CS CS Tutorial 2 2 Winter 2018

Introduction. SSH Secure Shell Client 1

Contents. Note: pay attention to where you are. Note: Plaintext version. Note: pay attention to where you are... 1 Note: Plaintext version...

Find out where you currently are in the path Change directories to be at the root of your home directory (/home/username) cd ~

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

Operating Systems and Using Linux. Topics What is an Operating System? Linux Overview Frequently Used Linux Commands

Basic Survival UNIX.

NOTE: If your student is 18+, you do not need to give your consent and can skip ahead to page 6.

Where Did My Files Go? How to find your files using Windows 10

Introduction to Linux (Part I) BUPT/QMUL 2018/03/14

L.A.M.P. Stack Part I

CSCI 161: Introduction to Programming I Lab 1a: Programming Environment: Linux and Eclipse

LAB #5 Intro to Linux and Python on ENGR

Exercise sheet 1 To be corrected in tutorials in the week from 23/10/2017 to 27/10/2017

Getting Started with UNIX

UNIX Tutorial One

Parts of this tutorial has been adapted from M. Stonebank s UNIX Tutorial for Beginners (

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

CSE 391 Lecture 1. introduction to Linux/Unix environment

Introduction to Linux Workshop 1

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

Lab Assignment #1. University of Pittsburgh Department of Electrical and Computer Engineering

COMS 6100 Class Notes 3

Intro to Linux & Command Line

CST Lab 2 Review #1

Introduction to Linux Environment. Yun-Wen Chen

Introduction: What is Unix?

This is Lab Worksheet 3 - not an Assignment

Running Sentaurus on the DOE Network

Chapter-3. Introduction to Unix: Fundamental Commands

1) Log on to the computer using your PU net ID and password.

COMP s1 Lecture 1

Linux Bootcamp Fall 2015

FIT 100: Fluency with Information Technology

CPS109 Lab 1. i. To become familiar with the Ryerson Computer Science laboratory environment.

Helsinki 19 Jan Practical course in genome bioinformatics DAY 0

Transcription:

Introduction to Unix - Lab Exercise 0 Along with this document you should also receive a printout entitled First Year Survival Guide which is a (very) basic introduction to Unix and your life in the CSE labs. It was written in a hurry so if there is anything you feel should be included please let us know by emailing compsoc@cse.unsw.edu.au. This series of exercises is relatively short and is intended just to get you up and running. Refer to the guide and the Unix Primer for more detail. For those of you that have done the maths department introduction, much of the same thing will be covered here so you can skip straight to the exercises. Logging In When you sit down you will see a window asking for your login and a password. At the login prompt type in the login name that you were given when you first enabled your account: it should be a sequence of a few letters followed by a few numbers. For example, a student named Jane Smith might have the following login: janes747 This is your login name for the CSE network computers. Next, hit enter and type your account password into the box to the right of the password prompt, which is the same one you entered into Sirius when you enabled your account. You will notice that unlike your login, your password does not show up on the computer monitor: this is normal, as your password should not be seen by others around you. Now hit enter once again, and in a few moments you will be logged into your account for the first time. If you haven t enabled your account yet please see your demonstrator - he/she will be able to log you into a temporary account so you can still do the exercises. Entering Commands You should now see two large xterm windows in front of you. These are windows into which you type commands to be run by the computer. You will also see a small window in the upper left of the screen. You can safely ignore this for now. If you click any of the 3 mouse buttons in the background you will see a menu pop up. Each of these buttons brings up a different menu and the menus will be explained in more detail during your first lab. 1

Move your mouse into the larger of the two windows - see how it changes colour? This means that this window is now the active window and all commands you type will show up here. If you knock the mouse out of a window the keyboard won t be entering text into that window anymore. You will see a prompt in the upper left corner of the xterm. It will probably be a percentage sign (%). This is the xterm s way of saying give me something to do. You can type commands in here and the xterm will execute them for you. Lets try a simple command now. Type whoami at the prompt and hit enter. This should print out your login name. %whoami janes747 Not too difficult, was it? Every command you type in Unix is the name of a file to execute. In the previous example we executed a file called whoami which prints out your userid. There are many commands on this system and we can t hope to cover them all here, but we ll plunge on into a few of the more basic ones. Basic Lab exercise Just follow all the commands as illustrated throughout. It should be self-explanatory but there will be demonstrators around to help you if you have a question at any time. When you start you will be in your home directory. This is your little space in the memory storage of CSE. It is limited, so be careful not to overfill it. You probably won t have any files in your account yet, so lets see what we do have. To list all the files in the current directory we use a command called ls (list). Lets try that now: public_html This means that the account has been created with this directory (or folder) public html already there. Other than this, you have no files. Or do you? ls has options that will alter the way it runs, as do most of the other commands. Unix supports hidden files that start with a dot (.). To view them we run ls with the -a option to list all the files in the current directory. Lets try this now: 2

-a.xauthority.login.profile.withenv public_html These files are usually just configuration files for programs and you can safely ignore them for now. There are other options to ls which you can find out about later. The only other one you may want to try out now is the l option which is illustrated in the Compsoc Survival Guide. Lets create a directory of our own. The command mkdir (make directory) will do this for us. Lets try to create a directory within the current directory called test : %mkdir test Now list the contents of the directory again: public_html test We can now see that we have two directories in our account: public_html and test. So how do we move into this new directory? This is accomplished with the cd (change directory) command: %cd test % This directory is empty, as you can see. At any point, you can type cd.. (note the space character) to move back a directory level. To find out where you are currently working, use the pwd (print working directory) command: %pwd /import/bizet/2/janes747/test Don t worry about the /import/bizet/2/ part yet - this is just the location of your home directory on the CSE system. Lets now create a file called test1. We will be creating this file with an editor called nedit. You will get more information soon about the full operation of this editor. Lets run this editor now: %nedit test1 3

This will bring up a new window. There will be a prompt accompanying this window which will tell you that the file called test1 does not exist, and asks you whether you would like to create it: click on the Create button to create the file. Type some text in the window (whatever you like) and then save the file. You do this by clicking on the File menu and selecting Save. Once you have done this, exit the editor by choosing File and then Exit. test1 We now have a new file called test1. How do we view this when we re not running an editor? There are two main commands for this: cat and less. The difference between them is that cat simply prints out the whole file, while less lets you view the file page by page. Lets see how these work: %cat test1 This is the text I just typed into the editor less has a few commands which allow you to either move forward or backward through the file, search for text or go through the file line by line. To simply scroll through the file page by page, just keep hitting the spacebar. To exit less you just type q at any time. Lets see some other basic file operations: %mv test1 test2 test2 %cp test2 test3 test2 test3 %cat test2 This is the text I just typed into the editor %cat test3 This is the text I just typed into the editor You can see that the command mv (move) will rename a file and the command cp will copy a file. Further usage of these commands are illustrated in the Compsoc Survival 4

Guide. Now there s just one last thing we need to be able to do: delete files. Remember that all deletions in Unix are permanent - there is no undelete! The command rm (remove) will do this for us. %rm test2 test3 We can remove directories with the command rmdir. The directories need to be empty of all files for this command to work, though. %mkdir removeme removeme test3 %cp test3 removeme %cd removeme test3 %pwd /import/bizet/2/janes747/test/removeme %cd.. %pwd /import/bizet/2/janes747/test %rmdir removeme rmdir: removeme: File Exists %rm removeme/test3 %rmdir removeme test3 We have created a directory call removeme, copied our file into it and then tried to remove the directory. This didn t work because the directory was not empty, so we removed the file from the removeme directory, which then allowed us to remove the now empty directory successfully. You should be left in your test directory with one file called test3. 5

Before we leave, lets clean up after ourselves: %rm test3 %cd.. %rmdir test Well, you have now successfully navigated the basic unix commands. Make sure you read the Compsoc Survival Guide as this will give you much more detail and more commands and options than this basic introduction. Hopefully you will have learnt enough to start trying commands out on your own - good luck! Please at least read the section in the Compsoc Survival Guide about reading email - you need to be able to do this every time you log in since most of the important subject details and updates will be communicated through email. Please get a demonstrator to sign below and take this to your computing tutor in week 2 to get marked off and get a little more credit. Name SID Demonstrator Name Demonstrator signature 6