Chapter Four
-
Date and time display instruction: date
- Input:
(base) liyihuadeMacBook-Pro:~ liyihua$ date
- Input:
-
- Output:
Thu Jun 6 08:44:02 CST 2019
- Output:
-
Show calendar commands: cal
- Input:
(base) liyihuadeMacBook-Pro:~ liyihua$ cal
- Output:
June 2019 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
- Input:
(base) liyihuadeMacBook-Pro:~ liyihua$ cal 2019
- Export
2019 January February March Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 3 4 5 1 2 1 2 6 7 8 9 10 11 12 3 4 5 6 7 8 9 3 4 5 6 7 8 9 13 14 15 16 17 18 19 10 11 12 13 14 15 16 10 11 12 13 14 15 16 20 21 22 23 24 25 26 17 18 19 20 21 22 23 17 18 19 20 21 22 23 27 28 29 30 31 24 25 26 27 28 24 25 26 27 28 29 30 31 April May June Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 1 2 3 4 1 7 8 9 10 11 12 13 5 6 7 8 9 10 11 2 3 4 5 6 7 8 14 15 16 17 18 19 20 12 13 14 15 16 17 18 9 10 11 12 13 14 15 21 22 23 24 25 26 27 19 20 21 22 23 24 25 16 17 18 19 20 21 22 28 29 30 26 27 28 29 30 31 23 24 25 26 27 28 29 30 July August September Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 1 2 3 1 2 3 4 5 6 7 7 8 9 10 11 12 13 4 5 6 7 8 9 10 8 9 10 11 12 13 14 14 15 16 17 18 19 20 11 12 13 14 15 16 17 15 16 17 18 19 20 21 21 22 23 24 25 26 27 18 19 20 21 22 23 24 22 23 24 25 26 27 28 28 29 30 31 25 26 27 28 29 30 31 29 30 October November December Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 3 4 5 1 2 1 2 3 4 5 6 7 6 7 8 9 10 11 12 3 4 5 6 7 8 9 8 9 10 11 12 13 14 13 14 15 16 17 18 19 10 11 12 13 14 15 16 15 16 17 18 19 20 21 20 21 22 23 24 25 26 17 18 19 20 21 22 23 22 23 24 25 26 27 28 27 28 29 30 31 24 25 26 27 28 29 30 29 30 31
- Input:
(base) liyihuadeMacBook-Pro:~ liyihua$ cal 9 2019
- Output:
September 2019 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
- Input:
-
Easy to use calculator: bc
- Input:
(base) liyihuadeMacBook-Pro:~ liyihua$ bc
- Use the calculator:
bc 1.06 Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc. This is free software with ABSOLUTELY NO WARRANTY. For details type `warranty'. 1+1 2 99+88 187 100*200 20000 quit (base) liyihuadeMacBook-Pro:~ liyihua$
- Input:
-
Command then [Tab] key
-
[Tab] bonded behind the first instruction of a string of command completion ----
-
[Tab] In the bonded after the second series of instruction completion file ----
- [Tab] key behind some characters take two [Tab] key ---- to see these characters at the beginning of the command
- E.g:
- Input: (ls connected behind the two [Tab] key)
(Base) Liyihuadenachbhok-Pro: ~ liyihua $ Ls
- Output:
ls lsbom lsm lsof lsvfs lsappinfo lskq lsmp lss3
- Input: (hereinafter the two pick cal [Tab] key)
- Output:
cal calendar caller
- Input: (ls connected behind the two [Tab] key)
- E.g:
-
-
[Control] key + [c] key
- Function: interrupt the current program
-
[Control] key + [d] button
- Features: keyboard input end (End Of File, EOF or End Of Input) means
-
[Shift] key + [PageUp] key or [PageDown] key
- Function: forward or backward flip flip
-
man sum info
- man ---- query instruction
- Almost info and man uses
- E.g:
- Input:
(base) liyihuadeMacBook-Pro:~ liyihua$ info ls
- Output:
-
- Input:
-
Super simple text editor: nano
- Input:
(base) liyihuadeMacBook-Pro:~ liyihua$ nano
- :( input Chinese text editor will not read some characters)
- The simple text editor part of the more important shortcuts
- Input:
-
Shutdown command
- Shutdown shutdown
- Reboot reboot
Chapter V, Linux file permissions and directory configuration
-
ls -al command
- Input:
(Base) Liyihuadenachbhok-Pro: ~ liyihua $ Ls -al
- Part of the output:
total 160 drwxr-xr-x+ 50 liyihua staff 1600 Jun 6 09:47 . drwxr-xr-x 6 root admin 192 May 7 10:09 .. -r-------- 1 liyihua staff 9 May 4 21:34 .CFUserTextEncoding -rw-r--r--@ 1 liyihua staff 10244 Jun 5 21:57 .DS_Store drwx------ 2 liyihua staff 64 Jun 6 08:18 .Trash drwxr-xr-x 3 liyihua staff 96 May 15 19:30 .anaconda drwxr-xr-x 3 liyihua staff 96 May 4 22:33 .android drwxr-xr-x 3 liyihua staff 96 May 4 23:22 .astropy -rw------- 1 liyihua staff 8552 Jun 6 09:47 .bash_history -rw-r--r-- 1 liyihua staff 547 May 18 15:01 .bash_profile drwx------ 65 liyihua staff 2080 Jun 6 09:51 .bash_sessions drwxr-xr-x 4 liyihua staff 128 May 18 11:35 .conda -rw-r--r-- 1 liyihua staff 40 May 18 11:35 .condarc drwx------ 3 liyihua staff 96 May 19 15:35 .config drwxr-xr-x 4 liyihua staff 128 May 19 16:10 .docker drwxr-xr-x 4 liyihua staff 128 May 19 11:14 .gem -rw-r--r-- 1 liyihua staff 122 May 19 11:26 .gemrc drwxr-xr-x 3 liyihua staff 96 May 21 15:01 .idlerc drwxr-xr-x 5 liyihua staff 160 May 15 20:16 .ipython drwx------ 6 liyihua staff 192 May 20 09:34 .local [权限] [连结] [拥有者][群组][文件容量][修改日期] [档名]
- ls是「list」的意思,「-al」则表示列出所有文件的详细的权限与属性
-
操作符号
- + 添加某个权限。
- – 取消某个权限。
- = 赋予给定权限并取消其他所有权限(如果有的话)。
- 设置mode所表示的权限可用下述字母的任意组合:
- r 可读。
- w 可写。
- x 可执行。
- X 只有目标文件对某些用户是可执行的或该目标文件是目录时才追加x 属性。
- s 在文件执行时把进程的属主或组ID置为该文件的文件属主。方式“u+s”设置文件的用户ID位,“g+s”设置组ID位。
- t 保存程序的文本到交换设备上。
- u 与文件属主拥有一样的权限。
- g 与和文件属主同组的用户拥有一样的权限。
- o 与其他用户拥有一样的权限。
- -c : 若该档案权限确实已经更改,才显示其更改动作
- -f : 若该档案权限无法被更改也不要显示错误讯息
- -v : 显示权限变更的详细资料
- -R : 对目前目录下的所有档案与子目录进行相同的权限变更(即以递回的方式逐个变更)
- –help : 显示辅助说明
- –version : 显示版本
-
第一栏代表这个文件的类型与权限
-
第二栏表示有多少档名连结到了此节点
- 第三栏表示这个文件或目录的【拥有者账号】
- 第四栏表示这个文件所属的群组
- 第五栏表示这个文件的大小(默认单位为bytes)
- 第六栏表示这个文件的建档日期或者最近的修改日期
- 第七栏为这个文件的档名
- Input:
-
改变文件的权限与属性
-
改变所属群组--chgrp
- 输入:
# chown 群组名称 文件或目录
chgrp users file - 文件[ file ]的群组就被改成了[ users ]
- 改变文件拥有者--chown
- 输入:
# chown 账号名称 文件或目录
chown liyihua file - 文件[ file ]的拥有者就被改成了[ liyihua ]
-
改变权限--chmod
- 每种身份(owner/group/others)各自的三个权限(r/w/x)
- owner = rwx = 4 + 2 + 1 = 7
- group = rwx = 4 + 2 + 1 = 7
- others = --- = 0 + 0 + 0 = 0
-
-
数字类型改变文件权限
- r : 4 w : 2 x : 1 - : 0
- 输入:
chown 770 file
- 结果:文件[ file ]的权限被改为了770,即 - r w x r w x - - -
-
- 例如:- r w x r w x - - -
- [4 + 2 + 1][4 + 2 + 1][0 + 0 + 0]
- = [ 7 ][ 7 ][ 0 ]
- 权限数字770
-
符号类型改变文件权限
- 基本上九个权限分别是(1)user(2)group(3)others 可以用u/g/o来表示三种身份的权限,a则代表all(即全部的身份)
- 输入:
chmod u=rwx g=rwx o =r file
- 结果:文件[ file ] 权限给改为 - r w x r w x r - -
-
-
-
Linux目录配置
-
Linux目录配置的依据
-
- 可分享的:可以分享给其它系统挂载使用的目录,所以包括执行文件与使用者的邮件等数据, 是能够分享给网络上其它主机挂载用的目录;
- 不可分享的:自己机器上面运作的装置档案或者是与程序有关的socket档案等, 由于仅与自身有关,所以当然就不适合分享给其它主机了。
- 不变的:有些数据是不会经常变动的,跟随着distribution而不变动。 例如函式库、文件说明文件、系统管理员所管理的主机服务设定文件等等;
- 可变动的:经常改变的数据,例如登录文件、一般用户可自行收受的新闻群组等。
-
-
目录树
-
- 目录树的特性
- 目录树的特性