千家信息网

linux文件管理及用户管理的介绍以及用法是怎样的

发表于:2026-11-02 作者:千家信息网编辑
千家信息网最后更新 2026年11月02日,linux文件管理及用户管理的介绍以及用法是怎样的,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。1、显示/etc目录下,
千家信息网最后更新 2026年11月02日linux文件管理及用户管理的介绍以及用法是怎样的

linux文件管理及用户管理的介绍以及用法是怎样的,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。

1、显示/etc目录下,以非字母开头,后面跟了一个字母以及其它任意长度任意字符的文件或目录。

[root@centos7 etc]# ls -d /etc/[^[:alpha:]][:alpha:]*

2、复制/etc目录下所有以p开头,以非数字结尾的文件或目录到/tmp/mytest1目录中。

[root@centos7 etc]# mkdir /tmp/mytest1 && cp -a /etc/[p]*[^[:digit:]] /tmp/mytest1/
[root@centos7 etc]# ls /tmp/mytest1/ #查看结果
pam.d passwd- pinforc plymouth pnm2ppa.conf postfix prelink.conf.d profile protocols purple
passwd pbm2ppa.conf pki pm popt.d ppp printcap profile.d pulse python

3、将/etc/issue文件中的内容转换为大写后保存至/tmp/issue.out文件中

[root@centos7 etc]# tr 'a-z' 'A-Z' < /etc/issue >/tmp/issue.out
[root@centos7 etc]# cat /tmp/issue.out 查看内容
\S
KERNEL \R ON AN \M

4、请总结描述用户和组管理类命令的使用方法并完成以下练习:

(1)、创建组distro,其GID为2019;

[root@centos7 etc]# groupadd distro -g 2019
[root@centos7 etc]# getent group distro #验证distro的GID
distro:x:2019:

(2)、创建用户mandriva, 其ID号为1005;基本组为distro;

[root@centos7 etc]# useradd mandriva -u 1005 -g distro
[root@centos7 etc]# id mandriva #验证mandriva的UID号和基本组
uid=1005(mandriva) gid=2019(distro) groups=2019(distro)

(3)、创建用户mageia,其ID号为1100,家目录为/home/linux;

[root@centos7 etc]# useradd mageia -u 1100 -d /home/linux
[root@centos7 etc]# getent passwd mageia #验证结果
mageia:x:1100:1100::/home/linux:/bin/bash

(4)、给用户mageia添加密码,密码为mageedu,并设置用户密码7天后过期

[root@centos7 etc]# echo "mageedu" | passwd mageia --stdin -x 7
[root@centos7 etc]# getent shadow mageia #验证结果
mageia:!!:18308:0:7:7:::

(5)、删除mandriva,但保留其家目录;

[root@centos7 etc]# userdel mandriva
[root@centos7 etc]# ls /home/ #验证结果 mandriva目录依旧存在
diyoujia linux mandriva slackware test

(6)、创建用户slackware,其ID号为2002,基本组为distro,附加组peguin;

[root@centos7 etc]# useradd slackware -u 2002 -g distro -G peguin
[root@centos7 etc]# id slackware #验证结果
uid=2002(slackware) gid=2019(distro) groups=2019(distro),2020(peguin)

(7)、修改slackware的默认shell为/bin/tcsh;

[root@centos7 etc]# chsh slackware -s /bin/tcsh
[root@centos7 etc]# getent passwd slackware #验证结果
slackware:x:2002:2019::/home/slackware:/bin/tcsh

(8)、为用户slackware新增附加组admins;

[root@centos7 etc]# usermod slackware -aG admins
[root@centos7 etc]# id slackware #验证结果
uid=2002(slackware) gid=2019(distro) groups=2019(distro),2020(peguin),2021(admins)

看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注行业资讯频道,感谢您对的支持。

用户 目录 验证 结果 文件 管理 内容 密码 字母 开头 帮助 附加 清楚 使用方法 命令 大写 天后 字符 对此 数字 数据库的安全要保护哪些东西 数据库安全各自的含义是什么 生产安全数据库录入 数据库的安全性及管理 数据库安全策略包含哪些 海淀数据库安全审计系统 建立农村房屋安全信息数据库 易用的数据库客户端支持安全管理 连接数据库失败ssl安全错误 数据库的锁怎样保障安全 互联网黑科技 互联网科技公司简介 苏州找大状互联网科技有限公司 互联网科技股票 睿民互联网科技 互联网科技公司做什么 海南购全球互联网科技 海南科技产业互联网平台 卫星互联网科技股票 北京华百购互联网科技有限公司 中国互联网公司排名锤子科技 山东有哪些互联网科技公司 国大互联网教育科技有限公司薪资 萌小萌互联网科技河南有限公司 容联科技互联网电商 广州三三互联网科技有限公司 山东蛋芒互联网科技有限公司 北京品多多互联网科技有限公司 互联网企业和网络科技有限公司 山东亿川互联网科技有限责任公司 华服互联网科技靠谱吗 互联网科技网 互联网科技公司税收优惠 南京欣网互联网科技 奇酷互联网络科技公司 互联网科技公司有哪些 互联网科技汛 成都玖崟互联网科技有限公司乐商圈怎么样 昆明中奇联合互联网科技 互联网科技大会大佬
0