【2014/09/16】linux笔记文件权限 脚本

文件权限

ll


- 表示是一个文件
d 表示一个目录
x 执行
r 读
w 写
文件基本权限


 
可以出现 -w-权限

设置权限
  cd /tmp/ 打开文件
  touch file1 穿件一个file1文件
更改权限
chmod 
chmod u=rwx file1 设置拥有人的权限
chmod u=rwx,g=rwx,o=rwx 设置权限
chmod 777 file1  和上一行等效
chmod u+x file1 添加权限
chmod u-x file1 去掉权限
chmod a+w file1 给所有人添加写权限


脚本
(外信息
可执行的文件 脚本
linux下 bash语言 文件以.sh结尾  perl  后缀名为.pl
弱变量
echo 打印出来
用$取出变量
echo $a 打印出来a的值
|管道符 例如 echo "redhat"|passwd user1 --stdin


创建文件并写入脚本
touch user.sh

第一行声明shell
#!/bin/bash   (which bash 命令找出这个路径)
for x in 1 2 3(其中要有空格) 或者写为 $(seq 1 100)
 do
 useradd user$x
 echo "redhat" | passwd user$x --stdin
 done
执行的两种方式:
bash user.sh  执行
./user.sh  执行
再写入:
!#/bin/bash
for x in $(seq 1 100)
do
userdel user$x -r
done
./user.sh 
结束。。。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值