Titel
Onderwerp
Verantwoordelijke afdeing, personen.
Datum
JTech Accelerator Program 2019
CI-CD DevOps – Deep Dive
Bert Koorengevel - Java Software Engineer / CodeSmith, Ordina OSD - JTech
@BertKoor
2
 Please tell me …
Why you still need the terminal these days
3
Hardware
Operating System Kernel
CLI GUI Apps
Unix-like Architecture
4
Running sh / bash on a Windows machine
• C:Program Files (x86)Git
• cmd
• git.exe
• git-gui.exe
• bin
• bash.exe
• git.exe
• sh.exe
5
/bin
/dev
/etc
/lib
/tmp
/usr/bin
/usr/lib
/home/bertkoor
~
File System Structure
6
 man [command]
 Google “introduction to unix ohio state university”
 https://devdocs.io/bash/
For help …
7
Command/Syntax What it will do
cd [directory] change directory
ls [options] [directory or file] list directory contents or file permissions
mkdir [options] directory make a directory
pwd print working (current) directory
rmdir [options] directory remove a directory (must be empty)
Directory Navigation
8
Command/Syntax What it will do
chgrp [options] group file change the group of the file
chmod [options] file change file or directory access permissions
chown [options] owner file change the ownership of a file; can only be done by the superuser
cp [options] file1 file2
copy file1 into file2; file2 shouldn't already exist. This command
creates or overwrites file2.
mv [options] file1 file2 move file1 into file2
rm [options] file
remove (delete) a file or directory (-r recursively deletes the directory
and its contents) (-i prompts before removing files)
File Maintenance Commands
9
Command/Syntax What it will do
cat [options] file concatenate (list) a file
echo [text string] echo the text string to stdout
head [-number] file display the first 10 (or number of) lines of a file
more (or less or pg) [options] file page through a text file
tail [options] file display the last few lines (or parts) of a file
Display Commands
10
Command/Syntax What it will do
date [options] report the current date and time
df [options] [resource] report the summary of disk blocks and inodes free and in use
du [options] [directory or file] report amount of disk space in use
hostname/uname display or set (super-user only) the name of the current machine
kill [options] [-SIGNAL] [pid#] [%job]
send a signal to the process with the process id number (pid#) or job
control number (%n). The default signal is to kill the process.
man [options] command show the manual (man) page for a command
passwd [options] set or change your password
ps [options] show status of active processes
which command reports the path to the command or the shell alias in use
who or w report who is logged in and what processes are running
System Resource commands
11
 sh – Bourne shell
 bash – Bourne Again shell
 ksh – Korn shell
 csh – C shell
 fish – Friendly Interface shell
The server is probably not yours, so nothing to choose
Command Line Interfaces
12
Some Bourne shell builtin commands
Command/Syntax What it will do
eval evaluate the given arguments
test evaluate an expression to true or false
set name=value set a variable
exit exit the current shell
if conditional execution
exec execute given command, replacing current shell
13
File Redirection
Symbol Redirection
> redirect output
2> redirect error output
>> append output
| pipe output to another command
< input redirection
14
Command/Syntax What it will do
awk/nawk [options] file scan for patterns in a file and process the results
grep/egrep/fgrep [options] 'search string' file
search the argument (in this case probably a file) for all
occurrences of the search string, and list them.
sed [options] file
stream editor for editing files from a script or from the
command line
Text processing commands
15
Command/Syntax What it will do
cmp [options] file1 file2
compare two files and list where differences occur (text or
binary files)
diff [options] file1 file2
compare the two files and display the differences (text files
only)
find directory [options] [actions] find files matching a type or pattern
sort [options] file sort the lines of the file according to the options chosen
tee [options] file copy stdout to one or more files
touch [options] [date] file
create an empty file, or update the access time of an existing
file
uniq [options] file remove repeated lines in a file
wc [options] [file(s)] display word (or character or line) count for file(s)
File Utilities
16
Command/Syntax What it will do
finger [options]
user[@hostname]
report information about users on local and remote machines
ftp [options] host transfer file(s) using file transfer protocol
rcp [options] hostname remotely copy files from this machine to another machine
rlogin [options] hostname login remotely to another machine
rsh [options] hostname remote shell to run on another machine
telnet [host [port]] communicate with another host using telnet protocol
Remote Connection Commands
17
Variable Usage
$# number of arguments on the command line
$- options supplied to the shell
$? exit value of the last command executed
$$ process number of the current process
$! process number of the last command done in background
$n
argument on the command line, where n is from 1 through
9, reading left to right
$0 the name of the current shell or program
$* all arguments on the command line ("$1 $2 ... $9")
Special Shell Variables
18
#!/bin/sh
if [ $# -ge 2 ]
then
echo $2
elif [ $# -eq 1 ]; then
echo $1
else
echo No input
fi
Scripts

Ordina Accelerator program 2019 - Linux

  • 1.
    Titel Onderwerp Verantwoordelijke afdeing, personen. Datum JTechAccelerator Program 2019 CI-CD DevOps – Deep Dive Bert Koorengevel - Java Software Engineer / CodeSmith, Ordina OSD - JTech @BertKoor
  • 2.
    2  Please tellme … Why you still need the terminal these days
  • 3.
    3 Hardware Operating System Kernel CLIGUI Apps Unix-like Architecture
  • 4.
    4 Running sh /bash on a Windows machine • C:Program Files (x86)Git • cmd • git.exe • git-gui.exe • bin • bash.exe • git.exe • sh.exe
  • 5.
  • 6.
    6  man [command] Google “introduction to unix ohio state university”  https://devdocs.io/bash/ For help …
  • 7.
    7 Command/Syntax What itwill do cd [directory] change directory ls [options] [directory or file] list directory contents or file permissions mkdir [options] directory make a directory pwd print working (current) directory rmdir [options] directory remove a directory (must be empty) Directory Navigation
  • 8.
    8 Command/Syntax What itwill do chgrp [options] group file change the group of the file chmod [options] file change file or directory access permissions chown [options] owner file change the ownership of a file; can only be done by the superuser cp [options] file1 file2 copy file1 into file2; file2 shouldn't already exist. This command creates or overwrites file2. mv [options] file1 file2 move file1 into file2 rm [options] file remove (delete) a file or directory (-r recursively deletes the directory and its contents) (-i prompts before removing files) File Maintenance Commands
  • 9.
    9 Command/Syntax What itwill do cat [options] file concatenate (list) a file echo [text string] echo the text string to stdout head [-number] file display the first 10 (or number of) lines of a file more (or less or pg) [options] file page through a text file tail [options] file display the last few lines (or parts) of a file Display Commands
  • 10.
    10 Command/Syntax What itwill do date [options] report the current date and time df [options] [resource] report the summary of disk blocks and inodes free and in use du [options] [directory or file] report amount of disk space in use hostname/uname display or set (super-user only) the name of the current machine kill [options] [-SIGNAL] [pid#] [%job] send a signal to the process with the process id number (pid#) or job control number (%n). The default signal is to kill the process. man [options] command show the manual (man) page for a command passwd [options] set or change your password ps [options] show status of active processes which command reports the path to the command or the shell alias in use who or w report who is logged in and what processes are running System Resource commands
  • 11.
    11  sh –Bourne shell  bash – Bourne Again shell  ksh – Korn shell  csh – C shell  fish – Friendly Interface shell The server is probably not yours, so nothing to choose Command Line Interfaces
  • 12.
    12 Some Bourne shellbuiltin commands Command/Syntax What it will do eval evaluate the given arguments test evaluate an expression to true or false set name=value set a variable exit exit the current shell if conditional execution exec execute given command, replacing current shell
  • 13.
    13 File Redirection Symbol Redirection >redirect output 2> redirect error output >> append output | pipe output to another command < input redirection
  • 14.
    14 Command/Syntax What itwill do awk/nawk [options] file scan for patterns in a file and process the results grep/egrep/fgrep [options] 'search string' file search the argument (in this case probably a file) for all occurrences of the search string, and list them. sed [options] file stream editor for editing files from a script or from the command line Text processing commands
  • 15.
    15 Command/Syntax What itwill do cmp [options] file1 file2 compare two files and list where differences occur (text or binary files) diff [options] file1 file2 compare the two files and display the differences (text files only) find directory [options] [actions] find files matching a type or pattern sort [options] file sort the lines of the file according to the options chosen tee [options] file copy stdout to one or more files touch [options] [date] file create an empty file, or update the access time of an existing file uniq [options] file remove repeated lines in a file wc [options] [file(s)] display word (or character or line) count for file(s) File Utilities
  • 16.
    16 Command/Syntax What itwill do finger [options] user[@hostname] report information about users on local and remote machines ftp [options] host transfer file(s) using file transfer protocol rcp [options] hostname remotely copy files from this machine to another machine rlogin [options] hostname login remotely to another machine rsh [options] hostname remote shell to run on another machine telnet [host [port]] communicate with another host using telnet protocol Remote Connection Commands
  • 17.
    17 Variable Usage $# numberof arguments on the command line $- options supplied to the shell $? exit value of the last command executed $$ process number of the current process $! process number of the last command done in background $n argument on the command line, where n is from 1 through 9, reading left to right $0 the name of the current shell or program $* all arguments on the command line ("$1 $2 ... $9") Special Shell Variables
  • 18.
    18 #!/bin/sh if [ $#-ge 2 ] then echo $2 elif [ $# -eq 1 ]; then echo $1 else echo No input fi Scripts