Prix bas
CHF56.80
Habituellement expédié sous 1 à 2 semaines.
Developers and admins, it's time to simplify your workday. With this practical guide, use scripting to solve tedious IT problems with less effort and less code! Learn about popular scripting languages: Bash, PowerShell, and Python. Master important techniques such as working with Linux, cmdlets, regular expressions, JSON, SSH, Git, and more. Use scripts to automate different scenarios, from backups and image processing to virtual machine management. Discover what's possible with only 10 lines of code!
In this book, you'll learn about:
a. Scripting Languages
Beginners, get the crash course you need in Bash (and its alternative, Zsh), PowerShell, and Python syntax to perform scripting tasks.
b. Scripting Techniques
Learn to write successful scripts by following expert guidance and practical examples. Use commands for processing text files, functions for handling JSON and XML files, cron for automating script execution, SSH for running code, and more.
c. Scripting Examples
See scripting in action! Walk through concrete applications of scripting: data backup, image processing, web scraping, REST APIs, database maintenance, cloud scenarios, and virtual machine administration.
Highlights include:
1) Bash and Zsh
2) Linux toolbox
3) PowerShell and CmdLets
4) Python and pip
5) JSON, XML, and INI
6) SSH, VS Code, and Git
7) Automation with cron
8) Backup automation
9) Image processing
10) Web scraping
11) Cloud scripting
12) Virtual machines
Automate key tasks, including backups, database updates, image processing, and web scraping
Auteur
Dr. Michael Kofler is a programmer and Linux administrator. He studied electrical engineering/telematics at Graz University of Technology. He has been one of the most successful and versatile computing authors in the German-speaking world for many years. His current topics include Linux, Docker, Git, hacking and security, Raspberry Pi, and the programming languages Swift, Java, Python, and Kotlin. Michael Kofler also teaches at the Joanneum University of Applied Sciences in Kapfenberg, Austria.
Contenu
... Preface ... 23
... Bash, PowerShell, or Python? ... 23
... About This Book ... 24
PART I ... Scripting Languages ... 27
1 ... Scripting: Doing One Thing ... 29
1.1 ... What Does Scripting Mean? ... 29
1.2 ... Scripting Languages ... 31
1.3 ... The Agony of Choice ... 35
2 ... Ten Times Ten Lines ... 39
2.1 ... Markdown Spell Checker (Bash) ... 39
2.2 ... Sorting Images by Date (PowerShell) ... 40
2.3 ... Converting a JSON File to XML Format (Python) ... 41
2.4 ... Daily Server Backups (Bash) ... 42
2.5 ... Web Scraping (Python) ... 43
2.6 ... Logging Weather Data (Python) ... 44
2.7 ... Microsoft Hyper-V Cleanup (PowerShell) ... 45
2.8 ... Statistical Analysis of a Logging File (Bash) ... 46
2.9 ... Uploading Files to the Cloud (PowerShell) ... 46
2.10 ... Cloning Virtual Machines (Bash) ... 47
3 ... Bash and Zsh ... 49
3.1 ... Terminal, Shell, and Bash ... 49
3.2 ... Installation ... 50
3.3 ... Running Commands Interactively ... 53
3.4 ... Zsh as an Alternative to Bash ... 56
3.5 ... The First Bash Script ... 58
3.6 ... Running Commands ... 63
3.7 ... Standard Input and Standard Output ... 66
3.8 ... Globbing, Brace Extension, and Handling File and Directory Names ... 68
3.9 ... Variables ... 72
3.10 ... Strings ... 77
3.11 ... Branches ... 85
3.12 ... Loops ... 91
3.13 ... Functions ... 95
3.14 ... Error Protection ... 96
4 ... PowerShell ... 99
4.1 ... Installation ... 99
4.2 ... Windows Terminal ... 103
4.3 ... Calling cmdlets and Functions ... 106
4.4 ... Combining Commands ... 112
4.5 ... The First Script ... 114
4.6 ... Variables, Strings, and Objects ... 120
4.7 ... Arrays and Hash Tables ... 131
4.8 ... Output Redirection ... 133
4.9 ... Loops ... 137
4.10 ... Branches ... 139
4.11 ... Functions and Parameters ... 141
4.12 ... Modules ... 147
4.13 ... Error Protection ... 149
5 ... Python ... 153
5.1 ... Installing Python ... 153
5.2 ... Getting to Know Python in a Terminal Window ... 156
5.3 ... Programming Custom Scripts ... 157
5.4 ... Elementary Syntax Rules ... 158
5.5 ... Numbers ... 160
5.6 ... Strings ... 162
5.7 ... Lists ... 169
5.8 ... Tuples, Sets, and Dictionaries ... 171
5.9 ... Variables ... 174
5.10 ... Operators ... 178
5.11 ... Branches (if) ... 180
5.12 ... Loops (for and while) ... 181
5.13 ... Functions ... 187
5.14 ... Processing Text Files ... 192
5.15 ... Error Protection ... 195
5.16 ... System Functions ... 195
5.17 ... Modules ... 198
5.18 ... Installing Additional Modules Using pip ... 199
PART II ... Work Techniques and Tools ... 205
6 ... Linux Toolbox ... 207
6.1 ... Directories and Files ... 207
6.2 ... Finding Files ... 209
6.3 ... Compressing and Archiving Files ... 210
6.4 ... Using Root Privileges ... 212
6.5 ... Software Installation ... 218
6.6 ... Other Commands ... 220
7 ... cmdlets for PowerShell ... 223
7.1 ... Directories and Files ... 223
7.2 ... Finding Files ... 227
7.3 ... Compressing and Archiving Files ... 230
7.4 ... Process Management ... 232
7.5 ... Registration Database and System Information ... 235
7.6 ... Processing cmdlet Results ... 238
7.7 ... Other cmdlets ... 243
7.8 ... Installing Additional Modules ... 243
7.9 ... Standard Aliases ... 246
8 ... Analyzing Texts with Filters and Pipes ... 249
8.1 ... grep, sort, cut, and uniq ... 249
8.2 ... Example: Statistical Data Analysis ... 256
8.3 ... Example: ping Analysis ... 258
8.4 ... Example: Apache Log Analysis ... 260
8.5 ... CSV Files ... 263
9 ... Regular Expressions ... 267
9.1 ... Syntax Rules for Regular Expressions ... 268
9.2 ... Groups and Alternatives ... 270
9.3 ... Regular Expressions in Bash (grep, sed) ... 276
9.4 ... Regular Expressions in PowerShell ... 280
9.5 ... Regular Expressions in Python (re Module) ... 283
10 ... JSON, XML, and INI ... 287
10.1 ... JSON in PowerShell ... 287
10.2 ... JSON and Python ... 290
10.3 ... JSON in Bash ... 295
10.4 ... XML in PowerShell ... 298
10.5 ... XML and Python ... 302
10.6 ... XML in Bash ... 305
10.7 ... INI Files ... 307
11 ... Running Scripts Automatically ... 309
11.1 ... cron ... 309
11.2 ... Example: Web Server Monitoring ... 313
11.3 ... Microsoft Windows Task Scheduler ... 315
11.4 ... Example: Saving Exchange Rates ... 319
11.5 ... Tracking File System Changes ... 320
12 ... SSH ... 323
12.1 ... Installing the SSH Client and Server ... 323
12.2 ... Working with SSH ... 327
12.3 ... scp and rsync ... 332
12.4 ... SSH Authentication with Keys ... 333
12.5 ... Example: Uploading Images to a Linux Web Server ... 336
12.6 ... Example: Analyzing Virtual Machines ... 339
13 ... Visual Studio Code ... 341
13.1 ... Introduction ... 341
13.2 ... Language-Specific VS Code Extensions ... 343
13.3 ... Remote SSH Extension ... 345
14 ... Git ... 347
14.1 ... Git Crash Course ... 348
14.2 ... Handling Settings and Passwords Correctly ... 355
14.3 ... Git Automation ... 358
14.4 ...…