CISC 5500 Introduction; basic bash commands Zhou Ji, Computer and - - PowerPoint PPT Presentation

cisc 5500
SMART_READER_LITE
LIVE PREVIEW

CISC 5500 Introduction; basic bash commands Zhou Ji, Computer and - - PowerPoint PPT Presentation

CISC 5500 Introduction; basic bash commands Zhou Ji, Computer and Information Science Fordham University Table of contents 1. Introduction 2. Bash basic commands 3. I/O redirection 4. Scripting 1 Introduction to the course Purpose


slide-1
SLIDE 1

CISC 5500

Introduction; basic bash commands

Zhou Ji, Computer and Information Science

Fordham University

slide-2
SLIDE 2

Table of contents

  • 1. Introduction
  • 2. Bash

basic commands

  • 3. I/O redirection
  • 4. Scripting

1

slide-3
SLIDE 3

Introduction to the course

slide-4
SLIDE 4

Purpose

broaden your practical skills as a data scientists, or simply as a computer user three topics: Bash, SQL, R

2

slide-5
SLIDE 5

Administrative plan

website https://storm.cis.fordham.edu/ji/cisc5500scripting/ email zji@fordham.edu lectures, homework, lab, exams

3

slide-6
SLIDE 6

Introduction to Bash

slide-7
SLIDE 7

What is Bash?

prerequisite knowledge: OS, files and directories Bash is a shell, probably the most popular one. Where to get Bash:

  • personal computer, if it is Mac or any Linux
  • account on any Linux system, e.g. erdos, storm
  • Windows: install WSL

4

slide-8
SLIDE 8

Linux File System

how files are organized

5

slide-9
SLIDE 9

navigate through the file system

based on the idea of current working directory print working directory pwd change directory cd directory name

6

slide-10
SLIDE 10

absolute path vs relative path

examples

  • /home/staff/ji/file1
  • ji/file1

special directory names . (self) and .. (parent) cd .. cd ../staff/bob/./..

7

slide-11
SLIDE 11

Look inside ...

list the content of a directory ls directory name print the content of a file cat file name

8

slide-12
SLIDE 12

Make changes

copy cp [source] [destination] move / rename mv delete rm create a directory mkdir what about creating a file? ultimate command to learn more man

9

slide-13
SLIDE 13

I/O redirection

slide-14
SLIDE 14

Input and output of a program

10

slide-15
SLIDE 15

I/O redirections

special input/output

  • standard input
  • standard output
  • standard error
  • utput redirection >

appending output redirection >> input redirection < pipe | redirection of standard error

11

slide-16
SLIDE 16

Scripting

slide-17
SLIDE 17

What is scripting

What is a command

  • 1. executable
  • 2. built-in command of the shell
  • 3. function
  • 4. alias

What is scripting

  • Scripting is to write multiple commands in a text file so we can run

them all at once automatically.

  • Scripting and programming are basically the same thing.

12

slide-18
SLIDE 18

How to write a script

Using a text editor vi or else Other tricks

  • searching path
  • permissions

13

slide-19
SLIDE 19

Summary

  • what is Bash
  • basic Linux commands
  • I/O redirection

2020.8.27 14

slide-20
SLIDE 20

Questions?

14

slide-21
SLIDE 21

vi

vi can be an intimidating topic. Knowing some basics is still necessary even at the very beginning.

slide-22
SLIDE 22

more common commands

which, type, file help, info, whatis, apropos, alias wc, head, tail, sort, uniq, tee ln touch