Slide 1

Slide 1 text

INTRODUCTION BASH

Slide 2

Slide 2 text

ANDRÉ SANTOS FRANCISCO NEVES 62Gerente [email protected] andre-santos.pt francisconeves [email protected] francisconeves.com

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

UNIX BASED SYSTEMS

Slide 5

Slide 5 text

UNIX BASED SYSTEMS STABILITY PERFORMANCE SCALABILITY COMPATIBILITY PRICE VS WINDOWS

Slide 6

Slide 6 text

BASH? ‣WHAT DOES IT MEAN? ‣ADVANTAGES? WHAT IS

Slide 7

Slide 7 text

BASH? ‣AUTOCOMPLETE ‣MAN PAGES ‣CLEAR SCREEN HOW TO DEAL WITH

Slide 8

Slide 8 text

COMMANDS SOME REQUIRED

Slide 9

Slide 9 text

LIST ls -a -l ALL FILES LONG FORMAT MAKE DIRECTORY mkdir [OPT] DIR -p MAKE PARENTS

Slide 10

Slide 10 text

CHANGE DIRECTORY cd PATH . CURRENT DIR ~ .. PARENT DIR HOME DIR PRINT WORKING DIRECTORY pwd CREATE EMPTY FILE touch FILE

Slide 11

Slide 11 text

COPY cp [OPT] FROM TO MOVE OR RENAME mv FROM TO -r COPY DIRECTORIES RECURSIVELY

Slide 12

Slide 12 text

REMOVE rm [OPT] FILE REMOVE DIRECTORY rmdir [OPT] DIR -r RECURSIVELY REMOVE DIRECTORIES -f FORCE -p PARENTS

Slide 13

Slide 13 text

CONCATENATE AND PRINT FILES cat [OPT] FILES less [OPT] FILE -N NUMBER THE OUTPUT LINES VIEW FILE -l NUMBER THE OUTPUT LINES

Slide 14

Slide 14 text

FREQUENT COMMANDS LESS Key COMMAND Space NEXT PAGE b PREVIOUS PAGE j NEXT LINE k PREVIOUS LINE g FIRST LINE G LAST LINE G LINE Key COMMAND / FOWARD SEARCH FOR ? BACKWARD SEARCH FOR n NEXT SEARCH MATCH N PREVIOUS SEARCH MATCH = FILE INFORMATION h HELP q QUIT

Slide 15

Slide 15 text

DISPLAY FIRST LINES head [OPT] FILE tail [OPT] FILE -n LAST N LINES -n FIRST N LINES DISPLAY LAST LINES

Slide 16

Slide 16 text

PRINT LINES MATCHING A PATTERN grep [OPT] PATTERN [FILE...] -c DISPLAY THE NUMBER OF MATCHED LINES -i IGNORE CASE SENSITIVITY -l DISPLAY THE FILENAMES -n DISPLAY THE LINE NUMBERS -w MATCH WHOLE WORD

Slide 17

Slide 17 text

WORD COUNT wc [OPT] FILE -l LINE COUNT -c BYTE COUNT -m CHARACTER COUNT -w WORD COUNT

Slide 18

Slide 18 text

COMMANDS CTRL-KEY

Slide 19

Slide 19 text

KILL PROCESS CTRL + C STOP PROCESS CTRL + Z END OF FILE CTRL + D

Slide 20

Slide 20 text

REDIRECTION I/O

Slide 21

Slide 21 text

COMMAND > FILE REDIRECT STDOUT TO A FILE OVERWRITE COMMAND >> FILE REDIRECT STDIN TO A FILE APPEND COMMAND < FILE

Slide 22

Slide 22 text

COMMAND1 | COMMAND2 | COMMAND3 REDIRECT THE OUTPUT FROM ONE COMMAND AS INPUT TO THE NEXT ONE

Slide 23

Slide 23 text

WILDCARDS

Slide 24

Slide 24 text

WHAT ARE WILDCARDS?

Slide 25

Slide 25 text

* ? ANY SINGLE CHARACTER ANY NUMBER OF CHARACTERS

Slide 26

Slide 26 text

SECURITY SYSTEM AND

Slide 27

Slide 27 text

PERMISSIONS UNIX sudo [OPT] [USER] COMMAND ALLOWS USERS TO RUN PROGRAMS WITH THE SECURITY PRIVILEGES OF ANOTHER USER NORMALLY THE ROOT

Slide 28

Slide 28 text

PERMISSIONS UNIX u u u g g g o o o user user user group group group others others others r w x r w x r w x 4 2 1 4 2 1 4 2 1 a = all 7

Slide 29

Slide 29 text

CHANGE PERMISSIONS chmod [OPT] MODE FILE -R RECURSIVELY +rx g-w 777 READ AND EXECUTE FOR ALL DENY WRITE ACESS FOR GROUP READ, WRITE AND EXECUTE FOR ALL

Slide 30

Slide 30 text

PROCESSES UNIX COMMAND & RUN PROCESS ON BACKGROUND jobs BACKGROUND OR SUSPENDED PROCESSES kill SIGNAL PROCESS SEND SIGNAL TO A PROCESS killall PROCESS KILL PROCESS BY NAME

Slide 31

Slide 31 text

top DISPLAY TOP CPU PROCESSES ps REPORTS THE PROCESS STATUS -e FULL LISTING ALL PROCESSES -f

Slide 32

Slide 32 text

LEAST LAST BUT NOT

Slide 33

Slide 33 text

history -c CLEAR LAST COMMANDS USED time COMMAND TIME COMMAND EXECUTION diff COMPARE FILES LINE BY LINE !* LAST MATCHED COMMAND

Slide 34

Slide 34 text

WALK A FILE HIERARCHY find PATH [OPT] [EXPRESSION] -name FIND BY NAME -size FIND BY SIZE -iname CASE INSENSITIVE MODE

Slide 35

Slide 35 text

?