Bash Introduction

426 views

Published on

Introduction to the Unix command line.

André Santos & Francisco Neves

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
426
On SlideShare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
10
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Bash Introduction

  1. 1. BASH INTRODUCTION
  2. 2. ANDRÉ SANTOS 62Gerente andreccdr@gmail.com andre-santos.pt FRANCISCO NEVES francisconeves contact@francisconeves.com francisconeves.com
  3. 3. UNIX BASED SYSTEMS
  4. 4. UNIX BASED SYSTEMS STABILITY PERFORMANCE SCALABILITY COMPATIBILITY PRICE VS WINDOWS
  5. 5. WHAT IS BASH? ‣WHAT DOES IT MEAN? ‣ADVANTAGES?
  6. 6. HOW TO DEAL WITH BASH? ‣AUTOCOMPLETE ‣MAN PAGES ‣CLEAR SCREEN
  7. 7. SOME REQUIRED COMMANDS
  8. 8. LIST ls MAKE DIRECTORY mkdir [OPT] DIR -p -a ALL FILES -l LONG FORMAT MAKE PARENTS
  9. 9. CHANGE DIRECTORY cd PATH PRINT WORKING DIRECTORY pwd CREATE EMPTY FILE touch FILE . .. ~ CURRENT DIR PARENT DIR HOME DIR
  10. 10. COPY cp [OPT] FROM TO -r MOVE OR RENAME COPY DIRECTORIES RECURSIVELY mv FROM TO
  11. 11. REMOVE rm [OPT] FILE -r -f REMOVE DIRECTORY RECURSIVELY REMOVE DIRECTORIES FORCE rmdir [OPT] DIR -p PARENTS
  12. 12. CONCATENATE AND PRINT FILES cat [OPT] FILES -l VIEW FILE NUMBER THE OUTPUT LINES less [OPT] FILE -N NUMBER THE OUTPUT LINES
  13. 13. LESS FREQUENT COMMANDS Key COMMAND Key COMMAND Space NEXT PAGE /<text> FOWARD SEARCH FOR <TEXT> b PREVIOUS PAGE ?<text> BACKWARD SEARCH FOR <TEXT> j NEXT LINE n NEXT SEARCH MATCH k PREVIOUS LINE N PREVIOUS SEARCH MATCH g FIRST LINE = FILE INFORMATION G LAST LINE h HELP <n>G LINE <n> q QUIT
  14. 14. DISPLAY FIRST LINES head [OPT] FILE -n DISPLAY LAST LINES FIRST N LINES tail [OPT] FILE -n LAST N LINES
  15. 15. 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
  16. 16. WORD COUNT wc [OPT] FILE -l LINE COUNT -c BYTE COUNT -m CHARACTER COUNT -w WORD COUNT
  17. 17. CTRL-KEY COMMANDS
  18. 18. KILL PROCESS CTRL + C STOP PROCESS CTRL + Z END OF FILE CTRL + D
  19. 19. I/O REDIRECTION
  20. 20. REDIRECT STDOUT TO A FILE COMMAND APPEND OVERWRITE > FILE COMMAND REDIRECT STDIN TO A FILE COMMAND < FILE >> FILE
  21. 21. REDIRECT THE OUTPUT FROM ONE COMMAND AS INPUT TO THE NEXT ONE COMMAND1 | COMMAND2 | COMMAND3
  22. 22. WILDCARDS
  23. 23. WHAT ARE WILDCARDS?
  24. 24. * ANY NUMBER OF CHARACTERS ? ANY SINGLE CHARACTER
  25. 25. SYSTEM AND SECURITY
  26. 26. UNIX PERMISSIONS ALLOWS USERS TO RUN PROGRAMS WITH THE SECURITY PRIVILEGES OF ANOTHER USER sudo [OPT] [USER] COMMAND NORMALLY THE ROOT
  27. 27. UNIX PERMISSIONS a = all u g o user group others r w x r w x r w x 4 2 1 4 2 1 4 2 1 7
  28. 28. CHANGE PERMISSIONS chmod [OPT] MODE FILE -R RECURSIVELY +rx READ AND EXECUTE FOR ALL g-w DENY WRITE ACESS FOR GROUP 777 READ, WRITE AND EXECUTE FOR ALL
  29. 29. UNIX PROCESSES COMMAND & jobs kill SIGNAL PROCESS killall PROCESS RUN PROCESS ON BACKGROUND BACKGROUND OR SUSPENDED PROCESSES SEND SIGNAL TO A PROCESS KILL PROCESS BY NAME
  30. 30. DISPLAY TOP CPU PROCESSES top REPORTS THE PROCESS STATUS ps -f FULL LISTING -e ALL PROCESSES
  31. 31. LAST BUT NOT LEAST
  32. 32. LAST COMMANDS USED history -c CLEAR TIME COMMAND EXECUTION time COMMAND COMPARE FILES LINE BY LINE diff !* LAST MATCHED COMMAND
  33. 33. WALK A FILE HIERARCHY find PATH [OPT] [EXPRESSION] -name FIND BY NAME -size FIND BY SIZE -iname CASE INSENSITIVE MODE
  34. 34. ?

×