基本命令:
man
man 7 man
ls ln chmod chown stat
cd pwd . .. ~
普通用户 uid >= 500
管理员用户 uid = 0
useradd userdel passwd su
touch rm mkdir rmdir
通配符:* ?
cp mv
cat tac more less head tail
grep cut sort uniq wc tr
> 2> >> < << |
ping showmount mount tar
vim:编辑器
配置文件:~/.vimrc 当前用户配置
/etc/vimrc 所有用户配置
查找 => 替换
/ ?
================================================
shell编程
shell也是一门语言,作脚本维护
主要用于侦听用户输入指令,接受到这些指令,然后执行相应操作
查看当前系统使用shell
[root@localhost test]# echo $SHELL
/bin/bash
查看当前系统都支持那些shell
[root@localhost test]# echo /bin/*sh
/bin/bash /bin/csh /bin/ksh /bin/sh /bin/tcsh
shell入口
1 创建shell脚本文件
touch file.sh
2 实现shell语言
#!/bin/bash 表示下面所有的指令都是通过bash来解析
echo "hello world" 输出指令
3 指定执行权限
chmod 755 01_hello.sh
4 执行
[root@localhost 3rd]# ./01_hello.sh
hello world
shell变量:变量不区分类型
局部变量:只对当前的shell起作用
定义:
varname=value
查看变量的值:$
案例:
[root@localhost 3rd]# a=123 定义一个局部变