[root@szm Desktop]# locate --help
Usage: locate [OPTION]... [PATTERN]...
Search for entries in a mlocate database.
-b, --basename match only the base name of path names
-c, --count only print number of found entries
-d, --database DBPATH use DBPATH instead of default database (which is
/var/lib/mlocate/mlocate.db)
-e, --existing only print entries for currently existing files
-L, --follow follow trailing symbolic links when checking file
existence (default)
-h, --help print this help
-i, --ignore-case ignore case distinctions when matching patterns
-l, --limit, -n LIMIT limit output (or counting) to LIMIT entries
-m, --mmap ignored, for backward compatibility
-P, --nofollow, -H don't follow trailing symbolic links when checking file
existence
-0, --null separate entries with NUL on output
-S, --statistics don't search for entries, print statistics about each
used database
-q, --quiet report no error messages about reading databases
-r, --regexp REGEXP search for basic regexp REGEXP instead of patterns
--regex patterns are extended regexps
-s, --stdio ignored, for backward compatibility
-V, --version print version information
-w, --wholename match whole path name (default)
Report bugs to mitr@redhat.com.
===================================================================================
[root@szm Desktop]# find --help
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
default path is the current directory; default expression is -print
expression may consist of: operators, options, tests, and actions:
operators (decreasing precedence; -and is implicit where no others are given):
( EXPR ) ! EXPR -not EXPR EXPR1 -a EXPR2 EXPR1 -and EXPR2
EXPR1 -o EXPR2 EXPR1 -or EXPR2 EXPR1 , EXPR2
positional options (always true): -daystart -follow -regextype
normal options (always true, specified before other expressions):
-depth --help -maxdepth LEVELS -mindepth LEVELS -mount -noleaf
--version -xdev -ignore_readdir_race -noignore_readdir_race
tests (N can be +N or -N or N): -amin N -anewer FILE -atime N -cmin N
-cnewer FILE -ctime N -empty -false -fstype TYPE -gid N -group NAME
-ilname PATTERN -iname PATTERN -inum N -iwholename PATTERN -iregex PATTERN
-links N -lname PATTERN -mmin N -mtime N -name PATTERN -newer FILE
-nouser -nogroup -path PATTERN -perm [+-]MODE -regex PATTERN
-readable -writable -executable
-wholename PATTERN -size N[bcwkMG] -true -type [bcdpflsD] -uid N
-used N -user NAME -xtype [bcdpfls]
-context CONTEXT
actions: -delete -print0 -printf FORMAT -fprintf FILE FORMAT -print
-fprint0 FILE -fprint FILE -ls -fls FILE -prune -quit
-exec COMMAND ; -exec COMMAND {} + -ok COMMAND ;
-execdir COMMAND ; -execdir COMMAND {} + -okdir COMMAND ;
Report (and track progress on fixing) bugs via the findutils bug-reporting
page at http://savannah.gnu.org/ or, if you have no web access, by sending
email to <bug-findutils@gnu.org>.
[root@szm Desktop]# find / -nogroup-----------------账号删除后的文件
[root@szm Desktop]# find / -nouser------------------组账号删除后的文件
[root@szm Desktop]# find -type f-----常规文件(f)目录文件(d)块设备文件(b)
软链接文件(l)字符串文件(c)管道文件(p)
堆栈类型文件(s)
[root@szm Desktop]# find -atime -1--------------时间小于一天
[root@szm Desktop]# stat VirtualBox-2.2.0_45846_fedora10-1.i386.rpm------文件信息查看
File: `VirtualBox-2.2.0_45846_fedora10-1.i386.rpm'
Size: 798720 Blocks: 1560 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 399302 Links: 1
Access: (0664/-rw-rw-r--) Uid: ( 500/ szm) Gid: ( 500/ szm)
Access: 2013-03-06 10:38:55.187119239 +0800
Modify: 2013-01-30 17:37:59.298571000 +0800
Change: 2013-01-30 17:37:59.414528206 +0800
注意:1)以天为单位进行搜索:atime ctime mtime
2)以分为单位进行搜索:amin cmin mmin
3)加减号的用法
[root@szm Desktop]# find -perm 777
[root@szm Desktop]# find / -size +100M -exec ll {} \;
----------------------------------注意区别OK与exec(前者要用户干预后者不用)
========================================================================================
VIM:A、I、O、o、i、r、R、a(大写为行,小写为字符)
执行命令:! ls
加入密码::X(注意要保存退出)
如何解密:vim -x filename
清除密码:set key=***(注意要保存退出)
行首::0或者G、1G、2G
行尾::$
单词:wb
段落:()
句子:{}
剪切:cc
删除:dd
复制:yy
粘贴:P/p
还原:U/u
追加文件::r /etc/passwd
查找跳转:N/n
替换::1,10s/bash/szmbash/gi %s/bash/szmbash/gi---------gi为不要用户干预
块模式:Ctrl+v
多窗口排版:vim -o file1 file2
多窗口切换:Ctrl+w+向上/向下/向左/向右
退出所有窗口::qall
查看所有的VIM环境变量::set all
[root@szm Desktop]# vi /root/.viminfo -------------------相当于History
[root@szm Desktop]# vi /root/.vimrc ---------------------VIM启动环境配置,etc下也有一个
1 set hlsearch
2 set number
3 set autoindent
4 set showmode
5 set bg=dark
6 set syntax=ON
7 set autowrite
8 set list
[root@szm Desktop]# vimtutor--------------------------Vim帮助
[root@szm Desktop]# grep -i uid /etc/login.defs ------红帽定义为60000,Linux最大为2的32
# Min/max values for automatic uid selection in useradd
UID_MIN 500
UID_MAX 60000
====================================================================================
[root@szm Desktop]# man 5 shadow-----------------------shadow文件解析
login name
encrypted password
date of last password change
minimum password age
maximum password age
password warning period
password inactivity period
account expiration date
reserved field
[root@szm Desktop]# echo $(($(date --date="2010/07/24" +%s)/86400))------数字计算方式
[root@szm Desktop]# man 5 group--------------group文件解析
[root@szm Desktop]# system-config-users &
====================================================================================、[root@szm Desktop]# useradd --help
Usage: useradd [options] LOGIN
Options:
-b, --base-dir BASE_DIR base directory for the home directory of the
new account
-c, --comment COMMENT GECOS field of the new account----注释信息
-d, --home-dir HOME_DIR home directory of the new account
-D, --defaults print or change default useradd configuration
-e, --expiredate EXPIRE_DATE expiration date of the new account--过期时间
-f, --inactive INACTIVE password inactivity period of the new account---失效时间
-g, --gid GROUP name or ID of the primary group of the new
account
-G, --groups GROUPS list of supplementary groups of the new
account
-h, --help display this help message and exit
-k, --skel SKEL_DIR use this alternative skeleton directory
-K, --key KEY=VALUE override /etc/login.defs defaults
-l, --no-log-init do not add the user to the lastlog and
faillog databases
-m, --create-home create the user's home directory
-M, --no-create-home do not create the user's home directory
-N, --no-user-group do not create a group with the same name as
the user
-o, --non-unique allow to create users with duplicate
(non-unique) UID
-p, --password PASSWORD encrypted password of the new account
-r, --system create a system account
-s, --shell SHELL login shell of the new account
-u, --uid UID user ID of the new account
-U, --user-group create a group with the same name as the user
-Z, --selinux-user SEUSER use a specific SEUSER for the SELinux user mapping
[1]+ Done system-config-users
[root@szm Desktop]# usermod --help
Usage: usermod [options] LOGIN
Options:
-c, --comment COMMENT new value of the GECOS field
-d, --home HOME_DIR new home directory for the user account
-e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
-f, --inactive INACTIVE set password inactive after expiration
to INACTIVE
-g, --gid GROUP force use GROUP as new primary group----私有组
-G, --groups GROUPS new list of supplementary GROUPS--------公有组
-a, --append append the user to the supplemental GROUPS
mentioned by the -G option without removing
him/her from other groups
-h, --help display this help message and exit
-l, --login NEW_LOGIN new value of the login name
-L, --lock lock the user account
-m, --move-home move contents of the home directory to the
new location (use only with -d)
-o, --non-unique allow using duplicate (non-unique) UID
-p, --password PASSWORD use encrypted password for the new password
-s, --shell SHELL new login shell for the user account
-u, --uid UID new UID for the user account
-U, --unlock unlock the user account
-Z, --selinux-user new SELinux user mapping for the user account
[root@szm Desktop]# userdel --help
Usage: userdel [options] LOGIN
Options:
-f, --force force removal of files,
even if not owned by user
-h, --help display this help message and exit
-r, --remove remove home directory and mail spool
-Z, --selinux-user remove SELinux user from SELinux user mapping
添加用户默认动作:
1)[root@szm Desktop]# cat /etc/login.defs
2)[root@szm Desktop]# cat /etc/default/useradd
# useradd defaults file
GROUP=100------------------看/etc/login.defs的
HOME=/home
INACTIVE=-1----------------密码永不过期、0代表密码过期后失效
EXPIRE=--------------------失效日期
SHELL=/bin/bash
SKEL=/etc/skel-------------默认配置文件
CREATE_MAIL_SPOOL=yes
2)[root@szm Desktop]# useradd -D
GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel
CREATE_MAIL_SPOOL=yes
[root@szm Desktop]# cat /etc/login.defs | grep -v '#'
MAIL_DIR /var/spool/mail
PASS_MAX_DAYS 99999
PASS_MIN_DAYS 0
PASS_MIN_LEN 5-----------被pam相关模块取代了
PASS_WARN_AGE 7
UID_MIN 500
UID_MAX 60000
GID_MIN 500
GID_MAX 60000
CREATE_HOME yes
UMASK 077
USERGROUPS_ENAB yes-------------------------组内无成员,删除组
ENCRYPT_METHOD SHA512
[root@szm Desktop]# passwd --help
Usage: passwd [OPTION...] <accountName>
-k, --keep-tokens keep non-expired authentication tokens
-d, --delete delete the password for the named account (root only)
-l, --lock lock the password for the named account (root only)
-u, --unlock unlock the password for the named account (root only)
-e, --expire expire the password for the named account (root only)
-f, --force force operation
-x, --maximum=DAYS maximum password lifetime (root only)
-n, --minimum=DAYS minimum password lifetime (root only)
-w, --warning=DAYS number of days warning users receives before password expiration (root only)
-i, --inactive=DAYS number of days after password expiration when an account becomes disabled (root only)
-S, --status report password status on the named account (root only)
--stdin read new tokens from stdin (root only)
Help options:
-?, --help Show this help message
--usage Display brief usage message
[root@szm Desktop]# passwd -S szm
szm NP 2013-03-06 0 99999 7 -1 (Empty password.)
[root@szm Desktop]# groupadd --help
Usage: groupadd [options] GROUP
Options:
-f, --force exit successfully if the group already exists,
and cancel -g if the GID is already used
强制作用已存在组名称
-g, --gid GID use GID for the new group
-h, --help display this help message and exit
-K, --key KEY=VALUE override /etc/login.defs defaults
-o, --non-unique allow to create groups with duplicate
(non-unique) GID
-p, --password PASSWORD use this encrypted password for the new group
-r, --system create a system account
[root@szm Desktop]# groupmod --help
Usage: groupmod [options] GROUP
Options:
-g, --gid GID change the group ID to GID
-h, --help display this help message and exit
-n, --new-name NEW_GROUP change the name to NEW_GROUP
-o, --non-unique allow to use a duplicate (non-unique) GID
-p, --password PASSWORD change the password to this (encrypted)
PASSWORD
[root@szm Desktop]# gpasswd --help
gpasswd: unrecognized option '--help'
Usage: gpasswd [option] GROUP
Options:
-a, --add USER add USER to GROUP----向组中添加用户f
-d, --delete USER remove USER from GROUP
-r, --remove-password remove the GROUP's password
-R, --restrict restrict access to GROUP to its members
-M, --members USER,... set the list of members of GROUP
-A, --administrators ADMIN,...
set the list of administrators for GROUP
Except for the -A and -M options, the options cannot be combined.
[root@szm Desktop]# w --help
w: invalid option -- '-'
usage: w -hlsufV [user]
-h skip header
-l long listing (default)
-s short listing
-u ignore uid of processes
-f toggle FROM field (default on)
-V display version
[root@szm Desktop]# who --help
Usage: who [OPTION]... [ FILE | ARG1 ARG2 ]
Print information about users who are currently logged in.
-a, --all same as -b -d --login -p -r -t -T -u
-b, --boot time of last system boot
-d, --dead print dead processes
-H, --heading print line of column headings
-l, --login print system login processes
--lookup attempt to canonicalize hostnames via DNS
-m only hostname and user associated with stdin
-p, --process print active processes spawned by init
-q, --count all login names and number of users logged on
-r, --runlevel print current runlevel
-s, --short print only name, line, and time (default)
-t, --time print last system clock change
-T, -w, --mesg add user's message status as +, - or ?
-u, --users list users logged in
--message same as -T
--writable same as -T
--help display this help and exit
--version output version information and exit
If FILE is not specified, use /var/run/utmp. /var/log/wtmp as FILE is common.
If ARG1 ARG2 given, -m presumed: `am i' or `mom likes' are usual.
Report who bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'who invocation'
[root@szm Desktop]# id --help
Usage: id [OPTION]... [USERNAME]
Print user and group information for the specified USERNAME,
or (when USERNAME omitted) for the current user.
-a ignore, for compatibility with other versions
-Z, --context print only the security context of the current user
-g, --group print only the effective group ID
-G, --groups print all group IDs
-n, --name print a name instead of a number, for -ugG
-r, --real print the real ID instead of the effective ID, with -ugG
-u, --user print only the effective user ID
--help display this help and exit
--version output version information and exit
Without any OPTION, print some useful set of identified information.
Report id bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'id invocation'
[root@szm Desktop]# yum install finger-------------------安装finger
[root@szm Desktop]# finger -l szm
Login: szm Name: szm
Directory: /home/szm Shell: /bin/bash
On since Tue Mar 5 22:26 (CST) on tty1 from :0
18 hours 29 minutes idle
On since Tue Mar 5 22:26 (CST) on pts/0 from :0.0
No mail.
No Plan.
Login: ipq Name: szm
Directory: /home/ipq Shell: /bin/bash
Never logged in.
No mail.
No Plan.
[root@szm Desktop]# su --help
Usage: su [OPTION]... [-] [USER [ARG]...]
Change the effective user id and group id to that of USER.
-, -l, --login make the shell a login shell
-c, --command=COMMAND pass a single COMMAND to the shell with -c
--session-command=COMMAND pass a single COMMAND to the shell with -c
and do not create a new session
-f, --fast pass -f to the shell (for csh or tcsh)
-m, --preserve-environment do not reset environment variables
-p same as -m
-s, --shell=SHELL run SHELL if /etc/shells allows it
--help display this help and exit
--version output version information and exit
A mere - implies -l. If USER not given, assume root.
Report su bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'su invocation'
[root@szm Desktop]# visudo---------------vi权限分配