EKT332 COMPUTER NETWORK

Similar documents
Brief Linux Presentation. July 10th, 2006 Elan Borenstein

Introduction to Linux. Fundamentals of Computer Science

Getting Started With UNIX Lab Exercises

CISC 220 fall 2011, set 1: Linux basics

Introduction to Linux. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University

EECS Software Tools. Lab 2 Tutorial: Introduction to UNIX/Linux. Tilemachos Pechlivanoglou

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

Practical Session 0 Introduction to Linux

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

Parallel Programming Pre-Assignment. Setting up the Software Environment

CENG 334 Computer Networks. Laboratory I Linux Tutorial

Operating Systems. Copyleft 2005, Binnur Kurt

Operating Systems 3. Operating Systems. Content. What is an Operating System? What is an Operating System? Resource Abstraction and Sharing

Introduction to Linux

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

Introduction p. 1 Who Should Read This Book? p. 1 What You Need to Know Before Reading This Book p. 2 How This Book Is Organized p.

Part I. Introduction to Linux

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]

Perl and R Scripting for Biologists

Lab Working with Linux Command Line

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

Linux Survival Guide

UNIX. The Very 10 Short Howto for beginners. Soon-Hyung Yook. March 27, Soon-Hyung Yook UNIX March 27, / 29

CSE 390a Lecture 1. introduction to Linux/Unix environment

Unix Tutorial Haverford Astronomy 2014/2015

Introduction to Linux

CS CS Tutorial 2 2 Winter 2018

Session 1: Accessing MUGrid and Command Line Basics

CMSC 104 Lecture 2 by S Lupoli adapted by C Grasso

CSCE 212H, Spring 2008, Matthews Lab Assignment 1: Representation of Integers Assigned: January 17 Due: January 22

Laboratory 1 Semester 1 11/12

Using the Zoo Workstations

Introduction: What is Unix?

CS Fundamentals of Programming II Fall Very Basic UNIX

CSE 391 Lecture 1. introduction to Linux/Unix environment

Introduction to the UNIX command line

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

Computer Architecture Lab 1 (Starting with Linux)

Introduction to Linux

UNLV Computer Science Department CS 135 Lab Manual

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

COSC UNIX. Textbook. Grading Scheme

Introduction to Linux Workshop 1

Temple University Computer Science Programming Under the Linux Operating System January 2017

The Unix Shell & Shell Scripts

CSE 391 Lecture 1. introduction to Linux/Unix environment

*nix Crash Course. Presented by: Virginia Tech Linux / Unix Users Group VTLUUG

INSE Lab 1 Introduction to UNIX Fall 2017

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

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

Introduction to Linux

Linux File System and Basic Commands

C++ Programming on Linux

Introduction to the Command line. Introduction to the command line. Introduction to the Command line. GNU/Linux at South Wales

Operating System Interaction via bash

Unit 10. Linux Operating System

CSE Linux VM. For Microsoft Windows. Based on opensuse Leap 42.2

Exercise 1: Basic Tools

STA 303 / 1002 Using SAS on CQUEST

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

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX

Introduction. File System. Note. Achtung!

Virtual Machine. Linux flavor : Debian. Everything (except slides) preinstalled for you.

Basic Shell Commands

UNLV Computer Science Department CS 135 Lab Manual

Helsinki 19 Jan Practical course in genome bioinformatics DAY 0

Introduction to Linux

EECS2301. Lab 1 Winter 2016

Lecture 1. A. Sahu and S. V. Rao. Indian Institute of Technology Guwahati

Unix Basics. Systems Programming Concepts

Unix and C Program Development SEEM

CS 261 Recitation 1 Compiling C on UNIX

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

Introduction to Unix - Lab Exercise 0

Running Sentaurus on the DOE Network

LAB #7 Linux Tutorial

Intermediate Programming, Spring Misha Kazhdan

Chapter 4. Unix Tutorial. Unix Shell

Overview LEARN. History of Linux Linux Architecture Linux File System Linux Access Linux Commands File Permission Editors Conclusion and Questions

Linux Bootcamp Fall 2015

User Guide Version 2.0

BIOINFORMATICS POST-DIPLOMA PROGRAM SUBJECT OUTLINE Subject Title: OPERATING SYSTEMS AND PROJECT MANAGEMENT Subject Code: BIF713 Subject Description:

Setting up and running the pyrophosphate tools under the Knoppix GNU Linux system

Intro to Linux & Command Line

Introduction to Linux

Tutorial 1: Unix Basics

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

Linux/Cygwin Practice Computer Architecture

UNIX COMMANDS AND SHELLS. UNIX Programming 2015 Fall by Euiseong Seo

Lab 1 Introduction to UNIX and C

Helpful Tips for Labs. CS140, Spring 2015

Oxford University Computing Services. Getting Started with Unix

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

Introduction to Linux Spring 2014, Section 02, Lecture 3 Jason Tang

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

Getting started with UNIX/Linux for G51PRG and G51CSA

Introduction to Linux

CMPT 300. Operating Systems. Brief Intro to UNIX and C

CS370 Operating Systems

Week 2 Lecture 3. Unix

Transcription:

EKT332 COMPUTER NETWORK LAB 1 INTRODUCTION TO GNU/LINUX OS

Lab #1 : Introduction to GNU/Linux OS Objectives 1. Introduction to Linux File System (Red Hat Distribution). 2. Introduction to various packages installed in Red Hat Distribution. 3. Introduction to Linux Command Line. 4. Introduction to Programming GNU C compiler. Background 1. Unix and Linux Linux is based on Unix Unix philosophy Unix commands Unix standards and conventions There is some variation between Unix operating systems Especially regarding system administration Often Linux-specific things in these areas 2. Unix System Architecture The shell and the window environment are programs Programs only access to hardware is via the kernel (figure 1) Figure 1

3. Unix Philosophy Multi-user A user needs an account to use a computer Each user must log in Complete separation of different users files and configuration settings Small components Each component should perform a single task Multiple components can be combined and chained together for more complex tasks An individual component can be substituted for another, without affecting other components 4. What is Linux? Linux kernel Developed by Linus Torvalds Strictly speaking, Linux is just the kernel Associated utilities Standard tools found on (nearly) all Linux systems Many GNU utilities Written by the Free Software Foundation Some claim the OS as a whole should be GNU/Linux Linux distributions Kernel plus utilities plus other tools, packaged up for end users Generally with installation program Distributors include: Red Hat, Debian, SuSE, Mandrake

5.Using a Linux System Login prompt displayed When Linux first loads after booting the computer After another user has logged out Need to enter a username and password The login prompt may be graphical or simple text If text, logging in will present a shell If graphical, logging in will present a desktop Some combination of mousing and keystrokes will make a terminal window appear A shell runs in the terminal window 6. Linux Command Line The shell is where commands are invoked A command is typed at a shell prompt Prompt usually ends in a dollar sign ($) After typing a command press Enter to invoke it The shell will try to obey the command Another prompt will appear Example: $ date Thu May 28 10:28:05 BST 2008 $ The dollar represents the prompt in this course do not type it

7.Command History Often it is desired to repeat a previously-executed command The shell keeps a command history for this purpose Use the Up and Down cursor keys to scroll through the list of previous commands Press Enter to execute the displayed command Commands can also be edited before being run Particularly useful for fixing a typo in the previous command The Left and Right cursor keys navigate across a command Extra characters can be typed at any point Backspace deletes characters to the left of the cursor Del and Ctrl+D delete characters to the right Make sure not to log out by holding down Ctrl+D too long 8. Creating Files with cat There are many ways of creating a file One of the simplest is with the cat command: $ cat > cucumber bread yoghurts fish fingers

Note the greater-than sign (>) this is necessary to create the file The text typed is written to a file with the specified name Press Ctrl+D after a line-break to denote the end of the file The next shell prompt is displayed ls demonstrates the existence of the new file 9. Specifying Files with Wildcards Use the * wildcard to specify multiple filenames to a program: $ ls -l *.txt -rw-rw-r--1 fred users 108 Nov 16 13:06 report.txt -rw-rw-r--1 fred users 345 Jan 18 08:56 notes.txt The shell expands the wildcard, and passes the full list of files to the program Just using * on its own will expand to all the files in the current directory: $ rm * Names with wildcards in are called globs, and the process of expanding them is called globbing 10. Process Monitoring: ps The ps command gives a snapshot of the processes running on a system at a given moment in time Very flexible in what it shows, and how: Normally shows a fairly brief summary of each process Normally shows only processes which are both owned by the current user and attached to a terminal Unfortunately, it doesn t use standard option syntax

Instead it uses a mixture of options with one of three syntaxes: Traditional BSD ps: a single letter with no hyphen Unix98 ps: a single letter preceded by a hyphen GNU: a word or phrase preceded by two hyphens 11. Process Monitoring: pstree Displays a snapshot of running processes Always uses a tree-like display, like ps f But by default shows only the name of each command Normally shows all processes Specify a pid as an argument to show a specific process and its descendants Specify a user name as an argument to show process trees owned by that user 12. Process Monitoring: top Shows full-screen, continuously-updated snapshots of process activity Waits a short period of time between each snapshot to give the illusion of real-time monitoring Processes are displayed in descending order of how much processor time they re using Also displays system uptime, load average, CPU status, and memory information

13. top Command-Line Options 14. top Interactive Commands Here is some command that may help in assisting you to complete the project: Command Ls Meaning Displays a list of files in the current working directory, like the dir command in DOS cd directory passwd file filename cat textfile change directories change the password for the current user display file type of file with name filename throws content of textfile on the screen

pwd exit or logout man command rm filename cp source_file target_file info command mv source_file target_file display present working directory leave this session read man pages on command (this will help much) remove files copy files read Info pages on command move files Exercise 1 (Linux System Administration) Write all the commands/procedure used in your answer sheet. 1. Create a directory and name it as myfolder. 2. Create a file that contain your name, date of birth, sex, marital status, home address, and phone number in the directory that you have created and name it as myinfo. 3. Create one more file that contain your student ID, IC number and name it as myid. 4. Copy myinfo file into new file name as mydetails.txt. 5. Verify how many files are in your folder now. 6. Delete myinfo file. 7. Now verify again how many files are in your folder now. 8. Get back to your home directories 9. Verify that you are in the home directory by using appropriate command. 10. Create new folder and name it as mynewfolder. 11. Now create two folders by using single command and name it with any name that you prefer. 12. Remove the two folders that you have created just by using a single command. 13. Copy all the files that exist in myfolder into mynewfolder. 14. Verify the files contain in mynewfolder.

15. Now remove myfolder. 16. What is the difference of using rmdir and rm r? 17. Verify that the folder has been removed. 18. Now by using GUI go to mynewfolder and open mydetails.txt file. 19. Edit the file by adding your name. 20. Save the file. 21. Verify the changes that you have made, in the terminal. 22. Use locate command to find the path of mydetails.txt file. 23. use cat command to display mydetails.txt file. 24. From your home directory list the files in mynewfolder. 25. Use top to show the processes running on your machine. 26. Make top sort by memory usage, so that the most memory-hungry processes appear at the top. 27. Restrict the display to show only processes owned by you. 28. Try killing one of your processes (make sure it s not an important process). 29. Display a list of all the processes running on the machine using ps (displaying the full command line for them). 30. Get the same listing as a tree, using both ps and pstree. 31. Have ps sort the output by system time used.

Programming using GNU C compiler A. Steps To Compile A Program 1. Click GNOME Menu icon (Start) > System Tools> Terminal 2. If you save your program in: a) the current directory, type gcc welcome.c OR b) a folder in the current directory, type cd foldername, then gcc welcome.c 3. Reminder You can compile and specify the output file name together with the compile command. gcc -o result welcome.c OR gcc welcome.c -o result B. Steps To Run A Program 1. Stay in the Terminal window 2. From Command Prompt, if you a) did not specify the output file name, type./a.out OR b) specify the output file name, type./result C. Logging Out To exit from the shell, use the exit command Pressing Ctrl+D at the shell prompt will also quit the shell Quitting all programs should log you out If in a text-only single-shell environment, exiting the shell should be sufficient

In a window environment, the window manager should have a log out command for this purpose After logging out, a new login prompt should be displayed Exercise 2 (Programming GNU C compiler) Write all the commands/procedure used in your answer sheet. 1. Write back all the coding in the text editor. 2. Save the file name as ilovelinux.c 3. Open the terminal and compile the coding. 4. Try to run the code. 5. Write the result after you run the code. #include <stdio.h> #include <stdlib.h> int prime(int number, int * primes); int main(void) { int primes[998] = { 3, 0 }; int n = 5, i; int count = 0, found; printf("%8d%8d%8d", 1, 2, 3); /* Print first 3 primes */ /* Find the next 997 */ while ( count < 997 ) { i = 0; found = 1; /* Test if number divides by any of the primes already found */ while ( primes[i] ) { if ( (n % primes[i++]) == 0 ) { /* If it does... */ found = 0; /*...then it isn't prime... */ break; /*...so stop looking */ } } if ( found ) { printf("%8d", n); /* If it's prime, print it... */ primes[i] = n; /*...and add it to the list */ ++count; /* Start a new line every 8 primes found */ if ( ((count + 3) % 8) == 0 ) putchar('\n'); }

n += 2; /*There's no point testing even numbers, so skip them*/ } putchar('\n'); return EXIT_SUCCESS; } Lab Discussion:- 1. Write down a simple and brief discussion of what you have learnt from this lab session. Complete all the exercises given. Submit your answer sheet to your PLV. Do not copy other students work. Make your own report.