Intro to Linux | Cisco Lab11 | Basic Scripting

Pubblicato il: 02 agosto 2021
sul canale di: Computer Engineering life
3,664
49

Notes: https://docs.google.com/document/d/1G...


00:00 11.1: Introduction
Use the vi editor.
Create simple shell scripts.
Create shell scripts with conditional execution and loops.

00:29 11.2 Basic Text Editing
Creating a new file use: " vi [ file name ] "
Keys and functions. Arrow keys. "w" key moves to the beginning of the next word. "e" moves to the end of the word. "b" moves to the beginning of previous word.
press " :q! " to quit edit mode without saving.
"$" or end key to move to the end of the current line.
(0) or home key will move to the beginning of the current line.
[ n shift + G] to jump to an n'th line.
[ n + l ] to move to a n'th index on the line.
[ shift + G ] jumps to the last line.

03:41 11.2.5 More Advanced Basics (1)
To insert text, use "i".
"dw" to delete the current word. Delete n many words, use: "ndw".
"u" to undo. Undo n many words, use: "nu".
Delete x many characters use: "xxx....". Delete n many characters, use: "nx".
Delete n many characters to the left, use: "n shift + X".
Delete an entire line, use "dd". Delete n many lines, use: "ndd".
Last thing deleted was "cut", you can paste it.
To paste, use "p". To paste before the cursor, use "shift + P".
Delete on the line from the current position, use: "shift + D".

8:07 11.2.23 More Advanced Basics (2)
Join two lines together, use: "shift + J".
To copy a line, use "yw".
To join n many lines together, use: "n shift + J".
Searching and deleting a word, use ":%s/[ word ] //g".
To change the case (upper/ lower) use, "shift + ` ".
To save without exiting, use ":w". To save with exiting, use ":x".
To enter insert mode, use command "a".

11:28 11.2.39 More Advanced Basics (3)
To open a blank line, use "o". To open a blank line above, use "shift + o".
Different ways to save or quit (11.2.45).
Searching for a word from top to bottom, use "/[ word ]" (11.2.51).
To search for the next instance of a word, use "n" (11.2.52).
Searching for a word from bottom to top, use "?[ word ]" (11.2.53).
To replace a word with another word, use "cw", this will put you in insert mode. Then you can type your word. (11.2.56).
To add text at the beginning of a line, use "shift + I". List of different insert nodes (11.2.57).
To add text at the end of a line, use "shift + A" (11.2.59).

16:36 11.3 Basic Shell Scripting
Placing a complex sequence of commands into a file and running it. Just create a text file and add commands into it then run it.
Must prefix the file with " #!/bin/bash " (11.3.2).
To call our file in our main command line, use "bash [ file name ]." Or if everyone has the permission to run it, just use ./[ file name ](11.3.3)
To run a command in a command, use " `` ", backquotes (11.3.4)
To see the actual script and not run it, use "cat [ file name ]". (11.3.5)
RECALL: Using "echo $PATH" to see the path.
Moving the script file, use "mv [ file name ] [ directory to be moved to ]" (11.3.8)

22:25 11.4 Conditional and Repetitive Execution
If and test statements (11.4.1)
Writing programs.
While loop (11.4.4)
Writing programs.
For loop (11.4.5)
Writing programs.
Using the seq command with out for loop (11.4.6)

-phew that was long-


In questa pagina del sito puoi guardare il video online Intro to Linux | Cisco Lab11 | Basic Scripting della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Computer Engineering life 02 agosto 2021, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 3,664 volte e gli è piaciuto 49 spettatori. Buona visione!