Categories
LINUX

LAMP server q.s.a. install manual 2

1.2 Learn shell and documents handling

1.2.1 Shell


https://qiita.com/zayarwinttun/items/0dae4cb66d8f4bd2a337 Basics for Shell script beginners
https://jehupc.exblog.jp/15729095/ the differences between connector character(; & && ||)

#shell list bulid my own. upload in time.

ab.sh #afterboot    <linked
ss.sh #sshdsafe
bw.sh #basicwebserver
aw.sh #advancewebserver

#shell scripts

bash < +.sh na

#shebang

!/bin/bash

#loop

for f in ./*
    do
    echo $f
done

#citation

$# counts
$0 script name
$1 option…

#return code status

echo $?

#tar command options

f ile name
v erbose
c reate
x extract
t arget
z gz
i bz2
j xz

1.2.2 Editor VIM


http://www.vim.org/ Vim
http://hp.vector.co.jp/authors/VA016670/unix/vi_reference.html vi commands(jp)
http://sci.notbc.org/~weiss/resources/vim/Vim-course/others/vim-1.0.pdf Vim Tutorial and Reference PDF

VIM is a text editor. You have to learn it to manage the server on CLI(command-line interface).

#note

Before you type commands, you should learn VIM usage. The PDF link above will be helpful for your learning.
Try to type “vi”; you can get minimum help.
You should know these commands like ,i,a,,h,j,k,l,x,u,+R,U,ZZ,G,:q,:q!:wq!,yy,dd,p,o,O,w,b,$,,f,t,/,\,n,?

e.g.
#vi command: enter [i] and move the cursor to target and hit key your number
#[ESC] then type <:wq> if you make miss, you can recover hit [ESC][u]
#learn how to use vim at vim tutor.

###option config###
cd
vi .vimrc
#---.vimrc-------
set nocompatible
set fileformats=unix,dos
syntax on
set autoindent
set history=50
set number
set list
set showmatch
highlight Comment ctermfg=LightCyan
set wrap
set shiftwidth=4
#----------------end

1.2.3 Sed


https://www.gnu.org/software/sed/manual/sed.html
https://sed.open-code.club/
https://qiita.com/hirohiro77/items/7fe2f68781c41777e507 how to use ‘sed’

#tips

Stream editor is Sed.

#e.g.

sed -i -e 's/<..full text ..(.*)>/<..replace text..>/g' <..distination file..>
-i inplace
-e expression script
s reguler expression
g copy hold to pattern

#add line top of file

sed -e '1i \
<..str..>\
'

#add lines in the middle of lines

sed -e '/<..line top..>/,/<..line bottom..>/c \
<..insert lines..> \
'

#add line end of file

sed -e '$a \
<..str..>\
'

BusyBox v1.31.1 () multi-call binary.
Usage: sed [-i[SFX]] [-nrE] [-f FILE]… [-e CMD]… [FILE]…
or: sed [-i[SFX]] [-nrE] CMD [FILE]…

-e CMD Add CMD to sed commands to be executed
-f FILE Add FILE contents to sed commands to be executed
-i[SFX] Edit files in-place (otherwise sends to stdout)
Optionally back files up, appending SFX
-n Suppress automatic printing of pattern space
-r,-E Use extended regex syntax

If no -e or -f, the first non-option argument is the sed command string.
The remaining arguments are input files (stdin if none).

1.2.4 Regular expressions


https://murashun.jp/blog/20190215-01.html

It must be so helpful for you.

Learn hard!

need escape\

  • *? [ ‘ ” ` \ $ ; & ( ) | ~ < > # % = [space][tab][cr]

1.3 Disk handling

#mount-unmount
#device detection

dmesg

#well known point

/mnt
/media

#partationing

fdisk just for MBR(old type
gdisk GPT
parted

#format

mkfs -t xfs /dev/vdb

Leave a Reply

Your email address will not be published. Required fields are marked *