các lệnh cơ bản trong centos 6 – phần 1 _ kiến thức công nghệ, thủ thuật máy...
Post on 14-Apr-2017
236 Views
Preview:
TRANSCRIPT
Cac Lenh Ca ban trong CentOS 6
Posted by admin On April 21, 2014 5 Comments
l.useradd - Lenh tao User hoac chinh siia thong tin User.
Cu phap useradd <user name>
Cac lenh tuy chon voi useradd
-s the login shell for the new user account
# useradd -s /sbin/nologin user
-d home directory for the new user account
# useradd -d /home/user user
-g force use GROUP for the new user account
# useradd -g group user
phan 1-e set account expiration date to EXPIRE_DAT
-uforce use the UID for the new user account # useradd
-u 550 user
-mcreate home directory for the new user account #
useradd -m user
-Mdo not create user's home directory(overrides
/etc/login.defs) # useradd -M user
2. passwd - dung d§ tao password chfrng th^c cho user
Cu phap passwd<usernam>
Cac len tuy chon voi passwd
This is a quick way to disable a password for
an account # passwd -d user
This option is used to lock the specified account and it is
available to root only # passwd -l user
This is the reverse of the -l option - it will unlock the account password by removing the ! prefix
# passwd -u user
This will set the maximum password lifetime, in days, if the user's account supports password life-times
# passwd -x 10 user
This will set the minimum password lifetime, in days, if the user's account supports password life-times. Available to root only
# passwd -n 10 user
This will set the number of days which will pass before an expired password for this account will be taken to mean that the account is inactive and should be disabled, if the user's account supports pass-word lifetimes
# passwd -i 10 user
-w This will set the number of days in advance the user will begin receiving
warnings that her password will expire, if the user's account supports password lifetimes
# passwd -w 10 user
-S This will output a short information about the status of the password for a
given account
# passwd -S user
user PS 2009-09-12 0 99999 7 -1 (Password set, MD5 crypt.)
3. exit- dung de kit thuc phien lam viec
4. su-dung de chuyen toi user cu
phap us - <user name>
5. usermod- dung de tuy chinh user account. cu
phap usermod -<tuy chon><user name>
-d new home directory for the user account
-g force use GROUP as new primary group
-G new list of supplementary GROUPS
-s new login shell for the user account
-u new UID for the user account
-L lock the user account
-U unlock the user account
6. vi- lenh cho phep chinh siia cu
phap vi <file> tuy chon voi lenh vi.
chuyen doi Command mode/Input Mode
Luu va thoat.
Biiu khien con tro
Bilu khien thanh cuon
Bilu khien chinh sua
V , , ,
Dieu khien tlm kiem.
7. Newaliases- lenh dung de clu hlnh thay doi
8. chkconfig- truy vln va cap nhat
thong tin services. cu phap chkconfig
<services>
Cac Lenh Ca ban trong CentOS 6 - phan 2
Posted by admin On April 22, 2014 10 Comments
1. yum-tuy chon update
cu phap yum <option command package>
command
install Install a package or packages on your system
# yum install package
update Update a package or packages on your system
# yum update package
remove Remove the packages
# yum remove package
groupinstall Install the packages in a group on your system
yum groupinstall "X Window System" groupupdate Update the packages in a group on your systemyum groupupdate "X Window System"
Remove the packages in a group from your
system
# yum groupremove "X Window
System"
List a package or groups of packages
# yum lis t
=> display packages that is possible to install
# yum list installed
=> display installed packages
Check for available package updates
# yum check-update
Display details about a package or group of packages
# yum info package
Search package details for the given string
# yum s earch keyword
List a package's dependencies
groupremove
list
check-update
info
search
deplist
yum deplist package
option
answer yes for all questions # yum -y
install package
enable one or more repositories (wildcards allowed)
# yum -enablerepo=repo install
package
disable one or more repositories (wildcards
allowed)
# yum -disablerepo=repo
install package exclude
package(s) by name or glob
-y
-enablerepo=repo
-disablerepo=repo
-exclude=package
-noplugins
yum -exclude=package update disable Yum plugin
s# yum -noplugins update
2. wget - The non-interactive network
downloader [SYNOPSIS] wget URL
option
-c resume getting a partially-
downloaded file
3. rpm - quan ly Package RPM
[Cu phap ] rpm <OPTION PACKAGE>
option
This installs a new package
# rpm -i package
This will upgrade packages, but only if an earlier version currently exists
# rpm -F package
-V
This upgrades or installs the package currently installed to a newer version
# rpm -U package erase
(uninstall) package
# rpm -e package query
packages
# rpm -q package verify
installed packages
-F -U -e
-q
rpm -V package
-V
verify package signature
# rpm -K package
rebuild the database indices from the installed package headers
# rpm -rebuilddb
create a new database if one doesn't already exist
# rpm
-initdb
import
PUBKEY
# rpm -import /usr/share/rhn/RPM-GPG-KEY
show package name
-rebuilddb
-initdb
-import
options with i, U
rpm -iv package
display progress
# rpm -ivh package
Print lots of ugly debugging information
# rpm -ivv package
Don't do a dependency check before installing or upgrading a package
# rpm -ivh -nodeps package
Don't really uninstall anything, just go through the motions
# rpm -ivh -test package
Query all installed packages
# rpm -qa
Display package information, including name, version, and description. This uses the -queryformat if one was specified
-nodeps
-test
options with q
rpm -qi package List files in packag
erpm -ql package
-c List only configuration files (implies -l)
# rpm -qc package
-d List only documentation files (implies -l)
# rpm -qd package
-f Query package owning FILE
# rpm -qf /bin/bash
-R List packages on which this package depends
# rpm -qR package
-s Display the states of files in the package (implies -l)
# rpm -qs package
-last Orders the package listing by install time such that the latest
packages are at the top
# rpm -q -last package
-changelog Display change information for the package
# rpm -q -changelog package
4. source
Doc va thyc hien lenh tiU ten file trong ciia so lenh hien tai ,tra vi trang thai sau khi da
thyc hien lenh
5. visudo- chinh siia sudoers file
[cu phap] visudo
OPTION
option
-c Enable check-only mode
-f FILE Specify and alternate sudoers file location
-q Enable quiet mode
-s Enable strict checking of the sudoers file
6.shutdown -tit he thing
[cu phap] shutdown OPTION TIME MESSAGE
7.sudo - sudoedit - execute a command as
another user [SYNOPSIS] sudo OPTION
COMMAND
option
-u USER causes sudo to run the specified command as a user other than
root
-s runs the shell specified by the SHELL environment variable if it is
set or the shell as specified in passwd(5)
-H sets the HOME environment variable to the homedir of the target
user (root by default) as specified in passwd(5)
-l The -l (list) option will list out the allowed (and forbidden)
commands for the invoking user on the current host
-h show help
-v sudo will update the user's timestamp, prompting for the user's
password if necessary
-k The option to sudo invalidates the user's timestamp by setting
the time on it to the Epoch
-K The option is like -k except that it removes the user's timestamp
entirely
-b The option tells sudo to run the given command in the
background
8.userdel - xoa user account hoac file lien quan
[cu phap] userdel OPTION USER
option
-r
remove home directory and mail spoo
lCac Lenh Co ban trong CentOS 6 - phan 3
Posted by admin On April 23, 2014 4 Comments
l.echo - hien thi dong cua text
[Cu phap] echo OPTION STRING
option
-n do not output the trailing newline
-e enable interpretation of backslash escapes
2. dig - DNS lookup utility
[cu phap] dig OPTION (HOST NAME/IP ADDR)
option
typical invocation
# dig yahoo.com
-x reverse invocation
# dig -x 111.222.333.444
3.ls - Liet ke danh sach noi dung cua directory
[Cu phap] ls OPTION FILE/DIRECTORY
option
-X sort alphabetically by entry extension with -l,
4.rndc - Bilu khien server [cu phap] rndc
COMMAND
command
5.Ismod-chuong trinh cho chep hien thi trang thai cua modules trong Linux
Kernel [cu phap] lsmod
6.grep-xult ra phien phan cua kvm
[Cu phap] grep OPTION
PATTERN FILE opition
-i Ignore case distinctions in both the PATTERN and the input files
-n Prefix each line of output with the 1-based line number within its
input file
-v Invert the sense of matching, to select non-matching
lines
-w Select only those lines containing matches that form
whole words
-r(R) dir Read all files under each directory, recursively; this is
equivalent
to the -d recurse
option # grep -r 'word'
dir
7. cd-thay doi directory [cu phap] cd DIRECTORY
8.cp-copy file va directories.
[cu phap] cp OPTION(SOURCE FILE/DIRECTORY)[DEST FILE/DIRECTORY]
OPTION
# cp -R dir /etc
8. mkdir-tao directories
[cu phap] mkdir OPTION DIRECTORY
otion
-p no error if existing, make parent directories as needed
# mkdir /home/dir1/dir2
-m set permission mode (as in chmod), not rwxrwxrwx -
umask
# mkdir -m 700 dir
9. modprobe-la chuong trlnh dung de add hay remove mot modul tij Linux Kernel
[cu phap]modprobe OPTION
MODULE option
top related