I will write what I learned about Linux.
・ Mechanism to start the service --init: SysVinit (System File Init) Conventional --systemd: Adopted in current Linux
-Daemon (process that is always running in the background) --systemd (main) --systemd-journald (journal management process, log management) --systemd-logind (login process) --systemd-udevd (device dynamic detection)
・ Unit (processing unit) --Controlled by systemctl command --Type ・ Service (start various services) httpd, sshd, etc. ・ Device -Mount (file system) / etc / fstab ・ Swap (Enable swap area. Disk to memory) ・ Target (group multiple units)
・ Start, stop, restart ・ Status ・ Is-active ・ Enable, disable (automatic start) ・ List-units -List-unit-files (list of unit-file, status, etc.) ・ List-dependencies
[Systemd startup order] -Default.target is called first. Associate with ・ Lambert (init) and target (systemd) 0、poweroff.target
$ systemctl isolate rescue.target
shutdown -h +10 "this host will shutdown in 10 minutes"
-option
・ H(halt)Stop
-r(reboot)Reboot
-k(test)Test without stopping
・-c(cancel)Shut down waiting for countdown
-f(no fsck)Do not check files on reboot
-F(fsck)Check files on reboot
-Execute the command to shut down after 15 minutes and cancel -h (halt / stop) + minutes "message"
$ su -
# shutdown in 15 "this host will shutdown in 15 minutes!!"
# shutdown -c
-Similar commands Stop ・ Halt, poweroff, init 0 ・ Systemctl poweroff target Reboot ・ Reboot, shutdown reboot, init6 -Systemctl reboot.target notification ・ Wall (Notify all at once without stopping)
# wall "this host will stop 20:00 p.m."
・ From process creation to extinction
-Ps command to check the process --PID: Process ID
options for the ps command ・ BSD format --a (all), f (parent-child relationship), l (details), x (no terminal) --pstree can substitute f
-Unix format --- e (all), -f (details), -l (details)
Process management related commands ・ Ppgrep (search) ・ Top (status every 3 seconds) ・ Uptime ・ Free (free memory)
-Kill option PID /% job num. - 1 (HUP)hang up - 2 (INT)interrupt ―― 9 (KILL) kill / forced termination --15 (TERM) terminate / end - 20 (TSTP)suspend(Ctrl+D)
· Killall process name · Pkill process name
r = 4 w = 2 x = 1
rwxr-xr-x (4+2+1)(4+0+1)(4+0+1) = 755
Change of owner / group / authority ・ Chown - change owner ・ Chgrp - change group ・ Chmod - change mode
# chmod u-r hello.txt
# chmod u+r hello.txt
・ Tar command d (tape archive) --Option ・ C (create) ・ X (expansion) ・ T (information display) ・ V (verbose) ・ F (filename) ・ Z (compressed with gunzip) --Often use cvzf (created) and xvzf / xzf
・ Cpio, dd command
・ The role of the shell --Accept user input and instruct the kernel
・ Check the type of shell
echo $SHELL
env | grep SHELL
・ Check LANG
echo $LANG
・ PATH variable
PATH=$PATH:PATH you want to add
PATH=$PATH:/home/h/temp
-Reflect shell variables in environment variables Shell variables cannot be referenced by child processes Environment variables can be referenced by another child process
・ Say_hello
・ Man [option] [section] keyword - -a(all) --- f (exact match) fully matched --- k (partial match) keyword match
・ Cat: concatenate --- n: Line number display ・ The nl command can be used as a substitute. --Concatenate the contents of the file and output ・ Head / tail --Number of lines, -n Number of lines --- f (continuous display)
·redirect --Write mode -Command> File (Overwrite) ・ Command >> File (append) --Option ・ Command 2> File -Command> File 2> & 1 · Command $ file -Command << EOF> file
-Output to both standard output and file
· Command | tee file name --Inject the execution result of the first command into the tee command with a pipe (|) --Output to standard output and file
-Use the command execution result as the argument of the next command
・ Standard on Linux / Unix --Required for system management work and server settings
・ Two types of modes --Command mode <=> Input mode --Command mode is search, delete, copy, paste --Input mode (switch between i, a, o) Text input
・ H, j, k, l --Left, bottom, top, right
・ Move --w (beginning of word), b (previous word) --e (end of word, end) --0 (beginning of line), $ (end of line)
・ Search -/ kw, n (backward search) ――? kw, N (forward search)
・ Cw (word replacement), c $ (until the end of line) ・ Y (copy), yy (line copy) ・ Cw (delete one character) ・ D (delete), dd (line), dw (word), d $ (end of line) ・ P (paste) ・ U (undo) ・ R File name (insert file contents)
・ Three special permissions
・ Communication protocol (one of the rules) --Technical standards such as communication procedures and data formats ・ Proposed and standardized by IEEE, IETF, etc. --Send / receive in packet (data division, header addition)
・ Four more information is stored in the header --Network interface layer ・ Ethernet, PPP ,,, --Internet layer ・ IP, ICMP (* ping), ARP (MAC address) --Transport layer ・ TCP, UDP (* streaming) --Application layer ・ FTP, SSH, Telnet, DNS, HTTP, IMAP4, POP3 ,,,
・ TCP confirms the arrival of data --Retransmit packet if insufficient
・ Packet transmission unilaterally without checking UDP --Highly real-time applications such as video distribution
-Host is identified by IP address -Communication using different communication ports (/ etc / services)
Recommended Posts