用户管理与系统输出输入管理

mac2022-06-30  25

1.用户管理1

1./etc/passwd ##查看用户信息文件 用户名称-密码-uid(用户id)-gid(组id,初始组,不会改变)-说明-家目录-默认she

2.查看用户-----

id 加入想查看的用户 id -u 查看用户的uid -g 查看用户的gid -G 查看用户所在的所有组的id -n 显示名字而不显示id数字

2.输出管理

输出管理主要包括正确输出1与错误输出2。

>正确输出 2>错误输出 &>定向所有输出 ## 全部覆盖 find /etc -name passwd> pawestos find /etc -name passwd 2>westos.error find /etc -name passwd &2westos.all

在westos_all中写入后,再次执行find /etc -name passwd &> westos_all 会覆盖原有文件内容 非覆盖喜下的输出管理

>> ##追加符 touch file{1..3} echo xixi >file1 echo hehe >file2 echo lalal > file3 find /etc -name passwd >> file1 find /etc -name passwd 2>> file2 find /etc -name passwd &>> file3 cat *

3上一条输出命令作为下一条命令的输入,用到管道符 |

注:|【管道符】—只有正确的输出 ,才能过管道

touch file{1..3] ls ls|wc -l

find /etc -name passwd |wc -l ##wc -l wc-l 为查看行数 find /etc -name passwd 2>&1|wc -l#####通过管道,在保存,主要在于管道的特性 find /etc -name passwd |tee westos |wc -l

3.输入管理

< 输入定向符 tr 'a-z' 'A-Z'< westos ### 把文件的内容输入执行小写变大写

但是当给westos再次写入时,会先清空westos之前的文件内容。 非覆盖下的输入管理

echo "hehe" << westos cat westos

最新回复(0)