Fourth, the traditional IDC deployment site

Traditional IDC deployment site
a, rm command
Second, the PATH environment variable
three, CP command
four, MV command
five, cat, more, less, head , tail
six file or directory permissions chmod
Seven, owner belongs group chown
eight, umask
I. rm command

Fourth, the traditional IDC deployment site
rm can delete files and non-empty directory
rm -f deleted without compulsory to ask history can be viewed on the command once used
! tree tree can be used as a prefix command! Similarly touch
rm -r delete a directory rm -rf rm -rfv not prompted to remove all visual deleted

Second, the environment variable to the PATH
Which can view the path where there is no command and Alias Alias
the PATH environment variable there is a lot of absolute path: divide, these paths following command can be used directly, no need to add a directory path

Fourth, the traditional IDC deployment site

Three, CP command

A copy of the original file into an object file
directly copy the directory cp -r and rm need to increase the use of the same
copy of the source did not add / copy target did not add /
use cp when all copies of the directory are recommended plus / directory does not exist even if the
tree! $ On the last parameter of a command
! a command begins with the command tree on the tree
cp is an alias which cp which has a -i option it is a safe option
if you use cp to copy a file, it will ask if you cover it with the direct use cp -i parameter
using the / usr / bin / cp it will not ask if you cover
if a copy of the directory when it does not ask if you cover
when the target directory already exists it will directly into the source directory to the target directory, if the directory does not exist it will copy over the source directory and change the name of
the source files in the source directory target file copy target directory file with the -r option

Fourth, the traditional IDC deployment site

Four, MV command

If you use the same directory name MV equivalent modifications will ask whether if the target exists if you cover the
target directory does not exist when it is equivalent to modify the name of the target directory exists if the source directory when it will go into the directory
mv source directory target directory

Fourth, the traditional IDC deployment site

五、cat、more、less、head、tail
cat查看文件内容 cat /etc/passwd
tac倒序查看文件内容 tac /etc/passwd
cat -A 显示所有字符 cat -A /etc/passwd cat -n 可以把行号显示出来 cat -n /etc/passwd
wc 可以查看一个文件的行数
more是表示一屏一屏显示 按空格往下翻页 按ctrlb 往上翻页 看完自动退出
less和more差不多,支持方向键往上下看 结尾的时候不会自动退出,需要你按q (quit)
less还可以进行搜索,查看的时候按/加搜索条件,它会高亮显示按n会查看这个文档里面是否还包含有带搜索条件的内容 也可以使用?搜索shift N往前面看 小n往下看 g G定位首行末行
less可以使用more所有功能
head查看一个文件的头10行 tail查看文件的尾10行 可以指定查看的行数
head -n 2 anaconda -ks.cfg.1 tail -n 2 anaconda -ks.cfg.1
tail -f 动态的显示文件的内容 一直在写入的文件 如日志

六、文件或目录权限chmod
chmod =change mode
r表示可读 w表示可写 x表示可执行 r=4 w=2 x=1
drwxr-xr-x.从第二位看到第十位 第十一位代表你如果开启了selinux创建的第十一位就会有.
getenforce查看selinux状态 默认是开启状态 vi /etc/selinux/config编辑配置文件并重启才会生效
第一段表示所有者 第二段表示所属组(用户组) 第三段代表除了所有者及所属组之外的用户权限
chmod -R 可以把目录和目录下面的文件批量的更改权限
chmod u=rwx,g=r,o=r U=user g=group o=other
chmod a+x 所有的文件或目录全部加上X执行权限,也可以a-x 全部取消执行权限
g+x g-x o+x o-x 都可以

七、更改所有者和所属组chown
chown =change owner
chown -R username:group filename 如果不加:就是更改所有者 加:更改所有者和所属组

Fourth, the traditional IDC deployment site
Eight, umask
umask defaults to modify the umask 0022 umask value and you need to change the value of
umask is to determine the default permissions for files and directories
directory must have permission to open X, X-file permissions to perform so the default directory for the file to 644 755
to confirm the permission based on the value of umask command can directly view the value of the file 666-umask value to confirm the value of the catalog 777-umask to confirm
the law of the case, but not necessarily if = 003 umask
666 = (rw-rw-rw- ) - (------- WX) = RW-RW-R & lt - 664 =
777 = (rwxrwxrwx) - (------- WX) = rwxrwxr - = 774
can not be reduced but the number using nine permission bits have nothing to subtract the -x -w still nothing

Guess you like

Origin blog.51cto.com/13292790/2433783