CS306 Lab Workout 2 Fall 2017.

Slides:



Advertisements
Similar presentations
Learning Unix/Linux Bioinformatics Orientation 2008 Eric Bishop.
Advertisements

Lab6 CPCS361 I.Mona Alshehri. Working with Files and Directories Creating files Create a file with the cat command type the command cat > name_of_file.
It's a binary file kept under specific directory.
Lesson 22 – Introduction to Linux Systems Administration.
UnixUnix Basic. Convention Italic text indicates text displayed by the computer system. For example, login: indicates a login prompt displayed by the.
More Shell Basics CS465 - Unix. Unix shells User’s default shell - specified in /etc/passwd file To show which shell you are currently using: $ echo $SHELL.
Lecture 02CS311 – Operating Systems 1 1 CS311 – Lecture 02 Outline UNIX/Linux features – Redirection – pipes – Terminating a command – Running program.
Introduction to Linux and Shell Scripting Jacob Chan.
CS 141 Labs are mandatory. Attendance will be taken in each lab. Make account on moodle. Projects will be submitted via moodle.
Introduction to Linux Workshop February Introduction Rob Lane & The HPC Support Team Research Computing Services CUIT.
Filesystem Hierarchy Standard (FHS) –Standard of outlining the location of set files and directories on a Linux system –Gives Linux software developers.
Help session: Unix basics Keith 9/9/2011. Login in Unix lab  User name: ug0xx Password: ece321 (initial)  The password will not be displayed on the.
Linux environment ● Graphical interface – X-window + window manager ● Text interface – terminal + shell.
1 Operating Systems Lecture 3 Shell Scripts. 2 Brief review of unix1.txt n Glob Construct (metacharacters) and other special characters F ?, *, [] F Ex.
Introduction to Unix – CS 21 Lecture 9. Lecture Overview Shell description Shell choices History Aliases Topic review.
CS 6560 Operating System Design Lecture 3:Tour of GNU/Linux.
LINUX Tuesday, 5 July :00 pm. Remote Login l Use Secure Shell (ssh) l Machine name/IP address E.g. ssh hydra.sma.nus.edu.sg Or ssh
The Shell Chapter 7. Overview The Command Line Standard IO Redirection Pipes Running a Program in the Background Killing (a process!)
Introduction to Bash Programming Ellen Zhang. Previous three classes What have we learnt so far ?
Agenda Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Review next lab assignments Break Out Problems.
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
L&T Infotech1 UNIX – Getting Started - Aneesh Ramani.
EMT 2390L Lecture 5 Dr. Reyes Reference: The Linux Command Line, W.E. Shotts.
Lecture 24CS311 – Operating Systems 1 1 CS311 – Lecture 24 Outline Final Exam Study Guide Note: These lecture notes are not intended replace your notes.
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
UNIX An Introduction. Brief History UNIX UNIX Created at Bell Labs, 1969 Created at Bell Labs, 1969 BSD during mid 70s BSD during mid 70s AT&T began offering.
1May 16, 2005 Week 2 Lab Agenda Command Line FTP Commands Review More UNIX commands to learn File name expansion - * Introduction of vi.
Week Two Agenda Announcements Link of the week Use of Virtual Machine Review week one lab assignment This week’s expected outcomes Next lab assignments.
CSE 374 Programming Concepts & Tools Hal Perkins Fall 2015 Lecture 2a – A Unix Command Sampler (Courtesy of David Notkin, CSE 303)
Linux Commands C151 Multi-User Operating Systems.
Lecture 1: Introduction, Basic UNIX Advanced Programming Techniques.
Learning Unix/Linux Based on slides from: Eric Bishop.
Linux Essentials Chapter 12: Creating Scripts. Chapter 12 Outline Beginning a shell script Using commands Using arguments Using variables Using conditional.
Introduction to Scripting Workshop February 23, 2016.
INTRODUCTION TO SHELL SCRIPTING By Byamukama Frank
CS:414 introduction to Unix and Linux
Bash Scripting CIRC Summer School 2016 Baowei Liu CIRC Summer School 2016 Baowei Liu.
Tutorial of Unix Command & shell scriptS 5027
Quality Thought Technologies
CIRC Winter Boot Camp 2017 Baowei Liu
Getting started with CentOS Linux
Chapter 11 Command-Line Master Class
Linux Commands Workout 1
Linux Commands Help HANDS ON TRAINING Author: Muhammad Laique
The UNIX Shell Learning Objectives:
Part 1: Basic Commands/Utilities
Some Linux Commands.
C151 Multi-User Operating Systems
Basic knowledge about Linux
Shell Script Assignment 1.
CSE 374 Programming Concepts & Tools
Tutorial of Unix Command & shell scriptS 5027
Basic UNIX OLC Training.
Tutorial of Unix Command & shell scriptS 5027
LING 408/508: Computational Techniques for Linguists
Tutorial of Unix Command & shell scriptS 5027
UNIX Reference Sheets CSE 2031 Fall 2010.
Run Java file with Window cmd
LAB 9 – INTRUSION DETECTION AND PREVENTION SYSTEMS
Getting started with CentOS Linux
Linux Shell Script Programming
CSE 303 Concepts and Tools for Software Development
Chapter 5 Bourne Shells Scripts
Lab 7 Shell Script Reference:
Introduction to Linux Commands
Be comfortable with Linux
LPI Linux Certification
The Linux Command Line Chapter 24
Presentation transcript:

CS306 Lab Workout 2 Fall 2017

Linux commands workout Find out your IP address: ifconfig Test if your Internet is working: ping www.yahoo.com Introduce vi as the command line editor Show how to write data (in ‘i’ mode) Save as a file (:w) Exit vi (:q) Save and exit (:wq) Exit without saving (:w!)

Linux commands workout Sort contents of a text file using the sort command more big-text_file.txt Display the file called big-text_file.txt one page at a time, proceed to next page using the spacebar head big-text_file.txt Display the first 10 lines of the file called big-text_file.txt head -20 big-text_file.txt Display the first 20 lines of the file called big-text_file.txt tail big-text_file.txt Display the last 10 lines of the file called big-text_file.txt tail -20 big-text_file.txt Display the last 20 lines of the file called big-text_file.txt

Process Life Cycle Diagram

Linux commands workout df –h du -h Create a directory structure ./test/child/tmp: mkdir –p ./test/child/tmp Change to ./test First create a file called “junk” in the CWD (touch ./junk). Then, create a hard link to it called junk-hardlink using: ln ./junk junk-hardlink ln -s ../junk junk-alias Create a hard link to the directory ../test: ln ../test test-link Create a soft link to the directory ../test: ln –s ../test test-softlink Use stat to display the inode structure and link count for test directory File test-link File junk File junk-hardlink File junk-alias

Linux commands workout top ps ps –e ps –ex kill -9 background process using & and then fg pipe operator: ls –l|wc|sort –r printenv

Linux Special Characters Expansions echo D* echo ~ echo $((2 + 2)) mkdir {2007..2009}-0{1..9} {2007..2009}-{10..12} ls -l $(which cp) find /bin -name “*gc*” grep "this" index.html grep -c "this" index.html

Linux Special Variables Description $0 The filename of the current script. $n These variables correspond to the arguments with which a script was invoked. Here n is a positive decimal number corresponding to the position of an argument (the first argument is $1, the second argument is $2, and so on). $# The number of arguments supplied to a script. $* All the arguments are double quoted. If a script receives two arguments, $* is equivalent to $1 $2. $@ All the arguments are individually double quoted. If a script receives two arguments, $@ is equivalent to $1 $2. $? The exit status of the last command executed. $$ The process number of the current shell. For shell scripts, this is the process ID under which they are executing. $! The process number of the last background command.

Linux Special Variables Create a text file using: vi test.sh Press “i” key on keyboard to enter “insert” mode [This allows you to type] Enter the following lines: #!/bin/sh echo "File Name: $0" echo "First Parameter : $1" echo "Second Parameter : $2" echo "Quoted Values: $@" echo "Quoted Values: $*" echo "Total Number of Parameters : $#“ Press Esc, followed by wq and Enter – This saves and exits vi chmod 755 test.sh Execute ./test.sh this is a “test program”