一、查看操做系統 二、查看命令幫助的幾種方式 三、pwd的使用 四、mkdir的使用

一、如何查看操做系統centos

1.1[root@VM_86_3_centos zhanghao]# uname -m(32and64)
x86_64bash

1.2[root@VM_86_3_centos zhanghoc]# uname -a
Linux VM_86_3_centos 3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linuxless

1.3[root@VM_86_3_centos zhanghao]# ls -ld /lib64
lrwxrwxrwx. 1 root root 9 Apr 21 2016 /lib64 -> usr/lib64操作系統

1.4[root@VM_86_3_centos zhanghao]# cat /etc/redhat-release (版本)
CentOS Linux release 7.2.1511 (Core)ci

1.5[root@VM_86_3_centos zhanghao]# uname -r(內核)
3.10.0-514.26.2.el7.x86_64it

 

2.查看命令的幾種方法io

2.1 [命令] --help 適用於通常命令,非內置命令test

2.2 man [命令]  適用於通常命令,非內置命令file

2.3 help  [命令] 適用於內置命令command

三、pwd的使用

[root@VM_86_3_centos /]# help pwd
pwd: pwd [-LP]
Print the name of the current working directory.(打印當前工做目錄的名稱)

Options:(備選文案、此處爲選項)
-L print the value of $PWD if it names the current working (打印pwd的值,若是它命名當前工做)
directory(目錄)
-P print the physical directory, without any symbolic links(打印物理錄,不帶任何符號連接)

By default, `pwd' behaves as if `-L' were specified.(默認狀況下,「pwd」的行爲就像指定了「-l」同樣)

Exit Status:(退出狀態)
Returns 0 unless an invalid option is given or the current directory(除非給定無效選項或當前目錄,不然返回0)
cannot be read.(沒法讀取)

[root@VM_86_3_centos /]# echo $PWD
/
[root@VM_86_3_centos /]# pwd -L
/
[root@VM_86_3_centos /]# pwd
/
[root@VM_86_3_centos /]# cd /etc/init.d/
[root@VM_86_3_centos init.d]# pwd
/etc/init.d
[root@VM_86_3_centos init.d]# pwd -L
/etc/init.d
[root@VM_86_3_centos init.d]# pwd -P
/etc/rc.d/init.d

 

四、mkdir的使用

-m, --mode=MODE set file mode (as in chmod), not a=rwx - umask
-p, --parents no error if existing, make parent directories as needed
-v, --verbose print a message for each created directory

[root@VM_86_3_centos ~]# mkdir test/a/b
mkdir: cannot create directory ‘test/a/b’: No such file or directory
[root@VM_86_3_centos ~]# mkdir -p test/a/b
[root@VM_86_3_centos ~]# tree test
-bash: tree: command not found
[root@VM_86_3_centos ~]# mkdir -pv test/a/b/c/d/e
mkdir: created directory ‘test/a/b/c’
mkdir: created directory ‘test/a/b/c/d’
mkdir: created directory ‘test/a/b/c/d/e’

建立有規律的多目錄(此處數字爲文件名)

[root@VM_86_3_centos ~]# echo 1 2 3 4
1 2 3 4
[root@VM_86_3_centos ~]# echo {1..10}
1 2 3 4 5 6 7 8 9 10

[root@VM_86_3_centos ~]# mkdir -pv test/ {1..3}/{4..6}mkdir: created directory ‘1/5’mkdir: created directory ‘1/6’mkdir: created directory ‘2/5’mkdir: created directory ‘2/6’mkdir: created directory ‘3/5’mkdir: created directory ‘3/6’

相關文章
相關標籤/搜索