2019独角兽企业重金招聘Python工程师标准>>>

此篇博客目录:

1.    linux系统目录结构

2.    ls命令

3.    文件类型

4.    alias命令

5.    相对路径和绝对路径

6.    cd命令

7.    mkdir and rmdir

8.    rm命令

9.    环境变量PATH

10.  cp命令

11.  mv命令

12.  文档查看(cat more less head tail)

13.  chmod命令

14.  chown and chgrp 命令

15.  umask命令

linux系统目录结构介绍:

使用 tree -L 1 / 命令查询整个根目录:

[root@ln /]# tree -L 1/

.

├── bin -> usr/bin 用来储存系统命令的文件目录

├── boot 系统启动相关文件目录

├── dev 设备文件目录

├── etc 系统配置文件目录

├── home 用户家目录

├── lib -> usr/lib 库文件目录

├── lib64 -> usr/lib64 库文件目录

├── media 媒介目录

├── mnt 临时挂载目录

├── opt 空目录

├── proc 系统启动进程目录 !

├── qq (这个是我自己创建的。。略过)

├── root 用户家目录

├── run 一些进程产生的临时文件

├── sbin -> usr/sbin 用来储存系统命令的文件目录

├── srv 空目录--存服务产生的一些文件

├── sys 存系统内核文件

├── tmp 系统的临时目录

├── usr 存储用户文件

└── var 存储系统日志

上图中有 -> 这个符号 后面跟了个目录。 这个意思代表是软链接的意思。后面会详解

系统目录文件夹图片:http://www.apelearn.com/study_v2/linux_dir_tree.jpg

LS 命令:

ls 显示该目录下的所有文件(但不包括隐藏文件)

[root@ln ~]# ls

1 1.txt 2.txt 3.txt 4.txt 666 anaconda-ks.cfg qq qw qwe

[root@ln ~]#

-a 显示该目录下的所有文件(包括隐藏文件)

[root@ln ~]# ls -a

. 1 2.txt 4.txt anaconda-ks.cfg .bash_logout .bashrc qq qwe .tcshrc

.. 1.txt 3.txt 666 .bash_history .bash_profile .cshrc qw .ssh .viminfo

[root@ln ~]#

-l 显示该目录下所有文件的详细信息

[root@ln ~]# ls -l

总用量 8

-rw-r--r--. 1 root root 0 5月 3 22:51 1

-rw-rw-r--. 1 root root 0 5月 10 07:16 1.txt

-rw-r--r--. 1 root root 0 5月 10 04:55 2.txt

-rw-r--r--. 1 root root 0 5月 10 07:17 3.txt

-rw-rw-r--. 1 root root 0 5月 10 07:20 4.txt

-rw-r--r--. 1 root root 28 5月 3 23:03 666

-rw-------. 1 root root 1368 5月 4 06:24 anaconda-ks.cfg

drwxrwxrwx. 3 root root 67 5月 10 05:04 qq

drwxrwxr-x. 2 root root 6 5月 10 05:05 qw

drwxrwxr-x. 2 root root 6 5月 10 07:19 qwe

[root@ln ~]#

-l 命令 等于 ll 命令

[root@ln ~]# ll

总用量 8

-rw-r--r--. 1 root root 0 5月 3 22:51 1

-rw-rw-r--. 1 root root 0 5月 10 07:16 1.txt

-rw-r--r--. 1 root root 0 5月 10 04:55 2.txt

-rw-r--r--. 1 root root 0 5月 10 07:17 3.txt

-rw-rw-r--. 1 root root 0 5月 10 07:20 4.txt

-rw-r--r--. 1 root root 28 5月 3 23:03 666

-rw-------. 1 root root 1368 5月 4 06:24 anaconda-ks.cfg

drwxrwxrwx. 3 root root 67 5月 10 05:04 qq

drwxrwxr-x. 2 root root 6 5月 10 05:05 qw

drwxrwxr-x. 2 root root 6 5月 10 07:19 qwe

[root@ln ~]#

-t 按时间排序

[root@ln ~]# ls -lt

总用量 8

-rw-rw-r--. 1 root root 0 5月 10 07:20 4.txt

drwxrwxr-x. 2 root root 6 5月 10 07:19 qwe

-rw-r--r--. 1 root root 0 5月 10 07:17 3.txt

-rw-rw-r--. 1 root root 0 5月 10 07:16 1.txt

drwxrwxr-x. 2 root root 6 5月 10 05:05 qw

drwxrwxrwx. 3 root root 67 5月 10 05:04 qq

-rw-r--r--. 1 root root 0 5月 10 04:55 2.txt

-rw-------. 1 root root 1368 5月 4 06:24 anaconda-ks.cfg

-rw-r--r--. 1 root root 28 5月 3 23:03 666

-rw-r--r--. 1 root root 0 5月 3 22:51 1

[root@ln ~]#

-d 只显示目录

[root@ln ~]# ls -d

.

[root@ln ~]#

文件类型:

普通文件(-表示,可用ls -l查看)

目录(d)

字符设备文件(c)

块设备文件(b)

套接口文件(s)

管道(p)

符号链接文件(l)

Alias命令:

查看系统里面所有的命令别名

[root@ln ~]# alias

alias cp='cp -i'

alias egrep='egrep --color=auto'

alias fgrep='fgrep --color=auto'

alias grep='grep --color=auto'

alias l.='ls -d .* --color=auto'

alias ll='ls -l --color=auto'

alias ls='ls --color=auto'

alias mv='mv -i'

alias rm='rm -i'

alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

[root@ln ~]#

创建一个别名 alias ln=‘ls -l’

[root@ln ~]# alias ln='ls -l'

[root@ln ~]# ln

总用量 8

-rw-r--r--. 1 root root 0 5月 3 22:51 1

-rw-rw-r--. 1 root root 0 5月 10 07:16 1.txt

-rw-r--r--. 1 root root 0 5月 10 04:55 2.txt

-rw-r--r--. 1 root root 0 5月 10 07:17 3.txt

-rw-rw-r--. 1 root root 0 5月 10 07:20 4.txt

-rw-r--r--. 1 root root 28 5月 3 23:03 666

-rw-------. 1 root root 1368 5月 4 06:24 anaconda-ks.cfg

drwxrwxrwx. 3 root root 67 5月 10 05:04 qq

drwxrwxr-x. 2 root root 6 5月 10 05:05 qw

drwxrwxr-x. 2 root root 6 5月 10 07:19 qwe

[root@ln ~]#

取消别名 unalias ln

[root@ln ~]# unalias ln

[root@ln ~]# ln

ln: 缺少了文件操作数

Try 'ln --help' for more information.

[root@ln ~]#

相对路径和绝对路径:

绝对路径:

从根开始的路径,它指定到的目录或者文件具有唯一性,意思是不管目前在哪一个目录下面,你只要使用绝对路径就可以定位到系统任何一个目录或文件。

相对路径:

相对于当前目录,要定位到一个目录或文件所经过的路径

CD命令:

cd 进入用户的家目录 等同于 cd ~

[root@ln /]# pwd

/

[root@ln /]# cd

[root@ln ~]# pwd

/root

[root@ln ~]#

cd . 表示当前的目录

[root@ln ~]# pwd

/root

[root@ln ~]# cd .

[root@ln ~]# pwd

/root

[root@ln ~]#

cd .. 表示进入上一级目录

[root@ln ~]# pwd

/root

[root@ln ~]# cd ..

[root@ln /]# pwd

/

[root@ln /]#

cd - 表示在当前目录和上一个目录之间来回切换

[root@ln ~]# cd -

/

[root@ln /]# cd -

/root

[root@ln ~]#

MKDIR and RMDIR:

MKDIR:创建目录

-p 递归创建目录

[root@ln ~]# mkdir -p /qw/ln/1

[root@ln ~]# tree /qw

/qw

└── ln

└── 1

2 directories, 0 files

[root@ln ~]#

RMDIR:删除目录

[root@ln ~]# rmdir /qw/ln/1

[root@ln ~]# tree /qw

/qw

└── ln

1 directory, 0 files

[root@ln ~]#

但仅能删除非空目录

[root@ln ~]# rmdir /qw/ln

rmdir: 删除 "/qw/ln" 失败: 目录非空

[root@ln ~]#

RM命令:

[root@ln ~]# ls

2.txt 3.txt 4.txt 666 anaconda-ks.cfg qq qw qwe

[root@ln ~]# rm 2.txt

rm:是否删除普通文件 "2.txt"?y

[root@ln ~]# ls

3.txt 4.txt 666 anaconda-ks.cfg qq qw qwe

[root@ln ~]#

-r 删除目录

[root@ln qw]# tree /qw

/qw

└── ln

└── 1

├── 2

└── 3

4 directories, 0 files

[root@ln qw]# rm -r /qw/ln/1/2

rm:是否删除目录 "/qw/ln/1/2"?y

[root@ln qw]# tree /qw

/qw

└── ln

└── 1

└── 3

3 directories, 0 files

[root@ln qw]#

-rf 没有提示直接删除

[root@ln ~]# ls

3.txt 4.txt 666 anaconda-ks.cfg qq qw qwe

[root@ln ~]# rm -rf 666

[root@ln ~]# ls

3.txt 4.txt anaconda-ks.cfg qq qw qwe

[root@ln ~]#

PATH环境变量:

新定义一个环境变量

[root@ln ~]# export HELLO='ln'

[root@ln ~]# echo $HELLO

ln

[root@ln ~]#

在环境变量中,可以直接查找,不用绝对路径。用echo $PATH查看环境变量

[root@ln ~]# echo $PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

由于 ls 在/usr/bin/ 下 所以输入ls命令就不需要输入它的绝对路径。

[root@ln ~]# ls

3.txt 4.txt anaconda-ks.cfg qq qw qwe

[root@ln ~]# cp /usr/bin/ls /tmp/ls2

[root@ln ~]# /tmp/ls2

3.txt 4.txt anaconda-ks.cfg qq qw qwe

[root@ln ~]# ls2

-bash: ls2: 未找到命令

[root@ln ~]#

现在我在环境变量中增加一个 /tmp/ 目录 这样 ls2也就可以直接执行

1. 第一步 先 输入命令: vi /etc/profile

2. 进入后 把光标移动到最后 在最末尾增加一行命令 PATH=$PATH:/TMP/ 后 wq保存退出

完成之后 输入命令查看 echo $PATH 就会看到增加了一个 /tmp/

[root@ln ~]# echo $PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/tmp/:/root/bin

[root@ln ~]#

现在 输入 ls2 命令 就可以直接使用了.

[root@ln ~]# ls2

3.txt 4.txt anaconda-ks.cfg qq qw qwe

[root@ln ~]#

如果你不需要增加这个环境变量那么就还是进入/etc/profile 删除掉你增加的那一行就可以了

再次 echo $PATH 就没有这个环境变量了

[root@ln ~]# echo $PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

[root@ln ~]# ls2

-bash: ls2: 未找到命令

[root@ln ~]#

这是在目录里增加环境变量的方法,还有一种 直接复制增加就行,步骤如下:

[root@ln ~]# echo $PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

[root@ln ~]# PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/tmp/

[root@ln ~]# echo $PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/tmp/

[root@ln ~]# ls2

3.txt 4.txt anaconda-ks.cfg qq qw qwe

[root@ln ~]#

先查询PATH 然后直接复制你需要保留的部分,在末尾甚至其他地方增加你所需要加入的环境变量,格式 :/目录/

保存后在查询 就可以看到你后加的变量了。在输入ls2 也可以生效

CP命令:

-a:此参数的效果和同时指定"-dpR"参数相同;

-d:当复制符号连接时,把目标文件或目录也建立为符号连接,并指向与源文件或目录连接的原始文件或目录;

-f:强行复制文件或目录,不论目标文件或目录是否已存在;

-i:覆盖既有文件之前先询问用户;

-l:对源文件建立硬连接,而非复制文件;

-p:保留源文件或目录的属性;

-R/r:递归处理,将指定目录下的所有文件与子目录一并处理;

-s:对源文件建立符号连接,而非复制文件;

-u:使用这项参数后只会在源文件的更改时间较目标文件更新时或是名称相互对应的目标文件并不存在时,才复制文件;

-S:在备份文件时,用指定的后缀“SUFFIX”代替文件的默认后缀;

-b:覆盖已存在的文件目标前将目标文件备份;

-v:详细显示命令执行的操作。

复制3.txt文档到当前目录 并改名为 1.txt

[root@ln ~]# ls

3.txt 4.txt anaconda-ks.cfg qq qw qwe

[root@ln ~]# cp 3.txt 1.txt

[root@ln ~]# ls

1.txt 3.txt 4.txt anaconda-ks.cfg qq qw qwe

[root@ln ~]#

复制 qw目录下的所有文件至 wq下

[root@ln ~]# ls

1.txt 3.txt 4.txt anaconda-ks.cfg qq qw qwe

[root@ln ~]# ls /qw

ln

[root@ln ~]# tree /qw

/qw

└── ln

└── 1

└── 3

3 directories, 0 files

[root@ln ~]# cp -r /qw /wq

[root@ln ~]# tree /wq

/wq

└── ln

└── 1

└── 3

3 directories, 0 files

[root@ln ~]#

MV命令:

用来对文件或目录重新命名,或者将文件从一个目录移到另一个目录中

将 1.txt 改名为 2.txt

[root@ln ~]# ls

1.txt 3.txt 4.txt anaconda-ks.cfg qq qw qwe

[root@ln ~]# mv 1.txt 2.txt

[root@ln ~]# ls

2.txt 3.txt 4.txt anaconda-ks.cfg qq qw qwe

[root@ln ~]#

将 qw目录下的所有文件 移动至 当前目录

[root@ln ~]# ls

2.txt 3.txt 4.txt anaconda-ks.cfg qq qw qwe

[root@ln ~]# mv /qw/ln/* .

[root@ln ~]# ls

1 2.txt 3.txt 4.txt anaconda-ks.cfg qq qw qwe

[root@ln ~]# tree 1

1

└── 3

1 directory, 0 files

[root@ln ~]#

查看命令:cat more less head tail

cat 查看一个文件内容

[root@ln ~]# cat 2.txt

qwertyuiop

[root@ln ~]#

同时查看多个文件

[root@ln ~]# cat 2.txt 3.txt

qwertyuiop

sdfgh

[root@ln ~]#

more 以全屏幕的方式按页显示文本文件的内容

按Space键:显示文本的下一屏内容。

按Enier键:只显示文本的下一行内容。

按斜线符|:接着输入一个模式,可以在文本中寻找下一个相匹配的模式。

按H键:显示帮助屏,该屏上有相关的帮助信息。

按B键:显示上一屏内容。

按Q键:退出rnore命令

less 作用与more十分相似,都可以用来浏览文字档案的内容,不同的是less命令允许用户向前或向后浏览文件,而more命令只能向前浏览 用PageUp键向上翻页,用PageDown键向下翻页。要退出less程序,应按Q键。

-e:文件内容显示完毕后,自动退出;

-f:强制显示文件;

-g:不加亮显示搜索到的所有关键词,仅显示当前显示的关键字,以提高显示速度;

-l:搜索时忽略大小写的差异;

-N:每一行行首显示行号;

-s:将连续多个空行压缩成一行显示;

-S:在单行显示较长的内容,而不换行显示;

-x<数字>:将TAB字符显示为指定个数的空格字符。

head 用于显示文件的开头的内容 不输入参数,默认显示头十行

-n<数字>:指定显示头部内容的行数;

-c<字符数>:指定显示头部内容的字符数;

-v:总是显示文件名的头信息;

-q:不显示文件名的头信息。

head + 文件名 默认查看前十行

[root@ln ~]# head 2.txt

qwee

qwertyuiop

a

s

d

f

g

h

h

j

[root@ln ~]#

查看前3行

[root@ln ~]# head -n 3 2.txt

qwee

qwertyuiop

a

[root@ln ~]#

tail 用于输入文件中的尾部内容。tail命令默认在屏幕上显示指定文件的末尾10行

显示尾部十行

[root@ln ~]# tail 2.txt

h

j

k

k

l

l

l

[root@ln ~]#

CHMOD命令:

用来变更文件或目录的权限

chmod u+x,g+w f01  //为文件f01设置自己可以执行,组员可以写入的权限

chmod u=rwx,g=rw,o=r f01

chmod 764 f01

chmod a+x f01  //对文件f01的u,g,o都设置可执行属性

[root@ln ~]# ll

总用量 12

drwxr-xr-x. 3 root root 15 5月 10 12:05 1

-rw-r--r--. 1 root root 45 5月 13 09:50 2.txt

-rw-r--r--. 1 root root 6 5月 13 09:42 3.txt

-rw-rw-r--. 1 root root 0 5月 10 07:20 4.txt

-rw-------. 1 root root 1368 5月 4 06:24 anaconda-ks.cfg

drwxrwxrwx. 3 root root 67 5月 10 05:04 qq

drwxrwxr-x. 2 root root 6 5月 10 05:05 qw

drwxrwxr-x. 2 root root 6 5月 10 07:19 qwe

[root@ln ~]#

d 开头的是目录, - 开头的是普通文件。

rwx 为权限 以数字表示 r=4 w=2 x=1 满权限为 7

按ll 显示的内容 除去第一个字符外 后为 九个字符

分为3组 属主 属组 其他人 每组都是一个rwx 满权限为777

修改 1文件夹 权限为777

[root@ln ~]# chmod 777 1

[root@ln ~]# ll

总用量 12

drwxrwxrwx. 3 root root 15 5月 10 12:05 1

-rw-r--r--. 1 root root 45 5月 13 09:50 2.txt

-rw-r--r--. 1 root root 6 5月 13 09:42 3.txt

-rw-rw-r--. 1 root root 0 5月 10 07:20 4.txt

-rw-------. 1 root root 1368 5月 4 06:24 anaconda-ks.cfg

drwxrwxrwx. 3 root root 67 5月 10 05:04 qq

drwxrwxr-x. 2 root root 6 5月 10 05:05 qw

drwxrwxr-x. 2 root root 6 5月 10 07:19 qwe

[root@ln ~]#

1文件夹所有用户都不允许写入

[root@ln ~]# chmod a-w 1

[root@ln ~]# ll

总用量 12

dr-xr-xr-x. 3 root root 15 5月 10 12:05 1

-rw-r--r--. 1 root root 45 5月 13 09:50 2.txt

-rw-r--r--. 1 root root 6 5月 13 09:42 3.txt

-rw-rw-r--. 1 root root 0 5月 10 07:20 4.txt

-rw-------. 1 root root 1368 5月 4 06:24 anaconda-ks.cfg

drwxrwxrwx. 3 root root 67 5月 10 05:04 qq

drwxrwxr-x. 2 root root 6 5月 10 05:05 qw

drwxrwxr-x. 2 root root 6 5月 10 07:19 qwe

[root@ln ~]#

- R 修改目录下的目录及文件 权限

[root@ln ~]# ll 1

总用量 0

-rw-r--r--. 1 root root 0 5月 13 10:56 1.txt

drwxr-xr-x. 2 root root 6 5月 10 12:03 3

[root@ln ~]# chmod -R 440 1

[root@ln ~]# ll 1

总用量 0

-r--r-----. 1 root root 0 5月 13 10:56 1.txt

dr--r-----. 2 root root 6 5月 10 12:03 3

[root@ln ~]#

CHGRP and CHOWN命令:

CHGRP 用来改变文件或目录所属的用户组

[root@ln ~]# groupadd user1

[root@ln ~]# ll

总用量 12

dr--r-----. 3 root root 28 5月 13 10:56 1

-rw-r--r--. 1 root root 45 5月 13 09:50 2.txt

-rw-r--r--. 1 root root 6 5月 13 09:42 3.txt

-rw-rw-r--. 1 root root 0 5月 10 07:20 4.txt

-rw-------. 1 root root 1368 5月 4 06:24 anaconda-ks.cfg

drwxrwxrwx. 3 root root 67 5月 10 05:04 qq

drwxrwxr-x. 2 root root 6 5月 10 05:05 qw

drwxrwxr-x. 2 root root 6 5月 10 07:19 qwe

[root@ln ~]# chgrp user1 2.txt

[root@ln ~]# ll

总用量 12

dr--r-----. 3 root root 28 5月 13 10:56 1

-rw-r--r--. 1 root user1 45 5月 13 09:50 2.txt

-rw-r--r--. 1 root root 6 5月 13 09:42 3.txt

-rw-rw-r--. 1 root root 0 5月 10 07:20 4.txt

-rw-------. 1 root root 1368 5月 4 06:24 anaconda-ks.cfg

drwxrwxrwx. 3 root root 67 5月 10 05:04 qq

drwxrwxr-x. 2 root root 6 5月 10 05:05 qw

drwxrwxr-x. 2 root root 6 5月 10 07:19 qwe

[root@ln ~]#

-R 修改目录下的所有目录及文件的 组

[root@ln ~]# ll 1

总用量 0

-r--r-----. 1 root root 0 5月 13 10:56 1.txt

dr--r-----. 2 root root 6 5月 10 12:03 3

[root@ln ~]# chgrp -R user1 1

[root@ln ~]# ll 1

总用量 0

-r--r-----. 1 root user1 0 5月 13 10:56 1.txt

dr--r-----. 2 root user1 6 5月 10 12:03 3

[root@ln ~]#

CHOWN 用来改变文件或目录所属的用户组

[root@ln ~]# chown apache 3.txt

[root@ln ~]# ll

总用量 12

dr--r-----. 3 root user1 28 5月 13 10:56 1

-rw-r--r--. 1 root user1 45 5月 13 09:50 2.txt

-rw-r--r--. 1 apache root 6 5月 13 09:42 3.txt

-rw-rw-r--. 1 root root 0 5月 10 07:20 4.txt

-rw-------. 1 root root 1368 5月 4 06:24 anaconda-ks.cfg

drwxrwxrwx. 3 root root 67 5月 10 05:04 qq

drwxrwxr-x. 2 root root 6 5月 10 05:05 qw

drwxrwxr-x. 2 root root 6 5月 10 07:19 qwe

[root@ln ~]#

- R 修改目录下的所有目录及文件的 组

[root@ln ~]# ls -la /qq

总用量 0

drwxr-xr-x. 3 root root 19 5月 10 04:59 .

dr-xr-xr-x. 20 root root 275 5月 13 09:17 ..

drwxr-xr-x. 2 root root 6 5月 10 04:59 1.txt

[root@ln ~]# chown -R apache /qq/

[root@ln ~]# ls -la /qq

总用量 0

drwxr-xr-x. 3 apache root 19 5月 10 04:59 .

dr-xr-xr-x. 20 root root 275 5月 13 09:17 ..

drwxr-xr-x. 2 apache root 6 5月 10 04:59 1.txt

[root@ln ~]#

这里由于 ' .. ' 是代表上级目录 所以没有修改 而代表本级目录的 ' . ' 已经被修改了

UMASK命令:

umask 设置默认权限

输入umask 显示 系统 默认权限 0022 只看后三位 也就是 022 新建目录的权限为 755

[root@ln ~]# umask

0022

[root@ln ~]# mkdir asd

[root@ln ~]# ll

总用量 4

-rw-------. 1 root root 1368 5月 4 06:24 anaconda-ks.cfg

drwxr-xr-x. 2 root root 6 5月 13 11:24 asd

[root@ln ~]#

在umask不自定义前,目录权限值为:755,普通文件权限值为:644

[root@ln ~]# touch 1.txt

[root@ln ~]# ll

总用量 4

-rw-r--r--. 1 root root 0 5月 13 11:26 1.txt

-rw-------. 1 root root 1368 5月 4 06:24 anaconda-ks.cfg

drwxr-xr-x. 2 root root 6 5月 13 11:24 asd

[root@ln ~]#

设置umask为001 后新建目录及文件

[root@ln ~]# umask 001

[root@ln ~]# umask

0001

[root@ln ~]# mkdir zxc

[root@ln ~]# touch 2.txt

[root@ln ~]# ll

总用量 4

-rw-rw-rw-. 1 root root 0 5月 13 11:29 2.txt

-rw-------. 1 root root 1368 5月 4 06:24 anaconda-ks.cfg

drwxr-xr-x. 2 root root 6 5月 13 11:24 asd

drwxrwxrw-. 2 root root 6 5月 13 11:29 zxc

[root@ln ~]#

文件权限算法是: rw-rw-rw- (666) -- - - - - - - - -x(001 umask权限) = 666 由于 1权限是x 默认 666是 rw-rw-rw- 没有x的,所以权限就还是666

目录的权限则就是 777 - 001(umask权限) = 776

转载于:https://my.oschina.net/u/3851489/blog/1811585

linux基础命令篇一相关推荐

  1. 河南省周口市安吉软件测试培训中心第一次软件测试课程-Linux基础命令篇

    服务器版本Linux: Redhat Centos Linux命令: cd命令 命令功能:切换当前目录至dirName 命令格式:cd [目录名] 注:目录名称与cd指令之间存在一个空格 cd ..表 ...

  2. img解包工具_3、Linux基础命令篇、压缩打包工具

    在管理系统中,我们遇到经常会使用后缀为*.tar.gz |*.tar.bz2 等文件,他们是什么文件呢?请看下面介绍及使用方法 压缩的原理,比如一个字符串"www.baidu.com&quo ...

  3. 【linux】循序渐进学运维-基础命令篇-查找类命令

    本文为循序渐进学运维系列的基础命令篇,文章已收录gitee. 在Gitee上,点击直达 有运维技术的全部技术栈和文档,免费学习. 打造运维行业最全的知识体系,欢迎star 点赞再看,注意收藏,习惯养成 ...

  4. 【linux】循序渐进学运维-基础命令篇

    文章目录 前言 线上查询及帮助命令(2个) 文件和目录操作命令(18个) 查看文件及内容处理命令(21个) 文件压缩及解压缩命令(4个) 信息显示命令(11个) 搜索文件命令(4个) 用户管理命令(1 ...

  5. [linux]循序渐进学运维-基础命令篇-diff

    写在前面: 博主是一名投身教培事业的标准八零后,叛逆而且追求自由,昵称取自于苏轼的<水调歌头>中的"高处不胜寒",时刻提醒自己要耐得住寂寞,受的了孤独,在技术的道路上, ...

  6. 百战RHCE(第一战:Linux基础命令1)

    哈喽哈喽哈喽,大家好啊,很高兴大家能看到这篇文章! 首先,本人目前是计算机专业的大一学生,基于对Linux操作系统的爱好,参与了RHCE的培训班,而我这次编写的 <百战RHCE>文章,是基 ...

  7. Linux基础命令学习——方法二(给swap分区增加500M)

    在之前的博客中也有相关介绍,将Swap分区扩展500M,当然有很多方法,今天来记录第二种方法. 上篇介绍swap分区扩展500M的方法: Linux基础命令学习--实战篇(给swap分区增加500M) ...

  8. 查看linux文件工具,Linux基础命令-文本文件查看工具

    文本文件查看工具 cat concatenate 文本文件查看工具 cat /etc/fstab cat [OPTION]... [FILE]... -n:给显示的文本行编行 -E:显示行结束符 ta ...

  9. Linux基础入门篇知识回顾

    Linux基础入门篇知识回顾 一.回顾书籍 二.基础知识 1.计算机基础知识 1.1计算机的特点及发展趋势 ①特点 ②发展趋势 1.2计算机系统组成 ①计算机硬件概念 ②计算机硬件各部分功能 ![在这 ...

最新文章

  1. 在C#中快速实现拖放操作
  2. SQL Server中一个隐性的IO性能杀手-Forwarded record
  3. (Mybatis)日志工厂
  4. 蓝桥杯-算法训练 2的次幂表示
  5. php连接中文数据库乱码问题,如何解决php的数据库中文乱码问题
  6. 【前端统计图】echarts改变颜色属性的demo
  7. 歌谣--回顾2020 展望2021
  8. Splunk企业级运维智能大数据分析平台新手入门视频课程上线
  9. mysql 多表连接技巧_【Mysql进阶技巧(1)】 MySQL的多表关联与自连接
  10. 过拟合 准确率大幅下降_梯度下降和过拟合和归一化
  11. CCF试题 201903-2 二十四点解析
  12. C++实现简单数独游戏
  13. context deadline exceeded
  14. vue图片懒加载插件vue-lazyload监听加载失败事件的解决方案
  15. virtualBox安装驱动失败:找不到指定模块解决方法
  16. Codeforces Round #439 (Div. 2) A. The Artful Expedient
  17. 为何亚马逊的中国电商之路以失败收场?当当网创始人这样说
  18. 监管之外,加密货币在日本大行其道的其他原因
  19. 【Android之OkHttp介绍】
  20. Truelore星桥,为投标全过程保驾护航

热门文章

  1. 将函数实现放在头文件中
  2. Linux永久挂载新的硬盘
  3. MySQL学习(四、子查询)
  4. 服务器开发中网络数据分析与故障排查经验
  5. 源码注释TODO/ FIXME/XXX,
  6. 概率论-4.1 大数定律
  7. [BUUCTF-pwn]——jarvisoj_level4
  8. 关于优酷开发sdkdemo的布局
  9. 在公司如何远程控制家中电脑
  10. 硬件加速会使电脑黑屏吗?