1、查看操作系统 2、查看命令帮助的几种方式 3、pwd的使用 4、mkdir的使用

1、如何查看操作系统

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

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/Linux

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)

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

2.查看命令的几种方法

2.1 [命令] --help 适用于一般命令,非内置命令

2.2 man [命令]  适用于一般命令,非内置命令

2.3 help  [命令] 适用于内置命令

3、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

4、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’

猜你喜欢

转载自www.cnblogs.com/3edc3edc/p/10640130.html