|
2019-04-17星期三
在man page里进行一个单词的查找(查找N这个“词“):
- ASCII(7) Linux Programmer's Manual ASCII(7)
- NAME
- ascii - ASCII character set encoded in octal, decimal, and hexadecimal
- DESCRIPTION
- ASCII is the American Standard Code for Information Interchange. It is
- a 7-bit code. Many 8-bit codes (such as ISO 8859-1, the Linux default
- character set) contain ASCII as their lower half. The international
- counterpart of ASCII is known as ISO 646.
- The following table contains the 128 ASCII characters.
- C program '\X' escapes are noted.
- Oct Dec Hex Char Oct Dec Hex Char
- ────────────────────────────────────────────────────────────────────────
- 000 0 00 NUL '\0' 100 64 40 @
- 001 1 01 SOH (start of heading) 101 65 41 A
- 002 2 02 STX (start of text) 102 66 42 B
- 003 3 03 ETX (end of text) 103 67 43 C
- 004 4 04 EOT (end of transmission) 104 68 44 D
- 005 5 05 ENQ (enquiry) 105 69 45 E
- 006 6 06 ACK (acknowledge) 106 70 46 F
- 007 7 07 BEL '\a' (bell) 107 71 47 G
- 010 8 08 BS '\b' (backspace) 110 72 48 H
- 011 9 09 HT '\t' (horizontal tab) 111 73 49 I
- 012 10 0A LF '\n' (new line) 112 74 4A J
- 013 11 0B VT '\v' (vertical tab) 113 75 4B K
- 014 12 0C FF '\f' (form feed) 114 76 4C L
- 015 13 0D CR '\r' (carriage ret) 115 77 4D M
- 016 14 0E SO (shift out) 116 78 4E N
- 017 15 0F SI (shift in) 117 79 4F O
- 020 16 10 DLE (data link escape) 120 80 50 P
- 021 17 11 DC1 (device control 1) 121 81 51 Q
- 022 18 12 DC2 (device control 2) 122 82 52 R
- 023 19 13 DC3 (device control 3) 123 83 53 S
- 024 20 14 DC4 (device control 4) 124 84 54 T
- 025 21 15 NAK (negative ack.) 125 85 55 U
- 026 22 16 SYN (synchronous idle) 126 86 56 V
- 027 23 17 ETB (end of trans. blk) 127 87 57 W
- 030 24 18 CAN (cancel) 130 88 58 X
- 031 25 19 EM (end of medium) 131 89 59 Y
- 032 26 1A SUB (substitute) 132 90 5A Z
- 033 27 1B ESC (escape) 133 91 5B [
- 034 28 1C FS (file separator) 134 92 5C \ '\\'
- 035 29 1D GS (group separator) 135 93 5D ]
- 036 30 1E RS (record separator) 136 94 5E ^
- /\<N\>
复制代码 man -k 是非常有用的:- [root@station60 ~]# man -k boot
- binfmt.d (5) - Configure additional binary formats for executables at boot
- bootchart.conf (5) - Boot performance analysis graphing tool configuration files
- bootchart.conf.d (5) - Boot performance analysis graphing tool configuration files
- bootctl (1) - Control the firmware and boot manager settings
- bootparam (7) - introduction to boot time parameters of the Linux kernel
复制代码 bootparam:
- BOOTPARAM(7) Linux Programmer's Manual BOOTPARAM(7)
- NAME
- bootparam - introduction to boot time parameters of the Linux kernel
- DESCRIPTION
- The Linux kernel accepts certain 'command-line options' or 'boot time parameters' at the moment it is started. In general this is used to supply
- the kernel with information about hardware parameters that the kernel would not be able to determine on its own, or to avoid/override the values
- that the kernel would otherwise detect.
- When the kernel is booted directly by the BIOS (say from a floppy to which you copied a kernel using 'cp zImage /dev/fd0'), you have no opportu‐
- nity to specify any parameters. So, in order to take advantage of this possibility you have to use a boot loader that is able to pass parameters,
- such as GRUB.
- The argument list
- The kernel command line is parsed into a list of strings (boot arguments) separated by spaces. Most of the boot arguments take have the form:
- name[=value_1][,value_2]...[,value_10]
- where 'name' is a unique keyword that is used to identify what part of the kernel the associated values (if any) are to be given to. Note the
- limit of 10 is real, as the present code handles only 10 comma separated parameters per keyword. (However, you can reuse the same keyword with up
- to an additional 10 parameters in unusually complicated situations, assuming the setup function supports it.)
- Most of the sorting is coded in the kernel source file init/main.c. First, the kernel checks to see if the argument is any of the special argu‐
- ments 'root=', 'nfsroot=', 'nfsaddrs=', 'ro', 'rw', 'debug' or 'init'. The meaning of these special arguments is described below.
- Then it walks a list of setup functions (contained in the bootsetups array) to see if the specified argument string (such as 'foo') has been asso‐
- ciated with a setup function ('foo_setup()') for a particular device or part of the kernel. If you passed the kernel the line foo=3,4,5,6 then
- the kernel would search the bootsetups array to see if 'foo' was registered. If it was, then it would call the setup function associated with
- 'foo' (foo_setup()) and hand it the arguments 3, 4, 5 and 6 as given on the kernel command line.
- Anything of the form 'foo=bar' that is not accepted as a setup function as described above is then interpreted as an environment variable to be
- set. A (useless?) example would be to use 'TERM=vt100' as a boot argument.
- Any remaining arguments that were not picked up by the kernel and were not interpreted as environment variables are then passed onto process one,
- which is usually the init(1) program. The most common argument that is passed to the init process is the word 'single' which instructs it to boot
- the computer in single user mode, and not launch all the usual daemons. Check the manual page for the version of init(1) installed on your system
- to see what arguments it accepts.
- General non-device specific boot arguments
- 'init=...'
复制代码 打印man page:- [root@station60 Examples]# man -t 5 passwd > /root/labs/passwd.ps
- [root@station60 Examples]# cd /root/labs/
- [root@station60 labs]# ls
- ! 1 1.sh 2 2.sh 3 4 4.sh 5 5.sh a [abcd] b c d list.txt passwd.ps
- [root@station60 labs]# ps2
- ps2ascii ps2epsi ps2pdf ps2pdf12 ps2pdf13 ps2pdf14 ps2pdfwr ps2ps ps2ps2
- [root@station60 labs]# ps2pdf passwd.ps
- [root@station60 labs]# ls
- ! 1 1.sh 2 2.sh 3 4 4.sh 5 5.sh a [abcd] b c d list.txt passwd.pdf passwd.ps
- [root@station60 labs]#
复制代码 把标准出错合并到标准输出:- [root@station60 labs]# ls xxxx > 6.txt 2>&1
- [root@station60 labs]# cat 6.txt
- ls: cannot access xxxx: No such file or directory
- [root@station60 labs]#
复制代码 注意以下的8.txt是误操作:- [root@station60 labs]# ls xxxx &> 7.txt
- [root@station60 labs]# cat 7.txt
- ls: cannot access xxxx: No such file or directory
- [root@station60 labs]# ls xxxx & > 8.txt
- [1] 20111
- [root@station60 labs]# ls: cannot access xxxx: No such file or directory
- [1]+ Exit 2 ls --color=auto xxxx
复制代码 输出和出错同时重定向:- [student@station60 ~]$ find /etc/ -name passwd > 1.txt 2>2.txt
- [student@station60 ~]$ cat 1.txt
- /etc/pam.d/passwd
- /etc/passwd
- [student@station60 ~]$ cat 2.txt
- find: ‘/etc/pki/CA/private’: Permission denied
- find: ‘/etc/pki/rsyslog’: Permission denied
- find: ‘/etc/grub.d’: Permission denied
- find: ‘/etc/selinux/targeted/active’: Permission denied
- find: ‘/etc/selinux/final’: Permission denied
- find: ‘/etc/dhcp’: Permission denied
- find: ‘/etc/lvm/archive’: Permission denied
- find: ‘/etc/lvm/backup’: Permission denied
- find: ‘/etc/lvm/cache’: Permission denied
- find: ‘/etc/polkit-1/rules.d’: Permission denied
- find: ‘/etc/polkit-1/localauthority’: Permission denied
- find: ‘/etc/sudoers.d’: Permission denied
- find: ‘/etc/vmware-tools/GuestProxyData/trusted’: Permission denied
- find: ‘/etc/audisp’: Permission denied
- find: ‘/etc/audit’: Permission denied
- find: ‘/etc/ipsec.d’: Permission denied
- find: ‘/etc/libvirt’: Permission denied
- find: ‘/etc/cups/ssl’: Permission denied
- find: ‘/etc/firewalld’: Permission denied
- [student@station60 ~]$
复制代码 UPG规则和非UPG方式建用户的区别:- [root@station60 labs]# cat /etc/passwd
- root:x:0:0:root:/root:/bin/bash
- bin:x:1:1:bin:/bin:/sbin/nologin
- daemon:x:2:2:daemon:/sbin:/sbin/nologin
- adm:x:3:4:adm:/var/adm:/sbin/nologin
- lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
- sync:x:5:0:sync:/sbin:/bin/sync
- shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
- halt:x:7:0:halt:/sbin:/sbin/halt
- mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
- operator:x:11:0:operator:/root:/sbin/nologin
- games:x:12:100:games:/usr/games:/sbin/nologin
- ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
- nobody:x:99:99:Nobody:/:/sbin/nologin
- systemd-network:x:192:192:systemd Network Management:/:/sbin/nologin
- dbus:x:81:81:System message bus:/:/sbin/nologin
- polkitd:x:999:998:User for polkitd:/:/sbin/nologin
- libstoragemgmt:x:998:996:daemon account for libstoragemgmt:/var/run/lsm:/sbin/nologin
- colord:x:997:995:User for colord:/var/lib/colord:/sbin/nologin
- rpc:x:32:32:Rpcbind Daemon:/var/lib/rpcbind:/sbin/nologin
- saslauth:x:996:76:Saslauthd user:/run/saslauthd:/sbin/nologin
- abrt:x:173:173::/etc/abrt:/sbin/nologin
- rtkit:x:172:172:RealtimeKit:/proc:/sbin/nologin
- pulse:x:171:171:PulseAudio System Daemon:/var/run/pulse:/sbin/nologin
- chrony:x:995:990::/var/lib/chrony:/sbin/nologin
- radvd:x:75:75:radvd user:/:/sbin/nologin
- rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
- nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
- unbound:x:994:989:Unbound DNS resolver:/etc/unbound:/sbin/nologin
- gluster:x:993:988:GlusterFS daemons:/run/gluster:/sbin/nologin
- qemu:x:107:107:qemu user:/:/sbin/nologin
- tss:x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin
- usbmuxd:x:113:113:usbmuxd user:/:/sbin/nologin
- geoclue:x:992:986:User for geoclue:/var/lib/geoclue:/sbin/nologin
- setroubleshoot:x:991:985::/var/lib/setroubleshoot:/sbin/nologin
- saned:x:990:984:SANE scanner daemon user:/usr/share/sane:/sbin/nologin
- gdm:x:42:42::/var/lib/gdm:/sbin/nologin
- gnome-initial-setup:x:989:983::/run/gnome-initial-setup/:/sbin/nologin
- sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
- avahi:x:70:70:Avahi mDNS/DNS-SD Stack:/var/run/avahi-daemon:/sbin/nologin
- postfix:x:89:89::/var/spool/postfix:/sbin/nologin
- ntp:x:38:38::/etc/ntp:/sbin/nologin
- tcpdump:x:72:72::/:/sbin/nologin
- student:x:1000:1000:student:/home/student:/bin/bash
- [root@station60 labs]# id student
- uid=1000(student) gid=1000(student) groups=1000(student),10(wheel)
- [root@station60 labs]# gro
- groff grops grotty groupadd groupdel groupmems groupmod groups growisofs
- [root@station60 labs]# group
- groupadd groupdel groupmems groupmod groups
- [root@station60 labs]# groups student
- student : student wheel
- [root@station60 labs]# su - student
- Last login: Wed Apr 17 09:05:47 EDT 2019 on pts/0
- [student@station60 ~]$ umask
- 0002
- [student@station60 ~]$ touch student1.txt
- [student@station60 ~]$ ls -l
- total 8
- -rw-rw-r--. 1 student student 30 Apr 17 09:06 1.txt
- -rw-rw-r--. 1 student student 929 Apr 17 09:06 2.txt
- drwxr-xr-x. 2 student student 6 Apr 4 16:45 Desktop
- drwxr-xr-x. 2 student student 6 Apr 4 16:45 Documents
- drwxr-xr-x. 2 student student 6 Apr 4 16:45 Downloads
- drwxr-xr-x. 2 student student 6 Apr 4 16:45 Music
- drwxr-xr-x. 2 student student 6 Apr 4 16:45 Pictures
- drwxr-xr-x. 2 student student 6 Apr 4 16:45 Public
- -rw-rw-r--. 1 student student 0 Apr 17 09:38 student1.txt
- drwxr-xr-x. 2 student student 6 Apr 4 16:45 Templates
- drwxr-xr-x. 2 student student 6 Apr 4 16:45 Videos
- [student@station60 ~]$ exit
- logout
- [root@station60 labs]# groupadd oinstall
- [root@station60 labs]# group oinstall
- bash: group: command not found...
- [root@station60 labs]# groups oinstall
- groups: oinstall: no such user
- [root@station60 labs]# groups student
- student : student wheel
- [root@station60 labs]# id student
- uid=1000(student) gid=1000(student) groups=1000(student),10(wheel)
- [root@station60 labs]# useradd oracle -g oinstall -G student
- [root@station60 labs]# groups oinstall
复制代码
不同用户进程访问文件系统案例(顺带研究目录这种特殊文件):- [root@station60 labs]# id oracle
- uid=1001(oracle) gid=1001(oinstall) groups=1001(oinstall),1000(student)
- [root@station60 labs]# su - oracle
- [oracle@station60 ~]$ umask
- 0022
- [oracle@station60 ~]$ touch oracle.txt
- [oracle@station60 ~]$ ls
- oracle.txt
- [oracle@station60 ~]$ ls -l
- total 0
- -rw-r--r--. 1 oracle oinstall 0 Apr 17 09:42 oracle.txt
- [oracle@station60 ~]$ ls -l
- total 0
- -rw-r--r--. 1 oracle oinstall 0 Apr 17 09:42 oracle.txt
- [oracle@station60 ~]$ vim oracle.txt
- [oracle@station60 ~]$ cd /home/student/
- -bash: cd: /home/student/: Permission denied
- [oracle@station60 ~]$ ls -ld /home/student/
- drwx------. 15 student student 4096 Apr 17 09:38 /home/student/
- [oracle@station60 ~]$ exit
- logout
- [root@station60 labs]# su - studednt
- su: user studednt does not exist
- [root@station60 labs]# su - student
- Last login: Wed Apr 17 09:37:46 EDT 2019 on pts/0
- [student@station60 ~]$ ls -ld
- drwx------. 15 student student 4096 Apr 17 09:38 .
- [student@station60 ~]$ chmod g=rx ./
- [student@station60 ~]$ ls -ld
- drwxr-x---. 15 student student 4096 Apr 17 09:38 .
- [student@station60 ~]$ exit
- logout
- [root@station60 labs]# su - oracle
- Last login: Wed Apr 17 09:42:13 EDT 2019 on pts/0
- [oracle@station60 ~]$ cd /home/student/
- [oracle@station60 student]$
复制代码 对以上操作的解释:oracle这个用户之所以能够进入student的家目录是因为:1. oracle属于副组student
2.- [oracle@station60 student]$ ls -ld .
- drwxr-x---. 15 student student 4096 Apr 17 09:38 .
复制代码
drwxr-x---. 15 student student 4096 Apr 17 09:38 .
主组信息在/etc/passwd,副组信息在/etc/group:
|
|