SlideShare ist ein Scribd-Unternehmen logo
1 von 74
Downloaden Sie, um offline zu lesen
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
$  man  [section]  <program>  
LS(1)                                                                                User  Commands                                                                                LS(1)
NAME
ls  -­‐ list  directory  contents
SYNOPSIS
ls  [OPTION]...  [FILE]...
DESCRIPTION
List    information    about    the  FILEs  (the  current  directory  by  default).    Sort  entries  alphabeti-­‐
cally if  none  of  -­‐cftuvSUX nor  -­‐-­‐sort  is  specified.
Mandatory  arguments  to  long  options  are  mandatory  for  short  options  too.
-­‐a,  -­‐-­‐all
do  not  ignore  entries  starting  with  .
•
•
•
•
• $  echo  -­‐e  "abcna"
abc
a
• STDIN  (0)
• STDOUT  (1)
• STDERR  (2)
• $  cat  /etc/passwd >  users.txt
(STDOUT)-­‐
• $  cat  /etc/passwd >>  users.txt
(STDOUT)-­‐
• $  mail  -­‐s  "Test  mail"  <  letter.txt
(STDIN)
• $  cat  /etc/passwd 2>  errors.txt
( STDERR)
• $  find  /etc >  /dev/null
( STDOUT)
• $  sh script.sh  >  /dev/null  2>&1
( )
• $  sh script.sh  |  tee  -­‐a  log.txt  |  other_program
( log.txt other_program)
• $  sh script.sh  |  xargs other_program
( other_program )
• |
•
•
• $  cat  /etc/passwd |  program
•
• users.txt   snowman  
$  grep snowman users.txt
• txt   snowman  
$  grep snowman *.txt
• $  ifconfig |  grep 'eth0'  -­‐-­‐color=auto
•
$  grep -­‐r  'some_text'  /etc/
•
$  grep –e  '^Snowman$'  users.txt
•
• $  find  [ ]  [ ]
• -­‐name  
• -­‐perm  
• -­‐type  
• -­‐mtime
• $  find  /etc -­‐name  passwd
•
•
• $  sed [ ]  < >
•
•
•
•
•
•
• passwd 2~5  
$  nl /etc/passwd |  sed '2,5d'
• passwd 5~7  
$  nl  /etc/passwd  |  sed  -­‐n  '5,7p'
•
$  sed  's/ / /g'
• $  ifconfig  enp0s3  |  grep  'inet'  
|  sed  's/^.*inet  //g'  |  sed  's/netmask.*$//g'  
•
• awk ' '  
• awk '{ }'   {}
• awk ' { }'   {}
• sed awk
• tab  
$  last  -­‐n  5  |  awk '{print  $1  "t"  $3}'
• $  free  -­‐h
total              used              free          shared        buffers          cached
Mem:                    7.8G              7.6G              168M                18M              440M              3.0G
-­‐/+  buffers/cache:              4.1G              3.6G
2.0G              232K              2.0G
• $  free  -­‐h  |  awk '/Mem/{print  $3}'
7.6G
• STDIN  
• /tmp core  
$  find  /tmp -­‐name  '*core*' -­‐type  f -­‐print  |  xargs
/bin/rm -­‐f
• /etc 664  
$ find  /etc -­‐perm  -­‐664  |  xargs ls –l
• cat  
• head  
• tail  
• sort  
• more/less  
• nl
• cut  
• uniq
• wc
• $  cat  /proc/loadavg
0.48  0.47  0.55  2/347  9893
• $  cat  /proc/loadavg  |  [...]
0.48
• $  cat  /proc/meminfo
MemTotal:                8138396  kB
MemFree:                  2895168  kB
Buffers:                    599540  kB
...
• $  cat  /proc/meminfo |  [...]
2895168
1. $  cat  /proc/loadavg |  awk '{print  $1}'
2. $  cat  /proc/meminfo |  grep MemFree |  awk '{print  $2}'
• ls
• cd  <path>
• pwd
• file  <file>
• mkdir <folder>
• rmdir <folder>
• touch  <filename>
• ln  <destination>  <source>
$  ls  -­‐al
-­‐rwxr-­‐xr-­‐-­‐ 1  sntc06  sntc06 2.6K  Oct    8    2012  action.php
-­‐rwxr-­‐xr-­‐-­‐
-­‐:  regular  file
d:  directory
l:  symbolic  link
c:  character  device
b:  block  device
s:  socket
p:  named  pipe
$  ls  -­‐al
-­‐rwxr-­‐xr-­‐-­‐ 1  sntc06  sntc06 2.6K  Oct    8    2012  action.php
-­‐rwxr-­‐xr-­‐-­‐
Owner  permission
r:  read
w:  write
x:  execute
Group:
r-­‐x
Others:
r-­‐-­‐
$  ls  -­‐al
-­‐rwxr-­‐xr-­‐-­‐ 1  sntc06  sntc06 2.6K  Oct    8    2012  action.php
-­‐rwxr-­‐xr-­‐-­‐
Owner  permission
r:  100:  4
w:  010:  2
x:  001:  1
-­‐>   754
Example:
$  chmod 644  action.php
$  chmod a+x action.php
$  chmod -­‐w  action.php
$  ls  -­‐al
-­‐rwxr-­‐xr-­‐-­‐ 1  sntc06  sntc06 2.6K  Oct    8    2012  action.php
$  ls  -­‐al
-­‐rwxr-­‐xr-­‐-­‐ 1  sntc06  sntc06 2.6K  Oct    8    2012  action.php
$  ls  -­‐al
-­‐rwxr-­‐xr-­‐-­‐ 1  sntc06  sntc06 2.6K  Oct    8    2012  action.php
•
•
• #  mount  /dev/sdd1  /media/usb-­‐drive
• #  mount  -­‐o  remount,ro -­‐t  ext4  /dev/sda1  /home
-­‐o [ ] -­‐t  [ ]
•
#  umount /media/usb-­‐drive
•
• init /  systemd
•
•
•
•
•
•
•
•
•
• process
$  ps -­‐l
• process
#  ps axu
• process  tree
#  ps axjf
1     2827    2827    2827  ?                      -­‐1  Ss 1003      0:00  SCREEN
2827    2828    2828    2828  pts/4          2836  Ss 1003      0:00    _  /bin/zsh
2828    2836    2836    2828  pts/4          2836  S+        1003      0:00    |      _  /bin/bash  ./start.sh
2836    2837    2836    2828  pts/4          2836  Sl+      1003  207:14    |              _  java  -­‐server  …
2827    3025    3025    3025  pts/8          3025  Ss+      1003      0:00    _  /bin/zsh
root          27850    0.0    0.0  113908    4332  ?                Ss Apr01      0:00  sshd:  sntc06  [priv]
sntc06      27976    0.0    0.0  114048    2080  ?                S        Apr01      0:00  sshd:  sntc06@pts/6
sntc06      27977    0.0    0.0    52076    6388  pts/6        Ss+    Apr01      0:00  -­‐zsh
F  S      UID      PID    PPID    C  PRI    NI  ADDR  SZ  WCHAN    TTY                    TIME  CMD
0  S    1000    8755    8754    0    80      0  -­‐ 12210  sigsus pts/11      00:00:00  zsh
0  R    1000    9082    8755    0    80      0  -­‐ 3383  -­‐ pts/11      00:00:00  ps
•
• Ctrl+Z
• fg
• bg
• jobs  
• shell   &  
$  ping  localhost  &
•
•
No.
1 SIGHUP log  file
2 SIGINT Interrupt  (Ctrl+C)
3 SIGQUIT
9 SIGKILL
15 SIGTERM
18 SIGCONT
19 SIGSTP (Ctrl+Z)
$  man  7  signal
• pid
• kill  [-­‐signal]  <pid>
• PID  5566  
#  kill  5566
#  kill  -­‐15  5566
• PID  5566  
#  kill  -­‐9 5566
• PGID  5566  
#  kill  -­‐1 -­‐5566
( )
• PID
• root   PID
$  pgrep -­‐u  root  -­‐l
• httpd
$  pgrep httpd -­‐l
•
• pkill [-­‐signal]  < >
• httpd
#  pkill httpd
• httpd
#  pkill -­‐9  httpd
•
•
•
• /etc/rcX.d/
• /etc/init.d/
• sysvinit upstart
init
•
$  systemctl
• / /
#  systemctl start/stop/restart  <service>
• /
#  systemctl status/is-­‐enabled  <service>
• /
#  systemctl enable/disable  <service>
root:~/  #  systemctl status  httpd
httpd.service -­‐ The  Apache  HTTP  Server
Loaded:  loaded  (/usr/lib/systemd/system/httpd.service;  enabled)
Active:  active  (running)  since   2015-­‐04-­‐01  16:10:40  CST;  10min  ago
Main  PID:  1221  (httpd)
Status:  "Total  requests:  0;  Current  requests/sec:  0;  Current  traffic:  0  B/sec"
CGroup:  /system.slice/httpd.service
├─1221  /usr/sbin/httpd -­‐DFOREGROUND
├─2475  /usr/sbin/httpd -­‐DFOREGROUND
├─2476  /usr/sbin/httpd -­‐DFOREGROUND
├─2477  /usr/sbin/httpd -­‐DFOREGROUND
├─2478  /usr/sbin/httpd -­‐DFOREGROUND
└─2479  /usr/sbin/httpd -­‐DFOREGROUND
4 01  16:10:37  localhost.localdomain httpd[1221]:  AH00558:  httpd:  ...
4 01  16:10:40  localhost.localdomain systemd[1]:  Started  The  Apache  HTTP  Server.
Hint:  Some  lines  were  ellipsized,  use  -­‐l  to  show  in  full.
•
[Unit]
Description=The  Apache  HTTP  Server
After=network.target remote-­‐fs.target nss-­‐lookup.target
[Service]
Type=notify
EnvironmentFile=/etc/sysconfig/httpd
ExecStart=/usr/sbin/httpd $OPTIONS  -­‐DFOREGROUND
ExecReload=/usr/sbin/httpd $OPTIONS  -­‐k  graceful
ExecStop=/bin/kill  -­‐WINCH  ${MAINPID}
#  We  want  systemd to  give  httpd some  time  to  finish  gracefully,  but  still  want
#  it  to  kill  httpd after  TimeoutStopSec if  something  went  wrong  during  the
#  graceful  stop.  Normally,  Systemd sends  SIGTERM  signal  right  after  the
#  ExecStop,  which  would  kill  httpd.  We  are  sending  useless  SIGCONT  here  to  give
#  httpd time  to  finish.
KillSignal=SIGCONT
PrivateTmp=true
[Install]
WantedBy=multi-­‐user.target
•
• at
• crontab
•
$  crontab -­‐l
•
$  crontab -­‐e
• root  
#  crontab -­‐u  root
root:/dev/  #  at  18:30  2015-­‐04-­‐01
at>  echo  "Happy  April  Fools!"  >  /dev/pts/0
at>  <EOT>
job  2  at  Wed  Apr    1  18:20:00  2015
•
• /etc/crontab,  /etc/cron.d/
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
#m      h    dom mon  dow user    command
0 0 *     * 1 root  /bukkit_backup/backup.sh  >>  /dev/null  2>&1
*/30 8-­‐17 *     * 1-­‐5 root  /root/check_website.sh
•
•
• /etc/cron.daily/
• /etc/cron.weekly/
• /etc/cron.monthly/
#period  in  days      delay  in  minutes      job-­‐identifier      command
1              5              cron.daily nice  run-­‐parts  /etc/cron.daily
7              25            cron.weekly nice  run-­‐parts  /etc/cron.weekly
@monthly  45          cron.monthly nice  run-­‐parts  /etc/cron.monthly
• mariadb
•
•
•
•
•
•
•
•
•
•
•
•
• *.rpm
•
#  rpm  -­‐i package.rpm
•
#  rpm  -­‐U  package.rpm
•
#  rpm  -­‐i package.rpm -­‐-­‐test  -­‐v
•
#  rpm  -­‐e  package
•
#  rpm  -­‐q  -­‐a
•
•
•
•
•
#  yum  check-­‐update
•
#  yum  update  mosh
•
#  yum  install  mosh
•
#  yum  remove  mosh
•
#  yum  list  installed
•
#  yum  search  mosh
•
#  yum  info  mosh
• mariadb
•
•
•
•
• /etc/passwd
•
• /etc/group
•
root:x:0:0:root:/root:/bin/zsh
root:x:0:user1,user2
• /etc/shadow
•
•
•
$  passwd
•
#  passwd sntc06
•
#  useradd [ ]  < >
•
• -­‐m
• -­‐c
• -­‐u UID
• -­‐g GID
• -­‐G
• -­‐s login  shell
• admin
#  groupadd admin
• test
#  groupdel test
• snowman   admin
#  usermod -­‐a  -­‐G  admin  snowman
•
•
$  su -­‐ root  ( login  shell)
$  su ( shell)
• snowman  
$  su snowman
•
•
• snowman  
$  sudo -­‐u  snowman  vim  test.txt
• root  
$  sudo reboot
• root   shell
$  sudo su -­‐
•
•
•
•
##  Allow  root  to  run  any  commands  anywhere
root        ALL=(ALL)              ALL
##  Allows  people  in  group  wheel  to  run  all  commands
%wheel    ALL=(ALL)              ALL
1.
2. sudo
3. su
4. sudo mariadb

Weitere ähnliche Inhalte

Was ist angesagt?

What is suid, sgid and sticky bit
What is suid, sgid and sticky bit  What is suid, sgid and sticky bit
What is suid, sgid and sticky bit Meenu Chopra
 
Opendaylight app development
Opendaylight app developmentOpendaylight app development
Opendaylight app developmentvjanandr
 
Kernel Recipes 2017 - Modern Key Management with GPG - Werner Koch
Kernel Recipes 2017 - Modern Key Management with GPG - Werner KochKernel Recipes 2017 - Modern Key Management with GPG - Werner Koch
Kernel Recipes 2017 - Modern Key Management with GPG - Werner KochAnne Nicolas
 
SSH: Seguranca no Acesso Remoto
SSH: Seguranca no Acesso RemotoSSH: Seguranca no Acesso Remoto
SSH: Seguranca no Acesso RemotoTiago Cruz
 
Getting started with RDO Havana
Getting started with RDO HavanaGetting started with RDO Havana
Getting started with RDO HavanaDan Radez
 
IPv6 for Pentesters
IPv6 for PentestersIPv6 for Pentesters
IPv6 for Pentesterscamsec
 
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven RostedtKernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven RostedtAnne Nicolas
 
Capital onehadoopclass
Capital onehadoopclassCapital onehadoopclass
Capital onehadoopclassDoug Chang
 
Crash_Report_Mechanism_In_Tizen
Crash_Report_Mechanism_In_TizenCrash_Report_Mechanism_In_Tizen
Crash_Report_Mechanism_In_TizenLex Yu
 
Linux Commands - 3
Linux Commands - 3Linux Commands - 3
Linux Commands - 3Kanchilug
 
Analysis of Compromised Linux Server
Analysis of Compromised Linux ServerAnalysis of Compromised Linux Server
Analysis of Compromised Linux Serveranandvaidya
 
/etc/rc.d配下とかのリーディング勉強会
/etc/rc.d配下とかのリーディング勉強会/etc/rc.d配下とかのリーディング勉強会
/etc/rc.d配下とかのリーディング勉強会Naoya Nakazawa
 
Importance of sshfp and configuring sshfp for network devices
Importance of sshfp and configuring sshfp for network devicesImportance of sshfp and configuring sshfp for network devices
Importance of sshfp and configuring sshfp for network devicesMuhammad Moinur Rahman
 
Importance of SSHFP for Network Devices
Importance of SSHFP for Network DevicesImportance of SSHFP for Network Devices
Importance of SSHFP for Network DevicesAPNIC
 
Triangle OpenStack meetup 09 2013
Triangle OpenStack meetup 09 2013Triangle OpenStack meetup 09 2013
Triangle OpenStack meetup 09 2013Dan Radez
 
Kernel Recipes 2017: Performance Analysis with BPF
Kernel Recipes 2017: Performance Analysis with BPFKernel Recipes 2017: Performance Analysis with BPF
Kernel Recipes 2017: Performance Analysis with BPFBrendan Gregg
 
YOW2020 Linux Systems Performance
YOW2020 Linux Systems PerformanceYOW2020 Linux Systems Performance
YOW2020 Linux Systems PerformanceBrendan Gregg
 
Debugging Ruby Systems
Debugging Ruby SystemsDebugging Ruby Systems
Debugging Ruby SystemsEngine Yard
 
Debugging Ruby
Debugging RubyDebugging Ruby
Debugging RubyAman Gupta
 

Was ist angesagt? (20)

What is suid, sgid and sticky bit
What is suid, sgid and sticky bit  What is suid, sgid and sticky bit
What is suid, sgid and sticky bit
 
Opendaylight app development
Opendaylight app developmentOpendaylight app development
Opendaylight app development
 
Kernel Recipes 2017 - Modern Key Management with GPG - Werner Koch
Kernel Recipes 2017 - Modern Key Management with GPG - Werner KochKernel Recipes 2017 - Modern Key Management with GPG - Werner Koch
Kernel Recipes 2017 - Modern Key Management with GPG - Werner Koch
 
SSH: Seguranca no Acesso Remoto
SSH: Seguranca no Acesso RemotoSSH: Seguranca no Acesso Remoto
SSH: Seguranca no Acesso Remoto
 
Getting started with RDO Havana
Getting started with RDO HavanaGetting started with RDO Havana
Getting started with RDO Havana
 
IPv6 for Pentesters
IPv6 for PentestersIPv6 for Pentesters
IPv6 for Pentesters
 
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven RostedtKernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
Kernel Recipes 2017 - Understanding the Linux kernel via ftrace - Steven Rostedt
 
Capital onehadoopclass
Capital onehadoopclassCapital onehadoopclass
Capital onehadoopclass
 
Crash_Report_Mechanism_In_Tizen
Crash_Report_Mechanism_In_TizenCrash_Report_Mechanism_In_Tizen
Crash_Report_Mechanism_In_Tizen
 
Linux Commands - 3
Linux Commands - 3Linux Commands - 3
Linux Commands - 3
 
Analysis of Compromised Linux Server
Analysis of Compromised Linux ServerAnalysis of Compromised Linux Server
Analysis of Compromised Linux Server
 
/etc/rc.d配下とかのリーディング勉強会
/etc/rc.d配下とかのリーディング勉強会/etc/rc.d配下とかのリーディング勉強会
/etc/rc.d配下とかのリーディング勉強会
 
Importance of sshfp and configuring sshfp for network devices
Importance of sshfp and configuring sshfp for network devicesImportance of sshfp and configuring sshfp for network devices
Importance of sshfp and configuring sshfp for network devices
 
Importance of SSHFP for Network Devices
Importance of SSHFP for Network DevicesImportance of SSHFP for Network Devices
Importance of SSHFP for Network Devices
 
Triangle OpenStack meetup 09 2013
Triangle OpenStack meetup 09 2013Triangle OpenStack meetup 09 2013
Triangle OpenStack meetup 09 2013
 
Kernel Recipes 2017: Performance Analysis with BPF
Kernel Recipes 2017: Performance Analysis with BPFKernel Recipes 2017: Performance Analysis with BPF
Kernel Recipes 2017: Performance Analysis with BPF
 
Proxy arp
Proxy arpProxy arp
Proxy arp
 
YOW2020 Linux Systems Performance
YOW2020 Linux Systems PerformanceYOW2020 Linux Systems Performance
YOW2020 Linux Systems Performance
 
Debugging Ruby Systems
Debugging Ruby SystemsDebugging Ruby Systems
Debugging Ruby Systems
 
Debugging Ruby
Debugging RubyDebugging Ruby
Debugging Ruby
 

Andere mochten auch

Groovy Introduction for Java Programmer
Groovy Introduction for Java ProgrammerGroovy Introduction for Java Programmer
Groovy Introduction for Java ProgrammerLi Ding
 
Nagios的安装部署和与cacti的整合(linuxtone)
Nagios的安装部署和与cacti的整合(linuxtone)Nagios的安装部署和与cacti的整合(linuxtone)
Nagios的安装部署和与cacti的整合(linuxtone)Yiwei Ma
 
Cheatsheet: Hex file headers and regex
Cheatsheet: Hex file headers and regexCheatsheet: Hex file headers and regex
Cheatsheet: Hex file headers and regexKasper de Waard
 
Web_DBの監視
Web_DBの監視Web_DBの監視
Web_DBの監視ii012014
 
配布用Cacti running with cherokee
配布用Cacti running with cherokee配布用Cacti running with cherokee
配布用Cacti running with cherokeeyut148atgmaildotcom
 
Tmux quick-reference
Tmux quick-referenceTmux quick-reference
Tmux quick-referenceRamesh Kumar
 
Webサーバ勉強会#5mod sedについて
Webサーバ勉強会#5mod sedについてWebサーバ勉強会#5mod sedについて
Webサーバ勉強会#5mod sedについてyut148atgmaildotcom
 
Sorting techniques in Perl
Sorting techniques in PerlSorting techniques in Perl
Sorting techniques in PerlYogesh Sawant
 
Hadoopp0f 150325024427-conversion-gate01
Hadoopp0f 150325024427-conversion-gate01Hadoopp0f 150325024427-conversion-gate01
Hadoopp0f 150325024427-conversion-gate01Kalyan Hadoop
 
Unix interview questions
Unix interview questionsUnix interview questions
Unix interview questionsKalyan Hadoop
 
shell script introduction
shell script introductionshell script introduction
shell script introductionJie Jin
 
Recommender system
Recommender systemRecommender system
Recommender systemJie Jin
 
Course 102: Lecture 13: Regular Expressions
Course 102: Lecture 13: Regular Expressions Course 102: Lecture 13: Regular Expressions
Course 102: Lecture 13: Regular Expressions Ahmed El-Arabawy
 
sed -- A programmer's perspective
sed -- A programmer's perspectivesed -- A programmer's perspective
sed -- A programmer's perspectiveLi Ding
 
Orienit hadoop practical cluster setup screenshots
Orienit hadoop practical cluster setup screenshotsOrienit hadoop practical cluster setup screenshots
Orienit hadoop practical cluster setup screenshotsKalyan Hadoop
 

Andere mochten auch (20)

Groovy Introduction for Java Programmer
Groovy Introduction for Java ProgrammerGroovy Introduction for Java Programmer
Groovy Introduction for Java Programmer
 
Nagios的安装部署和与cacti的整合(linuxtone)
Nagios的安装部署和与cacti的整合(linuxtone)Nagios的安装部署和与cacti的整合(linuxtone)
Nagios的安装部署和与cacti的整合(linuxtone)
 
Donate Organs
Donate OrgansDonate Organs
Donate Organs
 
Cheatsheet: Hex file headers and regex
Cheatsheet: Hex file headers and regexCheatsheet: Hex file headers and regex
Cheatsheet: Hex file headers and regex
 
Web_DBの監視
Web_DBの監視Web_DBの監視
Web_DBの監視
 
配布用Cacti running with cherokee
配布用Cacti running with cherokee配布用Cacti running with cherokee
配布用Cacti running with cherokee
 
Tmux quick-reference
Tmux quick-referenceTmux quick-reference
Tmux quick-reference
 
Webサーバ勉強会#5mod sedについて
Webサーバ勉強会#5mod sedについてWebサーバ勉強会#5mod sedについて
Webサーバ勉強会#5mod sedについて
 
RHEL roadmap
RHEL roadmapRHEL roadmap
RHEL roadmap
 
UNIX SHELL IN DBA EVERYDAY
UNIX SHELL IN DBA EVERYDAYUNIX SHELL IN DBA EVERYDAY
UNIX SHELL IN DBA EVERYDAY
 
Cacti manual
Cacti manualCacti manual
Cacti manual
 
Sorting techniques in Perl
Sorting techniques in PerlSorting techniques in Perl
Sorting techniques in Perl
 
Hadoopp0f 150325024427-conversion-gate01
Hadoopp0f 150325024427-conversion-gate01Hadoopp0f 150325024427-conversion-gate01
Hadoopp0f 150325024427-conversion-gate01
 
Unix interview questions
Unix interview questionsUnix interview questions
Unix interview questions
 
Url
UrlUrl
Url
 
shell script introduction
shell script introductionshell script introduction
shell script introduction
 
Recommender system
Recommender systemRecommender system
Recommender system
 
Course 102: Lecture 13: Regular Expressions
Course 102: Lecture 13: Regular Expressions Course 102: Lecture 13: Regular Expressions
Course 102: Lecture 13: Regular Expressions
 
sed -- A programmer's perspective
sed -- A programmer's perspectivesed -- A programmer's perspective
sed -- A programmer's perspective
 
Orienit hadoop practical cluster setup screenshots
Orienit hadoop practical cluster setup screenshotsOrienit hadoop practical cluster setup screenshots
Orienit hadoop practical cluster setup screenshots
 

Ähnlich wie Linux 系統管理與安全:基本 Linux 系統知識

Useful linux-commands
Useful linux-commandsUseful linux-commands
Useful linux-commandsHimani Singh
 
How to admin
How to adminHow to admin
How to adminyalegko
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLCommand Prompt., Inc
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLMark Wong
 
PFIセミナー資料 H27.10.22
PFIセミナー資料 H27.10.22PFIセミナー資料 H27.10.22
PFIセミナー資料 H27.10.22Yuya Takei
 
Linux Du Jour
Linux Du JourLinux Du Jour
Linux Du Jourmwedgwood
 
Keynote 1 - Engineering Software Analytics Studies
Keynote 1 - Engineering Software Analytics StudiesKeynote 1 - Engineering Software Analytics Studies
Keynote 1 - Engineering Software Analytics StudiesESEM 2014
 
guider: a system-wide performance analyzer
guider: a system-wide performance analyzerguider: a system-wide performance analyzer
guider: a system-wide performance analyzerPeace Lee
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLMark Wong
 
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation CenterDUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation CenterAndrey Kudryavtsev
 
Linux Common Command
Linux Common CommandLinux Common Command
Linux Common CommandJeff Yang
 
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak   CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak PROIDEA
 
Miscelaneous Debris
Miscelaneous DebrisMiscelaneous Debris
Miscelaneous Debrisfrewmbot
 
Mac OS X Lion で作る WordPress local 環境
Mac OS X Lion で作る WordPress local 環境Mac OS X Lion で作る WordPress local 環境
Mac OS X Lion で作る WordPress local 環境Yuriko IKEDA
 
Installing odoo v8 from github
Installing odoo v8 from githubInstalling odoo v8 from github
Installing odoo v8 from githubAntony Gitomeh
 

Ähnlich wie Linux 系統管理與安全:基本 Linux 系統知識 (20)

Linux basic3
Linux basic3Linux basic3
Linux basic3
 
Useful linux-commands
Useful linux-commandsUseful linux-commands
Useful linux-commands
 
Backups
BackupsBackups
Backups
 
Basics of unix
Basics of unixBasics of unix
Basics of unix
 
How to admin
How to adminHow to admin
How to admin
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
 
PFIセミナー資料 H27.10.22
PFIセミナー資料 H27.10.22PFIセミナー資料 H27.10.22
PFIセミナー資料 H27.10.22
 
Linux Du Jour
Linux Du JourLinux Du Jour
Linux Du Jour
 
Keynote 1 - Engineering Software Analytics Studies
Keynote 1 - Engineering Software Analytics StudiesKeynote 1 - Engineering Software Analytics Studies
Keynote 1 - Engineering Software Analytics Studies
 
Malcon2017
Malcon2017Malcon2017
Malcon2017
 
guider: a system-wide performance analyzer
guider: a system-wide performance analyzerguider: a system-wide performance analyzer
guider: a system-wide performance analyzer
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
 
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation CenterDUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
DUG'20: 12 - DAOS in Lenovo’s HPC Innovation Center
 
Linux Common Command
Linux Common CommandLinux Common Command
Linux Common Command
 
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak   CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
CONFidence 2015: DTrace + OSX = Fun - Andrzej Dyjak
 
Hanganalyze presentation
Hanganalyze presentationHanganalyze presentation
Hanganalyze presentation
 
Miscelaneous Debris
Miscelaneous DebrisMiscelaneous Debris
Miscelaneous Debris
 
Mac OS X Lion で作る WordPress local 環境
Mac OS X Lion で作る WordPress local 環境Mac OS X Lion で作る WordPress local 環境
Mac OS X Lion で作る WordPress local 環境
 
Installing odoo v8 from github
Installing odoo v8 from githubInstalling odoo v8 from github
Installing odoo v8 from github
 

Kürzlich hochgeladen

New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 

Kürzlich hochgeladen (20)

New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 

Linux 系統管理與安全:基本 Linux 系統知識

  • 1.
  • 4.
  • 11.
  • 12. • • • $  man  [section]  <program>   LS(1)                                                                                User  Commands                                                                                LS(1) NAME ls  -­‐ list  directory  contents SYNOPSIS ls  [OPTION]...  [FILE]... DESCRIPTION List    information    about    the  FILEs  (the  current  directory  by  default).    Sort  entries  alphabeti-­‐ cally if  none  of  -­‐cftuvSUX nor  -­‐-­‐sort  is  specified. Mandatory  arguments  to  long  options  are  mandatory  for  short  options  too. -­‐a,  -­‐-­‐all do  not  ignore  entries  starting  with  .
  • 13. • • • • • $  echo  -­‐e  "abcna" abc a
  • 14. • STDIN  (0) • STDOUT  (1) • STDERR  (2) • $  cat  /etc/passwd >  users.txt (STDOUT)-­‐ • $  cat  /etc/passwd >>  users.txt (STDOUT)-­‐ • $  mail  -­‐s  "Test  mail"  <  letter.txt (STDIN)
  • 15. • $  cat  /etc/passwd 2>  errors.txt ( STDERR) • $  find  /etc >  /dev/null ( STDOUT) • $  sh script.sh  >  /dev/null  2>&1 ( ) • $  sh script.sh  |  tee  -­‐a  log.txt  |  other_program ( log.txt other_program) • $  sh script.sh  |  xargs other_program ( other_program )
  • 16. • | • • • $  cat  /etc/passwd |  program
  • 17. • • users.txt   snowman   $  grep snowman users.txt • txt   snowman   $  grep snowman *.txt • $  ifconfig |  grep 'eth0'  -­‐-­‐color=auto • $  grep -­‐r  'some_text'  /etc/ • $  grep –e  '^Snowman$'  users.txt
  • 18. • • $  find  [ ]  [ ] • -­‐name   • -­‐perm   • -­‐type   • -­‐mtime • $  find  /etc -­‐name  passwd
  • 19. • • • $  sed [ ]  < > • • • • • •
  • 20. • passwd 2~5   $  nl /etc/passwd |  sed '2,5d' • passwd 5~7   $  nl  /etc/passwd  |  sed  -­‐n  '5,7p' • $  sed  's/ / /g' • $  ifconfig  enp0s3  |  grep  'inet'   |  sed  's/^.*inet  //g'  |  sed  's/netmask.*$//g'  
  • 21. • • awk ' '   • awk '{ }'   {} • awk ' { }'   {} • sed awk
  • 22. • tab   $  last  -­‐n  5  |  awk '{print  $1  "t"  $3}' • $  free  -­‐h total              used              free          shared        buffers          cached Mem:                    7.8G              7.6G              168M                18M              440M              3.0G -­‐/+  buffers/cache:              4.1G              3.6G 2.0G              232K              2.0G • $  free  -­‐h  |  awk '/Mem/{print  $3}' 7.6G
  • 23. • STDIN   • /tmp core   $  find  /tmp -­‐name  '*core*' -­‐type  f -­‐print  |  xargs /bin/rm -­‐f • /etc 664   $ find  /etc -­‐perm  -­‐664  |  xargs ls –l
  • 24. • cat   • head   • tail   • sort   • more/less   • nl • cut   • uniq • wc
  • 25. • $  cat  /proc/loadavg 0.48  0.47  0.55  2/347  9893 • $  cat  /proc/loadavg  |  [...] 0.48 • $  cat  /proc/meminfo MemTotal:                8138396  kB MemFree:                  2895168  kB Buffers:                    599540  kB ... • $  cat  /proc/meminfo |  [...] 2895168
  • 26. 1. $  cat  /proc/loadavg |  awk '{print  $1}' 2. $  cat  /proc/meminfo |  grep MemFree |  awk '{print  $2}'
  • 27.
  • 28. • ls • cd  <path> • pwd • file  <file> • mkdir <folder> • rmdir <folder> • touch  <filename> • ln  <destination>  <source>
  • 29. $  ls  -­‐al -­‐rwxr-­‐xr-­‐-­‐ 1  sntc06  sntc06 2.6K  Oct    8    2012  action.php -­‐rwxr-­‐xr-­‐-­‐ -­‐:  regular  file d:  directory l:  symbolic  link c:  character  device b:  block  device s:  socket p:  named  pipe
  • 30. $  ls  -­‐al -­‐rwxr-­‐xr-­‐-­‐ 1  sntc06  sntc06 2.6K  Oct    8    2012  action.php -­‐rwxr-­‐xr-­‐-­‐ Owner  permission r:  read w:  write x:  execute Group: r-­‐x Others: r-­‐-­‐
  • 31. $  ls  -­‐al -­‐rwxr-­‐xr-­‐-­‐ 1  sntc06  sntc06 2.6K  Oct    8    2012  action.php -­‐rwxr-­‐xr-­‐-­‐ Owner  permission r:  100:  4 w:  010:  2 x:  001:  1 -­‐>   754 Example: $  chmod 644  action.php $  chmod a+x action.php $  chmod -­‐w  action.php
  • 32. $  ls  -­‐al -­‐rwxr-­‐xr-­‐-­‐ 1  sntc06  sntc06 2.6K  Oct    8    2012  action.php
  • 33. $  ls  -­‐al -­‐rwxr-­‐xr-­‐-­‐ 1  sntc06  sntc06 2.6K  Oct    8    2012  action.php
  • 34. $  ls  -­‐al -­‐rwxr-­‐xr-­‐-­‐ 1  sntc06  sntc06 2.6K  Oct    8    2012  action.php
  • 35. • • • #  mount  /dev/sdd1  /media/usb-­‐drive • #  mount  -­‐o  remount,ro -­‐t  ext4  /dev/sda1  /home -­‐o [ ] -­‐t  [ ] • #  umount /media/usb-­‐drive
  • 36.
  • 37. • • init /  systemd • • • • • • •
  • 38.
  • 39.
  • 40. • process $  ps -­‐l • process #  ps axu • process  tree #  ps axjf 1     2827    2827    2827  ?                      -­‐1  Ss 1003      0:00  SCREEN 2827    2828    2828    2828  pts/4          2836  Ss 1003      0:00    _  /bin/zsh 2828    2836    2836    2828  pts/4          2836  S+        1003      0:00    |      _  /bin/bash  ./start.sh 2836    2837    2836    2828  pts/4          2836  Sl+      1003  207:14    |              _  java  -­‐server  … 2827    3025    3025    3025  pts/8          3025  Ss+      1003      0:00    _  /bin/zsh root          27850    0.0    0.0  113908    4332  ?                Ss Apr01      0:00  sshd:  sntc06  [priv] sntc06      27976    0.0    0.0  114048    2080  ?                S        Apr01      0:00  sshd:  sntc06@pts/6 sntc06      27977    0.0    0.0    52076    6388  pts/6        Ss+    Apr01      0:00  -­‐zsh F  S      UID      PID    PPID    C  PRI    NI  ADDR  SZ  WCHAN    TTY                    TIME  CMD 0  S    1000    8755    8754    0    80      0  -­‐ 12210  sigsus pts/11      00:00:00  zsh 0  R    1000    9082    8755    0    80      0  -­‐ 3383  -­‐ pts/11      00:00:00  ps
  • 41.
  • 42. • Ctrl+Z • fg • bg • jobs   • shell   &   $  ping  localhost  &
  • 43. • • No. 1 SIGHUP log  file 2 SIGINT Interrupt  (Ctrl+C) 3 SIGQUIT 9 SIGKILL 15 SIGTERM 18 SIGCONT 19 SIGSTP (Ctrl+Z) $  man  7  signal
  • 44. • pid • kill  [-­‐signal]  <pid> • PID  5566   #  kill  5566 #  kill  -­‐15  5566 • PID  5566   #  kill  -­‐9 5566 • PGID  5566   #  kill  -­‐1 -­‐5566 ( )
  • 45. • PID • root   PID $  pgrep -­‐u  root  -­‐l • httpd $  pgrep httpd -­‐l
  • 46. • • pkill [-­‐signal]  < > • httpd #  pkill httpd • httpd #  pkill -­‐9  httpd
  • 47.
  • 48.
  • 50. • sysvinit upstart init • $  systemctl • / / #  systemctl start/stop/restart  <service> • / #  systemctl status/is-­‐enabled  <service> • / #  systemctl enable/disable  <service>
  • 51. root:~/  #  systemctl status  httpd httpd.service -­‐ The  Apache  HTTP  Server Loaded:  loaded  (/usr/lib/systemd/system/httpd.service;  enabled) Active:  active  (running)  since   2015-­‐04-­‐01  16:10:40  CST;  10min  ago Main  PID:  1221  (httpd) Status:  "Total  requests:  0;  Current  requests/sec:  0;  Current  traffic:  0  B/sec" CGroup:  /system.slice/httpd.service ├─1221  /usr/sbin/httpd -­‐DFOREGROUND ├─2475  /usr/sbin/httpd -­‐DFOREGROUND ├─2476  /usr/sbin/httpd -­‐DFOREGROUND ├─2477  /usr/sbin/httpd -­‐DFOREGROUND ├─2478  /usr/sbin/httpd -­‐DFOREGROUND └─2479  /usr/sbin/httpd -­‐DFOREGROUND 4 01  16:10:37  localhost.localdomain httpd[1221]:  AH00558:  httpd:  ... 4 01  16:10:40  localhost.localdomain systemd[1]:  Started  The  Apache  HTTP  Server. Hint:  Some  lines  were  ellipsized,  use  -­‐l  to  show  in  full.
  • 52. • [Unit] Description=The  Apache  HTTP  Server After=network.target remote-­‐fs.target nss-­‐lookup.target [Service] Type=notify EnvironmentFile=/etc/sysconfig/httpd ExecStart=/usr/sbin/httpd $OPTIONS  -­‐DFOREGROUND ExecReload=/usr/sbin/httpd $OPTIONS  -­‐k  graceful ExecStop=/bin/kill  -­‐WINCH  ${MAINPID} #  We  want  systemd to  give  httpd some  time  to  finish  gracefully,  but  still  want #  it  to  kill  httpd after  TimeoutStopSec if  something  went  wrong  during  the #  graceful  stop.  Normally,  Systemd sends  SIGTERM  signal  right  after  the #  ExecStop,  which  would  kill  httpd.  We  are  sending  useless  SIGCONT  here  to  give #  httpd time  to  finish. KillSignal=SIGCONT PrivateTmp=true [Install] WantedBy=multi-­‐user.target
  • 53. • • at • crontab • $  crontab -­‐l • $  crontab -­‐e • root   #  crontab -­‐u  root root:/dev/  #  at  18:30  2015-­‐04-­‐01 at>  echo  "Happy  April  Fools!"  >  /dev/pts/0 at>  <EOT> job  2  at  Wed  Apr    1  18:20:00  2015
  • 54. • • /etc/crontab,  /etc/cron.d/ SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root #m      h    dom mon  dow user    command 0 0 *     * 1 root  /bukkit_backup/backup.sh  >>  /dev/null  2>&1 */30 8-­‐17 *     * 1-­‐5 root  /root/check_website.sh
  • 55. • • • /etc/cron.daily/ • /etc/cron.weekly/ • /etc/cron.monthly/ #period  in  days      delay  in  minutes      job-­‐identifier      command 1              5              cron.daily nice  run-­‐parts  /etc/cron.daily 7              25            cron.weekly nice  run-­‐parts  /etc/cron.weekly @monthly  45          cron.monthly nice  run-­‐parts  /etc/cron.monthly
  • 57.
  • 60. • *.rpm • #  rpm  -­‐i package.rpm • #  rpm  -­‐U  package.rpm • #  rpm  -­‐i package.rpm -­‐-­‐test  -­‐v • #  rpm  -­‐e  package • #  rpm  -­‐q  -­‐a
  • 62. • #  yum  check-­‐update • #  yum  update  mosh • #  yum  install  mosh • #  yum  remove  mosh
  • 63. • #  yum  list  installed • #  yum  search  mosh • #  yum  info  mosh
  • 65.
  • 69. • #  useradd [ ]  < > • • -­‐m • -­‐c • -­‐u UID • -­‐g GID • -­‐G • -­‐s login  shell
  • 70. • admin #  groupadd admin • test #  groupdel test • snowman   admin #  usermod -­‐a  -­‐G  admin  snowman
  • 71. • • $  su -­‐ root  ( login  shell) $  su ( shell) • snowman   $  su snowman
  • 72. • • • snowman   $  sudo -­‐u  snowman  vim  test.txt • root   $  sudo reboot • root   shell $  sudo su -­‐
  • 73. • • • • ##  Allow  root  to  run  any  commands  anywhere root        ALL=(ALL)              ALL ##  Allows  people  in  group  wheel  to  run  all  commands %wheel    ALL=(ALL)              ALL
  • 74. 1. 2. sudo 3. su 4. sudo mariadb