RHCSA课程培训第二天

第二天

RHEL 7.0的安装

第一步:配置虚拟机的网络模式为仅主机模式

第二步:配置IP地址为172.25.0.0/16网段的地址

第三步:找到此路径http://172.25.0.254/content/rhel7.0/x86_64/isos/rhel-server-7.0-x86_64-dvd.iso

第四步:通过winscp软件下载,用户名为root密码为Asimov

[root@localhost ~]#vim /etc/udev/rules.d/60-net.rules

ACTION=="add", SUBSYSTEM=="net", DRIVERS=="?*", ATTR{address}=="52:54:00:00:00:0a", PROGRAM="/lib/udev/rename_device", NAME="eth0"


第五章 管理本地的Linux用户和组

[root@localhost ~]# id root                          #查看root的UID、GID

uid=0(root) gid=0(root) groups=0(root)

[root@localhost ~]# grep ^root /etc/passwd                #查询以root开头的行

root:x:0:0:root:/root:/bin/bash

[root@localhost Desktop]# grep -E '^student|^root' /etc/passwd   #查询以root、student开头的行

root:x:0:0:root:/root:/bin/bash

student:x:1000:1000:Student User:/home/student:/bin/bash


/etc/passwd:   username password userid groupid usergroup homedirectory shell 

/etc/group:    groupname password groupid groupg


在命令行模式下:

ctrl+a:光标移至行首

ctrl+e:光标移动行尾


普通用户模式下新建用户的方法

[root@localhost ~]# chmod u+w /etc/sudoers         #添加写权限

[root@localhost ~]# vim /etc/sudoers             #添加第99行的内容

98 root    ALL=(ALL)       ALL

99 studnet ALL=(ALL)       ALL

[root@localhost ~]# chmod u-w /etc/sudoers         #去掉写权限

[root@localhost Desktop]#su - student            #切换到student用户

Last login: Sun Sep 13 11:15:44 CST 2015 on pts/1

[student@localhost ~]$sudo useradd zj   

We trust you have received the usual lecture from the local System

Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.

    #2) Think before you type.

    #3) With great power comes great responsibility.

[sudo] password for student:                     #输入student的密码 

[student@localhost ~]$ id zj                     #验证添加结果                     

uid=1001(zj) gid=1001(zj) groups=1001(zj)


修改用户密码方法

推荐用法:

[root@localhost Desktop]# passwd zj

Changing password for user zj.

New password: 

BAD PASSWORD: The password fails the dictionary check - it is too simplistic/systematic

Retype new password: 

passwd: all authentication tokens updated successfully.


方法1:

[root@localhost ~]# (echo sa123456; echo sa123456)|passwd zj   #修改zj用户的密码

Changing password for user zj.

New password: BAD PASSWORD: The password is a palindrome

Retype new password: passwd: all authentication tokens updated successfully.


方法2:

[root@localhost ~]# passwd --stdin student

Changing password for user student.

123456

passwd: all authentication tokens updated successfully.


方法3:

[root@localhost ~]# echo "sa123456" |passwd  --stdin zj

Changing password for user zj.

passwd: all authentication tokens updated successfully.


用户权限登录目录:/etc/login.defs

[root@localhost ~]# grep \# /etc/login.defs             #显示login.defs包含#号的行

[root@localhost ~]# grep -v \# /etc/login.defs           #显示login.defs不包含#号的行

[root@localhost ~]# grep -v \# /etc/login.defs|grep -v ^$   #显示login.defs不包含#号与空白行的行


root用户的umask为0022:

file=666-umask=644

folder=777-umask=755

如下:

[root@localhost ~]# touch 123.txt&&mkdir 123

[root@localhost ~]# ll -d 123.txt 123

drwxr-xr-x. 2 root root 6 Sep 13 11:51 123

-rw-r--r--. 1 root root 0 Sep 13 11:51 123.txt



普通用户的umask为0002:

file=666-umask=664

folder=777-umask=775

如下:

[student@localhost ~]$ touch test.txt&&mkdir test

[student@localhost ~]$ ll -d test.txt test

drwxrwxr-x. 2 student student 6 Sep 13 11:50 test

-rw-rw-r--. 1 student student 0 Sep 13 11:50 test.txt


useradd:

-d 指定创建用户时的家目录

-G 指定用户隶属于哪个组 usermod -G zj ql

-g 指定用户的原始组


usermod:

-d 修改用户的家目录

-G 修改指定用户隶属于哪个组

-g 修改指定用户的原始组

-l 将原始用户修改为其它用户

[root@localhost ~]# useradd zj

[root@localhost ~]# usermod -l alice zj

[root@localhost ~]# id alice

uid=1001(alice) gid=1001(zj) groups=1001(zj)


userdel:

-r 删除用户连带它的家目录


userdel命令不加-r的区别  

[root@localhost Desktop]#useradd zfl

[root@localhost Desktop]#ls -ld /home/zfl

drwx------. 4 zfl zfl 88 Sep 19 09:20 /home/zfl

[root@localhost Desktop]#userdel zfl

[root@localhost Desktop]#id zfl

id: zfl: no such user

[root@localhost Desktop]#ls -ld /home/zfl

drwx------. 4 1001 1001 88 Sep 19 09:20 /home/zfl

[root@localhost Desktop]#useradd lx

[root@localhost Desktop]#ls -ld /home/zfl /home/lx

drwx------. 4 lx lx 88 Sep 19 09:21 /home/lx

drwx------. 4 lx lx 88 Sep 19 09:20 /home/zfl


groupadd:


groupmod:

[root@localhost Desktop]# groupadd bob

[root@localhost Desktop]# groupmod -n alice bob

[root@localhost Desktop]# grep ^alice /etc/group

alice:x:1002:


groupdel:


综合实验1:

[root@localhost Desktop]# useradd -d /home/alice ql

[root@localhost Desktop]# grep ql /etc/passwd

ql:x:1001:1002::/home/aliace:/bin/bash

[root@localhost Desktop]# ls -ld /home/alice

drwx------. 4 ql ql 88 Sep 13 13:08 /home/alice

[root@localhost Desktop]# usermod -G wheel ql               #将ql用户加入wheel组

[root@localhost Desktop]# grep wheel /etc/group

wheel:x:10:student,ql

[root@localhost Desktop]# id ql

uid=1001(ql) gid=1002(ql) groups=1002(ql),10(wheel)

[root@localhost Desktop]# usermod -l yf ql

[root@localhost Desktop]# id ql

id: ql: no such user

[root@localhost Desktop]# id yf

uid=1001(yf) gid=1002(ql) groups=1002(ql),10(wheel)

[root@localhost Desktop]# groupmod -n yf ql 

[root@localhost Desktop]# userdel -r yf 

[root@localhost Desktop]# ls -l /home/

total 4

drwx------. 6 student student 4096 Sep 13 11:50 student

[root@localhost Desktop]# id yf

id: yf: no such user


通过文件批量创建用户:

u6-->u8:

[root@localhost Desktop]# for i in $(seq 6 8);do echo u$i:x:100$(($i + 1)):100$(($i + 1))::/home/u$i:/bin/bash >> ulist.txt;done

[root@localhost Desktop]# cat ulist.txt 

u6:x:1007:1007::/home/u6:/bin/bash

u7:x:1008:1008::/home/u7:/bin/bash

u8:x:1009:1009::/home/u8:/bin/bash

[root@localhost Desktop]# newusers ulist.txt

[root@localhost Desktop]# tail -n 3 /etc/passwd

u6:x:1007:1007::/home/u6:/bin/bash

u7:x:1008:1008::/home/u7:/bin/bash

u8:x:1009:1009::/home/u8:/bin/bash


u9-->u10:

[root@localhost Desktop]# for i in $(seq 9 10);do echo u$i:x:10$(($i + 1)):10$(($i + 1))::/home/u$i:/bin/bash >> ulist.txt;done

[root@localhost Desktop]# cat ulist.txt

u6:x:1007:1007::/home/u6:/bin/bash

u7:x:1008:1008::/home/u7:/bin/bash

u8:x:1009:1009::/home/u8:/bin/bash

u9:x:1010:1010::/home/u9:/bin/bash

u10:x:1011:1011::/home/u10:/bin/bash

[root@localhost Desktop]# newusers ulist.txt

[root@localhost Desktop]# tail -n 2 /etc/passwd

u9:x:1010:1010::/home/u9:/bin/bash

u10:x:1011:1011::/home/u10:/bin/bash


推荐方法:

#! /bin/bash

for i in {1..10}

do

  useradd user$i

  echo "password"|passwd --stdin user$i

done


方法1:

[root@localhost Desktop]# grep ^student /etc/passwd > user.txt

[root@localhost Desktop]# cat /etc/passwd|grep ^student > user.txt

[root@localhost Desktop]#cat user.txt

student:x:1000:1000:Student User:/home/u1:/bin/bash

[root@localhost Desktop]#vim user.txt 

u1:x:1001:1001::/home/u1:/bin/bash

u2:x:1002:1002::/home/u2:/bin/bash

u3:x:1003:1003::/home/u3:/bin/bash

u4:x:1004:1004::/home/u4:/bin/bash

u5:x:1005:1005::/home/u5:/bin/bash

操作方法:

%:代表所有的行

1:代表第1行

set nu

1s/student/u1/g

1s/1000/1001/g

:/S 2dw

yy

4p

[root@localhost Desktop]#newusers user.txt   #读取user.txt中的用户信息并创建有规律的用户 

[root@localhost Desktop]#tail -n 5/etc/passwd

u1:x:1001:1001::/home/u1:/bin/bash

u2:x:1002:1002::/home/u2:/bin/bash

u3:x:1003:1003::/home/u3:/bin/bash

u4:x:1004:1004::/home/u4:/bin/bash

u5:x:1005:1005::/home/u5:/bin/bash


方法2:命令行方式

echo U{1..10}|xargs -n1|sed -r 's#.*#useradd &#g'|sh

echo U{1..10}|xargs -n1|sed -r 's#.*#useradd &;echo "passwd"|passwd --stdin &#g'|sh

  

方法3:shell编程方式

#! /bin/bash

passwd="123456" 

for user in `echo U{1..10}`;

do 

         useradd $user

         echo "$user:$passwd" | chpasswd 

         echo "用户$user建立成功,初始密码是$passwd" 

done


延伸知识

[root@localhost Desktop]# p=1

[root@localhost Desktop]# echo $(($p+3))

4

[root@localhost Desktop]#


综合实验2:

通过脚本批量创建、修改用户密码、删除脚本

创建用户:

[root@localhost Desktop]#vim useradd.sh

#!/bin/bash

for i in $(seq 1 5)

do 

echo u$i:x:100$(($i + 1)):100$(($i + 1))::/home/u$i:/bin/bash >> ulist.txt

done

[root@localhost Desktop]#chmod o+x useradd.sh

[root@localhost Desktop]#./useradd.sh

[root@localhost Desktop]#ls

ulist.txt  useradd.sh  userdel.sh  userpasswd.sh

[root@localhost Desktop]#newusers ulist.txt

u1:x:1002:1002::/home/u1:/bin/bash

u2:x:1003:1003::/home/u2:/bin/bash

u3:x:1004:1004::/home/u3:/bin/bash

u4:x:1005:1005::/home/u4:/bin/bash

u5:x:1006:1006::/home/u5:/bin/bash


修改用户密码:

[root@localhost Desktop]#vim userpasswd.sh

#!/bin/bash

for i in $(seq 1 5)

do 

     useradd u$i

     echo p$i\u |passwd --stdin u$i > /dev/null

done

[root@localhost Desktop]#chmod o+x userpasswd.sh

[root@localhost Desktop]#./userpasswd.sh


删除用户:

[root@localhost Desktop]#vim userdel.sh

#!/bin/bash

for i in $(seq 1 5)

 do

     userdel -r  u$i

done

[root@localhost Desktop]#chmod o+x userdel.sh

[root@localhost Desktop]# ./userdel.sh 

[root@localhost Desktop]# id u1

id: u1: no such user


用户密码配置文件

/etc/shadow 

name:password:lastchange:minage:maxage:warning:inactive:expire:blank



第六章 Linux文件系统权限与访问控制

u

g

o

+

-

=

rwx

[root@localhost Desktop]# touch file

[root@localhost Desktop]# ll file

-rw-r--r--. 1 root root 0 Sep 13 15:04 file

[root@localhost Desktop]# chmod g+x file

[root@localhost Desktop]# ll file

-rw-r-xr--. 1 root root 0 Sep 13 15:04 file


将缓存中的历史命令写入历史文件~/.bash_history

history -a

清除历史文件中的所有历史命令

history -c


suid:当s出现在文件拥有者的x权限时,就被成为SetUID,简称SUID

1、suid权限仅对二进制程序有效(binary program)

2、执行者对于该程序需要具有x的可执行权限;

3、本权限仅在执行该程序的过程中有效(run-time);

4、执行者将具有该程序拥有者的权限。

[root@localhost Desktop]# ll /usr/bin/passwd

-rwsr-xr-x. 1 root root 27832 Jan 30  2014 /usr/bin/passwd

[root@localhost Desktop]# su - zj

Last login: Fri Sep 25 15:35:29 CST 2015 on pts/0

[zj@localhost ~]$ passwd

Changing password for user zj.

Changing password for zj.

(current) UNIX password: 

New password: 

Retype new password: 

passwd: all authentication tokens updated successfully.

[zj@localhost ~]$ exit

logout

[root@localhost Desktop]# chmod 755 /usr/bin/passwd

[root@localhost Desktop]# ll /usr/bin/passwd

-rwxr-xr-x. 1 root root 27832 Jan 30  2014 /usr/bin/passwd

[root@localhost Desktop]# su - zj

Last login: Fri Sep 25 15:36:17 CST 2015 on pts/0

[zj@localhost ~]$ passwd

Changing password for user zj.

Changing password for zj.

(current) UNIX password: 

New password: 

Retype new password: 

passwd: Authentication token manipulation error


sgid:当 s 标志在档案拥有者的x项目为 SUID,那s在群组的x时则称为 Set GID

1、SGID 对二进制程序有用

2、程序执行者对于该程序来说,需具备x的权限

3、执行者在执行的过程中将会获得该程序群组的支持!

[root@localhost Desktop]# find / -perm /2000 -exec ls -l {} \;   #查找根文件系统下哪些文件和目录具有SGID的权限

-r-xr-sr-x. 1 root tty 15344 Jan 27  2014 /usr/bin/wall

-rwxr-sr-x. 1 root tty 19536 Mar 28  2014 /usr/bin/write

---x--s--x. 1 root nobody 145312 Mar 20  2014 /usr/bin/ssh-agent

-rwx--s--x. 1 root slocate 40504 Jan 27  2014 /usr/bin/locate

.................................................................

举例:

[root@localhost ~]ll /usr/bin/locate  /var/lib/mlocate/mlocate.db

-rwx--s--x. 1 root slocate   40504 Jan 27  2014 /usr/bin/locate

-rw-r-----. 1 root slocate 2253156 Sep 25 16:34 /var/lib/mlocate/mlocate.db

[root@localhost Desktop]# su - zj

Last login: Fri Sep 25 16:55:38 CST 2015 on pts/1

[zj@localhost ~]$ locate

locate: no pattern to search for specified


sbit:目前只针对目录有效,对于档案没有效果

1、当用户对于此目录具有 w, x 权限,亦即具有写入的权限

2、当用户在该目录下建立档案与目录时,仅有自己与root才有权力删除该档案


举例:

[root@localhost ~]#su - zj

Last login: Mon Oct  5 13:39:21 CST 2015 on pts/1

[zj@localhost ~]$ ll -d /tmp

drwxrwxrwt. 15 root root 4096 Oct  5 13:42 /tmp

[zj@localhost ~]$ touch /tmp/test;ll /tmp/test

-rw-rw-r--. 1 zj zj 0 Oct  5 13:43 /tmp/test

[zj@localhost ~]$ exit

logout

[root@localhost ~]#su - zl

Last login: Mon Oct  5 13:40:05 CST 2015 on pts/1

[zl@localhost ~]$ cd /tmp

[zl@localhost tmp]$ rm test

rm: remove write-protected regular empty file ‘test’? y

rm: cannot remove ‘test’: Operation not permitted

[zl@localhost tmp]$ exit

logout

[root@localhost ~]#chmod 777 /tmp

[root@localhost ~]#su - zl

Last login: Mon Oct  5 13:43:07 CST 2015 on pts/1

[zl@localhost ~]$ cd /tmp

[zl@localhost tmp]$ rm test

rm: remove write-protected regular empty file ‘test’? y

[zl@localhost tmp]$ ll test

ls: cannot access test: No such file or directory


[zj@localhost ~]$ ll -d /tmp

drwxrwxrwx. 15 root root 4096 Oct  5 12:59 /tmp

[root@localhost tmp]#su - zj

Last login: Mon Oct  5 12:59:04 CST 2015 on pts/1

[zj@localhost ~]$ cd /tmp

[zj@localhost tmp]$ touch test

[zj@localhost tmp]$ ll test

-rw-rw-r--. 1 zj zj 0 Oct  5 13:01 test

[zj@localhost tmp]$ logout

[root@localhost tmp]#su - zl

Last login: Mon Oct  5 13:00:37 CST 2015 on pts/1

[zl@localhost ~]$ cd /tmp

[zl@localhost tmp]$ ll test

-rw-rw-r--. 1 zj zj 0 Oct  5 13:01 test

[zl@localhost tmp]$ rm  test

rm: remove write-protected regular empty file ‘test’? y

[zl@localhost tmp]$ ll test

ls: cannot access test: No such file or directory


[root@localhost tmp]#su - zj

Last login: Mon Oct  5 13:04:28 CST 2015 on pts/1

[zj@localhost ~]$ chmod 1777 /tmp

[zj@localhost ~]$ ll -d /tmp

drwxrwxrwt. 15 root root 4096 Oct  5 13:05 /tmp

[zj@localhost ~]$ touch /tmp/test

[zj@localhost ~]$ ll /tmp/test

-rw-rw-r--. 1 zj zj 0 Oct  5 13:06 /tmp/test

[zj@localhost ~]$ chmod 777 /tmp/test

[zj@localhost ~]$ ll /tmp/test

-rwxrwxrwx. 1 zj zj 0 Oct  5 13:06 /tmp/test

[zj@localhost ~]$ logout

[root@localhost tmp]#su - zl

Last login: Mon Oct  5 13:01:33 CST 2015 on pts/1

[zl@localhost ~]$ cd /tmp

[zl@localhost tmp]$ rm test

rm: cannot remove ‘test’: Operation not permitted



chmod:

[root@localhost ~]# touch test.txt&&mkdir test

[root@localhost ~]# ll -d test.txt test

drwxr-xr-x. 2 root root 6 Sep 13 15:29 test

-rw-r--r--. 1 root root 0 Sep 13 15:29 test.txt

[root@localhost ~]# chmod g+s test

[root@localhost ~]# ll -d test

drwxr-sr-x. 2 root root 6 Sep 13 15:29 test

[root@localhost ~]# chmod o+t test

[root@localhost ~]# ll -d test

drwxr-sr-t. 2 root root 6 Sep 13 15:29 test

[root@localhost ~]# ll /bin/passwd

-rwsr-xr-x. 1 root root 27832 Jan 30  2014 /bin/passwd

[root@localhost ~]# ll /etc/shadow

----------. 1 root root 1148 Sep 13 15:15 /etc/shadow

[root@localhost ~]# ll test.txt

-rw-r--r--. 1 root root 0 Sep 13 15:29 test.txt

[root@localhost ~]# chmod 0755 test.txt

[root@localhost ~]# ll test.txt

-rwxr-xr-x. 1 root root 0 Sep 13 15:29 test.txt

[root@localhost ~]# chmod 2755 test.txt

[root@localhost ~]# ll test.txt

-rwxr-sr-x. 1 root root 0 Sep 13 15:29 test.txt


chown:

[root@localhost ~]# ll test.txt

-rwxr-sr-x. 1 root root 0 Sep 13 15:29 test.txt

[root@localhost ~]# chown student test.txt&&ll test.txt

-rwxr-xr-x. 1 student root 0 Sep 13 15:29 test.txt

[root@localhost ~]# chown :wheel test.txt

[root@localhost ~]# ll test.txt

-rwxr-xr-x. 1 student wheel 0 Sep 13 15:29 test.txt

[root@localhost ~]# chown root:student test.txt

[root@localhost ~]# mkdir -p a/b/c

[root@localhost ~]# ls -ld a

drwxr-xr-x. 3 root root 14 Sep 13 15:40 a

[root@localhost ~]# chown -R student a

[root@localhost ~]# ll -d a

drwxr-xr-x. 3 student root 14 Sep 13 15:40 a

[root@localhost ~]# ls -ld a/b/c

drwxr-xr-x. 2 student root 6 Sep 13 15:40 a/b/c

[root@localhost ~]# chmod -R g+w a

[root@localhost ~]# ls -ld a/b/c

drwxrwxr-x. 2 student root 6 Sep 13 15:40 a/b/c


chgrp:

[root@localhost Desktop]# ll file

-rw-r-xr--. 1 zj zj 0 Sep 24 13:44 file

[root@localhost Desktop]# chown zj:zj file

[root@localhost Desktop]# chgrp root file      #改变文件所属群组

[root@localhost Desktop]# ll file

-rw-r-xr--. 1 zj root 0 Sep 24 13:44 file





第七章 监控和管理Linux进程

&:将执行的进程放到后台运行

jobs:列出进程状态与编号

fg %:将某进程转入前台执行

bg %:将某进程转入后台执行

kill -9 PID:强制结束某个进程


[root@localhost Desktop]# ps

  PID TTY          TIME CMD

47792 pts/2    00:00:00 bash

47936 pts/2    00:00:00 ps

[root@localhost Desktop]# dd if=/dev/zero of=/dev/null bs=1k

^Z

[1]+  Stopped                 dd if=/dev/zero of=/dev/null bs=1k

[root@localhost Desktop]# jobs

[1]+  Stopped                 dd if=/dev/zero of=/dev/null bs=1k

[root@localhost Desktop]# bg

[1]+ dd if=/dev/zero of=/dev/null bs=1k &

[root@localhost Desktop]# jobs

[1]+  Running                 dd if=/dev/zero of=/dev/null bs=1k &

[root@localhost Desktop]# dd if=/dev/zero of=/dev/null bs=2k &

[2] 47967

[root@localhost Desktop]# jobs

[1]-  Running                 dd if=/dev/zero of=/dev/null bs=1k &

[2]+  Running                 dd if=/dev/zero of=/dev/null bs=2k &

[root@localhost Desktop]# fg 2

dd if=/dev/zero of=/dev/null bs=2k

^C8400826+0 records in

8400826+0 records out

17204891648 bytes (17 GB) copied, 24.9531 s, 689 MB/s


[root@localhost Desktop]# ps -a -o pid,comm

  PID COMMAND

47952 dd

47985 ps

[root@localhost Desktop]# kill -9 47952

[1]+  Killed                  dd if=/dev/zero of=/dev/null bs=1k

[root@localhost Desktop]# jobs


打开火狐浏览器并结束

[root@localhost Desktop]# firefox &

[1] 48039

[root@localhost Desktop]# 

(process:48039): GLib-CRITICAL **: g_slice_set_config: assertion `sys_page_size == 0' failed

^C

[root@localhost Desktop]# killall -9 firefox

[1]+  Killed                  firefox


[root@localhost Desktop]# w       #查看哪些用户登录到了当前系统

16:45:48 up 12:11,  3 users,  load average: 1.13, 1.36, 0.96

USER     TTY        LOGIN@   IDLE   JCPU   PCPU WHAT

root     :0        15:14   ?xdm?  17:43   0.21s gdm-session-worker [pam/gdm-password]

root     pts/2     16:33    4.00s  0.15s  0.01s w

root     pts/0     15:14    1:14m  0.18s  0.18s /bin/bash

[root@localhost Desktop]# whoami   #查看当前登录的用户用户名

root


设置与恢复前导符

[root@localhost Desktop]# PS1=C:\\\ \>

C:\ >PS1='[\u@\h \W]#'

[root@localhost Desktop]#


uptime:查看系统运行了多长时间

[root@localhost Desktop]# uptime

 16:48:58 up 12:14,  3 users,  load average: 1.11, 1.24, 0.98

 

[root@localhost Desktop]# cat /proc/cpuinfo  #查看CPU信息

processor: 0

vendor_id: GenuineIntel

cpu family: 6

model: 42

model name: Intel(R) Core(TM) i5-2550K CPU @ 3.40GHz

stepping: 7

microcode: 0x28

cpu MHz: 3801.000

cache size: 6144 KB

physical id: 0

siblings: 1

core id: 0

cpu cores: 1

apicid: 0

initial apicid: 0

fpu: yes

fpu_exception: yes

cpuid level: 13

wp: yes

flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt aes xsave avx hypervisor lahf_lm ida arat epb xsaveopt pln pts dtherm

bogomips: 7602.00

clflush size: 64

cache_alignment: 64

address sizes: 40 bits physical, 48 bits virtual

power management:


打开系统监控并转入后台执行

[root@localhost Desktop]#gnome-system-monitor &



第八章 控制服务和守护进程

[root@localhost Desktop]#systemctl status iscsid.service

iscsid.service - Open-iSCSI

   Loaded: loaded (/usr/lib/systemd/system/iscsid.service; disabled)

   Active: active (running) since Sun 2015-09-13 17:13:32 CST; 20s ago

     Docs: man:iscsid(8)

           man:iscsiadm(8)

  Process: 48570 ExecStart=/usr/sbin/iscsid (code=exited, status=0/SUCCESS)

 Main PID: 48572 (iscsid)

   CGroup: /system.slice/iscsid.service

           ├─48571 /usr/sbin/iscsid

           └─48572 /usr/sbin/iscsid


Sep 13 17:13:32 localhost iscsid[48571]: iSCSI daemon with pid=48572 started!

Sep 13 17:13:32 localhost systemd[1]: Failed to read PID from file /var/run/iscsid.pid: Invalid argument

Sep 13 17:13:32 localhost systemd[1]: Started Open-iSCSI.

[root@localhost Desktop]#systemctl stop iscsid.service

Warning: Stopping iscsid.service, but it can still be activated by:

  iscsid.socket

[root@localhost Desktop]#systemctl enable iscsid.service        #开机启动iscsi服务

ln -s '/usr/lib/systemd/system/iscsid.service' '/etc/systemd/system/multi-user.target.wants/iscsid.service'

[root@localhost Desktop]#systemctl disable iscsid.service       #开机不自动启动iscsi服务

rm '/etc/systemd/system/multi-user.target.wants/iscsid.service'


等同于

[root@localhost Desktop]#service start iscsid

[root@localhost Desktop]#service status iscsid

[root@localhost Desktop]#service stop iscsid

[root@localhost Desktop]#chkconfig iscsid on                #开机启动iscsi服务

[root@localhost Desktop]#chkconfig iscsid off               #开机不自动启动iscsi服务


^的替换:将上一条的命令进行替换

[root@localhost Desktop]#systemctl status iscsid.service

[root@localhost Desktop]#^status^stop

systemctl stop iscsid.service

Warning: Stopping iscsid.service, but it can still be activated by:

  iscsid.socket


查看本机安装了哪些服务

[root@localhost Desktop]# systemctl enable 

abrt-pstoreoops.service

arp-ethers.service

[email protected]

blk-availability.service

brandbot.path

brltty.service

canberra-system-bootup.service

canberra-system-shutdown-reboot.service

canberra-system-shutdown.service


chgrp:更改文件的所属组


ctrl+s:隐藏输入命令                         #只在字符界面生效,图形界面不生效

ctrl+q:取消隐藏输入命令


你可能感兴趣的:(基础,第二天,RHCSA)