Bash Introduction

  • View
    186

  • Download
    0

Embed Size (px)

DESCRIPTION

Introduction to the Unix command line. André Santos & Francisco Neves

Text of Bash Introduction

  • 1. BASH INTRODUCTION

2. ANDR SANTOS 62Gerenteandreccdr@gmail.comandre-santos.ptFRANCISCO NEVES francisconeves contact@francisconeves.com francisconeves.com 3. UNIX BASED SYSTEMS 4. UNIX BASED SYSTEMS STABILITY PERFORMANCE SCALABILITY COMPATIBILITY PRICEVS WINDOWS 5. WHAT ISBASH?WHAT DOES IT MEAN? ADVANTAGES? 6. HOW TO DEAL WITHBASH?AUTOCOMPLETE MAN PAGES CLEAR SCREEN 7. SOME REQUIREDCOMMANDS 8. LISTlsMAKE DIRECTORYmkdir [OPT] DIR -p-aALL FILES-lLONG FORMATMAKE PARENTS 9. CHANGE DIRECTORYcd PATHPRINT WORKING DIRECTORYpwdCREATE EMPTY FILEtouch FILE. .. ~CURRENT DIR PARENT DIR HOME DIR 10. COPYcp [OPT] FROM TO -rMOVE OR RENAMECOPY DIRECTORIES RECURSIVELYmv FROM TO 11. REMOVErm [OPT] FILE -r -fREMOVE DIRECTORYRECURSIVELY REMOVE DIRECTORIES FORCErmdir [OPT] DIR -pPARENTS 12. CONCATENATE AND PRINT FILEScat [OPT] FILES -lVIEW FILENUMBER THE OUTPUT LINESless [OPT] FILE -NNUMBER THE OUTPUT LINES 13. LESSFREQUENT COMMANDSKeyCOMMANDKeyCOMMANDSpaceNEXT PAGE/FOWARD SEARCH FOR bPREVIOUS PAGE?BACKWARD SEARCH FOR jNEXT LINEnNEXT SEARCH MATCHkPREVIOUS LINENPREVIOUS SEARCH MATCHgFIRST LINE=FILE INFORMATIONGLAST LINEhHELPGLINE qQUIT 14. DISPLAY FIRST LINEShead [OPT] FILE -nDISPLAY LAST LINESFIRST N LINEStail [OPT] FILE -nLAST N LINES 15. PRINT LINES MATCHING A PATTERN grep [OPT] PATTERN [FILE...] -cDISPLAY THE NUMBER OF MATCHED LINES-iIGNORE CASE SENSITIVITY-lDISPLAY THE FILENAMES-nDISPLAY THE LINE NUMBERS-wMATCH WHOLE WORD 16. WORD COUNT wc [OPT] FILE -lLINE COUNT-cBYTE COUNT-mCHARACTER COUNT-wWORD COUNT 17. CTRL-KEY COMMANDS 18. KILL PROCESSCTRL + CSTOP PROCESSCTRL + ZEND OF FILECTRL + D 19. I/OREDIRECTION 20. REDIRECT STDOUT TO A FILE COMMANDAPPENDOVERWRITE > FILECOMMANDREDIRECT STDIN TO A FILE COMMAND>FILE 21. REDIRECT THE OUTPUT FROM ONE COMMAND AS INPUT TO THE NEXT ONE COMMAND1 | COMMAND2 | COMMAND3 22. WILDCARDS 23. WHAT AREWILDCARDS? 24. *ANY NUMBER OF CHARACTERS?ANY SINGLE CHARACTER 25. SYSTEM ANDSECURITY 26. UNIX PERMISSIONS ALLOWS USERS TO RUN PROGRAMS WITH THE SECURITY PRIVILEGES OF ANOTHER USER sudo [OPT] [USER] COMMANDNORMALLY THE ROOT 27. UNIX PERMISSIONS a = all ugousergroupothersrwxrwxrwx4214214217 28. CHANGE PERMISSIONS chmod [OPT] MODE FILE -RRECURSIVELY +rxREAD AND EXECUTE FOR ALLg-wDENY WRITE ACESS FOR GROUP777READ, WRITE AND EXECUTE FOR ALL 29. UNIX PROCESSES COMMAND & jobs kill SIGNAL PROCESS killall PROCESSRUN PROCESS ON BACKGROUND BACKGROUND OR SUSPENDED PROCESSES SEND SIGNAL TO A PROCESS KILL PROCESS BY NAME 30. DISPLAY TOP CPU PROCESSES top REPORTS THE PROCESS STATUS ps-fFULL LISTING-eALL PROCESSES 31. LAST BUT NOTLEAST 32. LAST COMMANDS USED history-cCLEARTIME COMMAND EXECUTION time COMMANDCOMPARE FILES LINE BY LINE diff!*LAST MATCHED COMMAND 33. WALK A FILE HIERARCHY find PATH [OPT] [EXPRESSION] -nameFIND BY NAME-sizeFIND BY SIZE-inameCASE INSENSITIVE MODE 34. ?