马哥Linux——第一周作业

1、常见Linux的发行版有哪些?并描述不同发行版之间的联系与区别。

RHEL:付费服务器发行版,配套红帽公司的付费支持服务。

CentOS:Linux发行版之一,来自于RHEL依照开放源代码规定释出的源代码所编译而成。CentOS并不包含封闭源代码软件。每个版本的CentOS都会获得十年的支持(通过安全更新方式)。新版本的CentOS大约每两年发行一次,而每个版本的CentOS会定期(大概每六个月)更新一次,以便支持新的硬件,建立一个安全、低维护、稳定、高预测性、高重复性的Linux环境。

Fedora:被红帽公司定位为新技术的实验场,与RHEL被定位为稳定性优先不同。许多新的技术都会在Fedora Core中检验,如果稳定的话红帽公司则会考虑加入RHEL中。Fedora预计每年发布 2 次发行版本。

Ubuntu:以桌面应用为主的开源GNU/Linux操作系统,基于Debian GNU/Linux,支持x86、amd64(即x64)和ppc架构,由全球化的专业开发团队(Canonical Ltd)打造的。

Android:

基于Linux的自由及开放源代码的操作系统,主要使用于移动设备,如智能手机和平板电脑,由Google公司和开放手机联盟领导及开发。

 

2、打印显示当前时间,格式是:20181209211008

[root@centos7 ~]#date +%Y%m%d%H%M%S
20190603160331

 

3、描述linux目录结构以及目录结构命名规定

bin:存放普通用户能使用的基本命令库,即基本二进制程序。

boot:存放静态文件和启动相关文件,包括内核。

dev:存放设备。

etc:存放系统配置。

lib:存放共享库。

lib64:存放64位系统共享库。

home:存放普通用户家目录。

root:管理员家目录。

media:当挂载点使用,挂载设备。

mnt:当挂载点使用,一般是管理员手工挂载。

opt:存放第三方应用程序软件包。

sbin:存放管理员用的程序。

srv:存放服务用的数据。

tmp:存放临时数据。

usr:第二层目录结构,里面存放很多余根目录相同的目录,存放大部分应用程序。

var:存放可变数据,入日志、网站数据、ftp数据。

lost+found:只有ext4文件系统才有该目录,存放因系统故障导致路径混乱的文件。

misc:存放杂项,也可用来实现光盘自动挂载。

proc:虚拟目录,存放的内容在内容中,不在硬盘。

sys:存放硬件相关信息

selinux:存放selinux安全策略。

run:CentOS7增加的目录。

 

4、显示/etc目录下,所有以.d结尾的文件或目录

[root@centos7 ~]#ls -d /etc/*.d
/etc/bash_completion.d  /etc/logrotate.d     /etc/rc6.d
/etc/binfmt.d           /etc/modprobe.d      /etc/rc.d
/etc/chkconfig.d        /etc/modules-load.d  /etc/request-key.d
/etc/cron.d             /etc/my.cnf.d        /etc/rsyslog.d
/etc/depmod.d           /etc/oddjobd.conf.d  /etc/rwtab.d
/etc/dnsmasq.d          /etc/pam.d           /etc/sane.d
/etc/dracut.conf.d      /etc/popt.d          /etc/setuptool.d
/etc/exports.d          /etc/prelink.conf.d  /etc/statetab.d
/etc/gdbinit.d          /etc/profile.d       /etc/sudoers.d
/etc/grub.d             /etc/rc0.d           /etc/sysctl.d
/etc/init.d             /etc/rc1.d           /etc/tmpfiles.d
/etc/ipsec.d            /etc/rc2.d           /etc/xinetd.d
/etc/krb5.conf.d        /etc/rc3.d           /etc/yum.repos.d
/etc/ld.so.conf.d       /etc/rc4.d
/etc/libibverbs.d       /etc/rc5.d

 

5、显示/etc目录下,所有.conf结尾,且以m,n,r,p开头的文件或目录

[root@centos7 ~]#ls -d /etc/{m,n,r,p}*.conf
/etc/man_db.conf    /etc/nsswitch.conf  /etc/request-key.conf
/etc/mke2fs.conf    /etc/numad.conf     /etc/resolv.conf
/etc/mtools.conf    /etc/pbm2ppa.conf   /etc/rsyncd.conf
/etc/nfs.conf       /etc/pnm2ppa.conf   /etc/rsyslog.conf
/etc/nfsmount.conf  /etc/radvd.conf

 

6、创建/app/rootdir目录,并复制/root下所有文件到该目录内, 要求保留原有权限

[root@centos7 ~]#mkdir -p /app/rootdir
[root@centos7 ~]#cp -a /root/* /app/rootdir/
[root@centos7 ~]#ll /root/ /app/rootdir/
/app/rootdir/:
total 20
-rw-------. 1 root root 1894 May 17 08:35 anaconda-ks.cfg
-rw-------. 1 root root   14 Jun  1 15:33 dead.letter
drwxr-xr-x. 2 root root    6 May 17 08:44 Desktop
drwxr-xr-x. 2 root root    6 May 17 08:44 Documents
drwxr-xr-x. 2 root root    6 May 17 08:44 Downloads
-rw-r--r--. 1 root root 1925 May 17 08:43 initial-setup-ks.cfg
drwxr-xr-x. 2 root root    6 May 17 08:44 Music
drwxr-xr-x. 2 root root    6 May 17 08:44 Pictures
drwxr-xr-x. 2 root root    6 May 17 08:44 Public
drwxr-xr-x. 2 root root    6 May 17 08:44 Templates
-rw-r--r--. 1 root root  192 Jun  3 01:09 test
drwxr-xr-x. 2 root root    6 May 17 08:44 Videos
-rw-r--r--. 1 root root  382 Jun  1 16:12 who.log

/root/:
total 20
-rw-------. 1 root root 1894 May 17 08:35 anaconda-ks.cfg
-rw-------. 1 root root   14 Jun  1 15:33 dead.letter
drwxr-xr-x. 2 root root    6 May 17 08:44 Desktop
drwxr-xr-x. 2 root root    6 May 17 08:44 Documents
drwxr-xr-x. 2 root root    6 May 17 08:44 Downloads
-rw-r--r--. 1 root root 1925 May 17 08:43 initial-setup-ks.cfg
drwxr-xr-x. 2 root root    6 May 17 08:44 Music
drwxr-xr-x. 2 root root    6 May 17 08:44 Pictures
drwxr-xr-x. 2 root root    6 May 17 08:44 Public
drwxr-xr-x. 2 root root    6 May 17 08:44 Templates
-rw-r--r--. 1 root root  192 Jun  3 01:09 test
drwxr-xr-x. 2 root root    6 May 17 08:44 Videos
-rw-r--r--. 1 root root  382 Jun  1 16:12 who.log

 

7、使用命令行展开功能,创建/tmp/a1, /tmp/a2, /tmp/a1/a, /tmp/a1/b,在/tmp目录下创建目录:x_y, x_z, q_y, q_z

[root@centos7 ~]#mkdir -p /tmp/{a{1/{a,b},2},x_{y,z},q_{y,z}}
[root@centos7 ~]#tree /tmp/
/tmp/
├── a1
│   ├── a
│   └── b
├── a2
├── q_y
├── q_z
├── x_y
└── x_z

8 directories, 0 files

 

posted @ 2019-06-03 16:36  e..mmm  阅读(165)  评论(0编辑  收藏  举报