centos文件与权限
切换目录
cd:切换目录。 当我们需要进入到别的目录的时候,就需要使用到cd这个命令。 ‘ cd这个命令主要有以下几种使用方式; cd [~]:进入当前用户的家目录,比如我是fuwh这个用户登陆的,则进入到/home/fuwh目录 cd 目录名:进入到指定的目录 cd .:就代表当前目录 cd ..:代表进入上一层目录,比如我现在在/home/fuwh下的时候,使用该命令,则会进入到/home目录下。 cd -:代表前一个工作目录,比如我们经常需要在两个目录之间切换,则可以使用这种快捷方式。
查看文件列表
|
目录处理命令:ls |
|
|
命令名称: |
ls |
|
命令英文原意: |
list |
|
命令所在路径: |
/bin/ls |
|
执行权限: |
所有用户 |
|
功能描述: |
显示目录文件 |
|
语法: |
ls 选项[-ald][文件或目录] |
|
-a 显示所有文件,包括隐藏文件 |
|
|
-l 详细信息显示 |
|
|
-d 查看目录属性 |
|
ls -lh是将文件大小的字节显示转变成我们所熟悉的Windows
ls -lhd /etc 是查看etc目录的大小而不是查看ect目录下的所有内容。
#ls -i 查看每个文件的id号
权限标志
r 表示文件可以被读(read)
w 表示文件可以被写(write)
x 表示文件可以被执行(如果它是程序的话)
- 表示相应的权限还没有被授予
权限分组
例-rw-r--r-- 1 root root 48 Jan 8 20:14 token.txt
最开始的10位数 -rw-rw-r--
第一位代表的是类型
后续三个一组,共三组
每组三个含义为:读(r)写(w)执行权限(x)
三个组权限对象依次为:"当前用户"、"同组用户"、"不同组用户"
通过上面的解释,就可以看出 token.txt 文件的权限是:
当前用户本身:可读可写,没有可执行权限
当前用户组群:可读不可写,没有可执行权限
其他用户:可读不可写,没有可执行权限
rwx 也可以用数字来代替
r ------------
w ------------
x ------------
- ------------
权限对应数字,八进制
-rw------- () 0420000000 只有所有者才有读和写的权限
-rw-r--r-- () 0420400400 只有所有者才有读和写的权限,组群和其他人只有读的权限
-rwx------ () 0421000000 只有所有者才有读,写,执行的权限
-rwxr-xr-x () 0421401401 只有所有者才有读,写,执行的权限,组群和其他人只有读和执行的权限
-rwx--x--x () 0421001001 只有所有者才有读,写,执行的权限,组群和其他人只有执行的权限
-rw-rw-rw- () 0420420420 每个人都有读写的权限
-rwxrwxrwx () 0421421421 每个人都有读写和执行的权限
修改文件权限
chmod 777 file|dir (-R递归到子文件)
[root@iZwz9id7ajv83jhb9gicj0Z spiders]# chmod test_data/ -R
[root@iZwz9id7ajv83jhb9gicj0Z spiders]# ls
batj_kb.py batj_yb.py __init__.py items.py sztj_tjkb.py sztj_tjyb.py test_data
batj_kb.pyc batj_yb.pyc __init__.pyc items.pyc sztj_tjkb.pyc sztj_tjyb.pyc
[root@iZwz9id7ajv83jhb9gicj0Z spiders]# ls -l
total
-rw-r--r-- spiderftp ftp Sep : batj_kb.py
-rw-r--r-- spiderftp ftp Sep : batj_kb.pyc
-rw-r--r-- spiderftp ftp Sep : batj_yb.py
-rw-r--r-- spiderftp ftp Sep : batj_yb.pyc
-rw-r--r-- spiderftp ftp Sep : __init__.py
-rw-r--r-- spiderftp ftp Sep : __init__.pyc
-rw-r--r-- spiderftp ftp Sep : items.py
-rw-r--r-- spiderftp ftp Sep : items.pyc
-rw-r--r-- spiderftp ftp Sep : sztj_tjkb.py
-rw-r--r-- spiderftp ftp Sep : sztj_tjkb.pyc
-rw-r--r-- spiderftp ftp Sep : sztj_tjyb.py
-rw-r--r-- spiderftp ftp Sep : sztj_tjyb.pyc
drwxrwxrwx spiderftp ftp Sep : test_data
[root@iZwz9id7ajv83jhb9gicj0Z spiders]# cd test_data/
[root@iZwz9id7ajv83jhb9gicj0Z test_data]# ls -l
total
-rwxrwxrwx spiderftp ftp Sep : batj_kb.py
-rwxrwxrwx spiderftp ftp Sep : batj_kb.pyc
-rwxrwxrwx spiderftp ftp Sep : batj_yb.py
-rwxrwxrwx spiderftp ftp Sep : batj_yb.pyc
-rwxrwxrwx spiderftp ftp Sep : __init__.py
-rwxrwxrwx spiderftp ftp Sep : __init__.pyc
-rwxrwxrwx spiderftp ftp Sep : items.py
-rwxrwxrwx spiderftp ftp Sep : items.pyc
-rwxrwxrwx spiderftp ftp Sep : sztj_tjkb.py
-rwxrwxrwx spiderftp ftp Sep : sztj_tjkb.pyc
-rwxrwxrwx spiderftp ftp Sep : sztj_tjyb.py
-rwxrwxrwx spiderftp ftp Sep : sztj_tjyb.pyc
drwxrwxrwx root root Sep : test
修改文件所属用户
chown user file|dir (-R递归到子文件)
[root@iZwz9id7ajv83jhb9gicj0Z spiders]# ls -l
total
-rw-r--r-- spiderftp ftp Sep : batj_kb.py
-rw-r--r-- spiderftp ftp Sep : batj_kb.pyc
-rw-r--r-- spiderftp ftp Sep : batj_yb.py
-rw-r--r-- spiderftp ftp Sep : batj_yb.pyc
-rw-r--r-- spiderftp ftp Sep : __init__.py
-rw-r--r-- spiderftp ftp Sep : __init__.pyc
-rw-r--r-- spiderftp ftp Sep : items.py
-rw-r--r-- spiderftp ftp Sep : items.pyc
-rw-r--r-- spiderftp ftp Sep : sztj_tjkb.py
-rw-r--r-- spiderftp ftp Sep : sztj_tjkb.pyc
-rw-r--r-- spiderftp ftp Sep : sztj_tjyb.py
-rw-r--r-- spiderftp ftp Sep : sztj_tjyb.pyc
drwxrwxrwx spiderftp ftp Sep : test_data
[root@iZwz9id7ajv83jhb9gicj0Z spiders]# chown root test_data/ -R
[root@iZwz9id7ajv83jhb9gicj0Z spiders]# ls -l
total
-rw-r--r-- spiderftp ftp Sep : batj_kb.py
-rw-r--r-- spiderftp ftp Sep : batj_kb.pyc
-rw-r--r-- spiderftp ftp Sep : batj_yb.py
-rw-r--r-- spiderftp ftp Sep : batj_yb.pyc
-rw-r--r-- spiderftp ftp Sep : __init__.py
-rw-r--r-- spiderftp ftp Sep : __init__.pyc
-rw-r--r-- spiderftp ftp Sep : items.py
-rw-r--r-- spiderftp ftp Sep : items.pyc
-rw-r--r-- spiderftp ftp Sep : sztj_tjkb.py
-rw-r--r-- spiderftp ftp Sep : sztj_tjkb.pyc
-rw-r--r-- spiderftp ftp Sep : sztj_tjyb.py
-rw-r--r-- spiderftp ftp Sep : sztj_tjyb.pyc
drwxrwxrwx root ftp Sep : test_data
修改文件所属组
chgrp group file|dir (-R递归到子文件)
[root@iZwz9id7ajv83jhb9gicj0Z spiders]# ls -l
total
-rw-r--r-- spiderftp ftp Sep : batj_kb.py
-rw-r--r-- spiderftp ftp Sep : batj_kb.pyc
-rw-r--r-- spiderftp ftp Sep : batj_yb.py
-rw-r--r-- spiderftp ftp Sep : batj_yb.pyc
-rw-r--r-- spiderftp ftp Sep : __init__.py
-rw-r--r-- spiderftp ftp Sep : __init__.pyc
-rw-r--r-- spiderftp ftp Sep : items.py
-rw-r--r-- spiderftp ftp Sep : items.pyc
-rw-r--r-- spiderftp ftp Sep : sztj_tjkb.py
-rw-r--r-- spiderftp ftp Sep : sztj_tjkb.pyc
-rw-r--r-- spiderftp ftp Sep : sztj_tjyb.py
-rw-r--r-- spiderftp ftp Sep : sztj_tjyb.pyc
drwxrwxrwx root ftp Sep : test_data
[root@iZwz9id7ajv83jhb9gicj0Z spiders]# chgrp root test_data/
[root@iZwz9id7ajv83jhb9gicj0Z spiders]# ls -l
total
-rw-r--r-- spiderftp ftp Sep : batj_kb.py
-rw-r--r-- spiderftp ftp Sep : batj_kb.pyc
-rw-r--r-- spiderftp ftp Sep : batj_yb.py
-rw-r--r-- spiderftp ftp Sep : batj_yb.pyc
-rw-r--r-- spiderftp ftp Sep : __init__.py
-rw-r--r-- spiderftp ftp Sep : __init__.pyc
-rw-r--r-- spiderftp ftp Sep : items.py
-rw-r--r-- spiderftp ftp Sep : items.pyc
-rw-r--r-- spiderftp ftp Sep : sztj_tjkb.py
-rw-r--r-- spiderftp ftp Sep : sztj_tjkb.pyc
-rw-r--r-- spiderftp ftp Sep : sztj_tjyb.py
-rw-r--r-- spiderftp ftp Sep : sztj_tjyb.pyc
drwxrwxrwx root root Sep : test_data
centos文件与权限的更多相关文章
- CentOS 文件特殊权限SUID,SGID,SBIT
1.SUID ,是一种对二进制程序进行设置的特殊权限,可以让二进制程序的执行者临时拥有所有者的权限(仅对拥有执行权限的二进制程序有效). (1)SUID权限仅对二进制程序有效: (2)本权限仅在执行该 ...
- centos中,tomcat项目创建文件的权限
参考文章:https://cloud.tencent.com/info/5f02caa932fd6dbfc46a3bb01af135e0.html 我们在centos中输入umask,会看到输出002 ...
- centos修改文件及文件夹权限
查看文件权限的语句: 在终端输入:ls -l xxx.xxx (xxx.xxx是文件名) 那么就会出现相类似的信息,主要都是这些:-rw-rw-r-- 一共有10位数 其中: 最前面那个 - 代表的是 ...
- centos文件权限详解
假设回显信息为 ①-②rws③r-x④r-x ⑤1 ⑥root ⑦root ⑧430540 ⑨Dec 20 18:27 ⑩/usr/sbin/passwd ,现在逐一分析其内容. ①. 首字符-,表 ...
- CentOS文件权限管理
目录 文件属性 chown更改所有者 chgrp更改所属组 文件权限rwx chmod修改权限 默认权限umask 权限判定的顺序 特殊权限SUID,SGID,sticky 隐藏权限chattr,ls ...
- Linux CentOS更改文件的权限
chgrp (全称:change group) groupadd testgroup 添加用户组 chgrp testgroup test1 修改文件的所属用户组是testgroup. 如果test ...
- centos 网站目录权限参考
Linux下Apache网站目录读写权限的设置 网站目录文件权限的设置对网站的安全至关重要,下面简单介绍网站目录文件权限的基本设定. 我们假设http服务器运行的用户和用户组是www,网站用户为cen ...
- 第3章 Linux上文件的权限管理
3.1 文件/目录的权限 3.1.1 文件的权限 每个文件都有其所有者(u:user).所属组(g:group)和其他人(o:other)对它的操作权限,a:all则同时代表这3者.权限包括读(r:r ...
- centos文件/文件夹操作-检查磁盘、内存、cpu使用情况-vi操作命令
Part1:CentOS文件/文件夹操作 1.新建文件夹 即创建目录 mkdir 文件名 新建一个名为test的文件夹在home下 vi source1 mkdir /home/test 注意:当创建 ...
随机推荐
- ubuntu16安装MySQL
MySQL 是一种开源数据库管理系统,通常作为流行的LAMP(Linux,Apache,MySQL,PHP / Python / Perl)堆栈的一部分安装.它使用关系数据库和SQL(结构化查询语言) ...
- 热修改 MySQL 数据库 pt-online-schema-change 的使用详解
由于周五公司团建的关系所以此篇推迟了抱歉. 首先不得不在该篇里面梳理一个数据库热增加删除字段表的工具 pt-online-schema-change 这个工具在前面我的博文 <关于utf8mb4 ...
- 买了本Delphi面向对象编程思想,正在看,产生些问题。
1:第33页说,Delphi通过调用类的一个构造函数来建立一个对象的实例,对象至少有一个create()的构造函数,使用时候写MyObject:=TmyObject.create即可. 但是第37 ...
- git常用命令及用法小计
git init 初始化一个本地git仓库repository git status 查看状态 git add <file> 将工作区修改加到暂存区(stage) git commit - ...
- 如何停止处于stopping状态的windows服务
工作中有时需要启动和停止windows service,有时候会出现服务处于stopping或者starting的状态,但是,在services界面中,start service/stop servi ...
- jQuery添加和删除元素
添加新的 HTML 内容 我们将学习用于添加新内容的四个 jQuery 方法: append() - 在被选元素的结尾插入内容 prepend() - 在被选元素的开头插入内容 after() - 在 ...
- 图之强连通、强连通图、强连通分量 Tarjan算法
原文地址:https://blog.csdn.net/qq_16234613/article/details/77431043 一.解释 在有向图G中,如果两个顶点间至少存在一条互相可达路径,称两个顶 ...
- LOJ #6436. 「PKUSC2018」神仙的游戏(字符串+NTT)
题面 LOJ #6436. 「PKUSC2018」神仙的游戏 题解 参考 yyb 的口中的长郡最强选手 租酥雨大佬的博客 ... 一开始以为 通配符匹配 就是类似于 BZOJ 4259: 残缺的字符串 ...
- Leetcode 344.反转字符串 By Python
请编写一个函数,其功能是将输入的字符串反转过来. 示例: 输入:s = "hello" 返回:"olleh" 思路 Python里面的切片用来解决这个问题就很快 ...
- Mysql 数据库 基础代码
-- 创建数据库 CREATE DATABASE book; -- 创建作者表 CREATE TABLE authors( Id int not NULL, -- 作者编号 Fname VARCHAR ...