命令如下,查看当前用户宿主目录完全路径,当前工作目录的绝对路径,平时的命令提示符,第二行待输入命令提示符,默认命令搜索路径,终端类型以及用户识别号
echo $HOME
echo $PWD
echo $PS1
echo $PS2
echo $PATH
echo $TERM
echo $UID
#!/bin/bash
var=1
until [ $var -gt 10 ]
do
sq=`expr $var \* $var`
echo $sq
var=$(($var+1))
done
echo "Job completed"
出现的问题: []内缺少空格
解答(摘自Stack Overflow)
A bit of history: this is because '[' was historically not a shell-built-in but a separate executable that received the expresson as arguments and returned a result. If you didn't surround the '[' with space, the shell would be searching $PATH for a different filename (and not find it)
sudo useradd zhangsan
sudo passwd zhangsan
usermod -c 张三 zhangsan
chfn zhangsan
Office Phone[]: 57111111
ls /home
此时有两个用户,py和zhangsan
userdel -r zhangsan
ls /home
groupadd -g 1800 group1
cat /etc/group|grep group1
sudo fdisk -l
sudo fdisk /dev/sdb
一路按提示划分两个区
先查看一下,今天的分区也是一片祥和呢😝
sudo fdisk -l /dev/sdb
sudo mkfs -t ext4 /dev/sdb1
挂载中
mkdir /mnt/kk
mount -o ro /dev/sdb1 /mnt/kk
新建新文件夹测试失败,因为只读
mkdir /mnt/kk/a
新建文件夹jj
sudo mkdir /mnt/jj
修改fstab文件
sudo vi /etc/fstab
在文件末尾加上挂载信息,我这里的3GB分区是/dev/sdb2
/dev/sdb2 /mnt/jj ext4 defaults 0 0
取消所有用户权限,查看一下,天下大同
chmod a- rwx /root/ab
ls -l /root/ab
增加拥有者三种权限
chmod u+rwx /root/ab
chmod g+rw
ls -l /root/ab
useradd lisi
ls -l /root/ab
chown lisi /root/ab