day1学习任务
【视频】1.Shell介绍
【视频】2.命令历史
【视频】3.命令补全和别名
【视频】4.通配符
【视频】5.输入输出重定向
️12点系统会提醒学习打卡
️当日测验于晚间8时左右在群里公告,届时注意群消息
history的最多条数由$HISTSIZE变量控制,所有执行过的命令在.bash_history
history -c 清除掉历史命令
HISTSIZE该参数在/etc/profile 里可配置
HISTTIMEFORMAT="%Y/%m/%d %H:%M:%S "
chattr +a ~/.bash_history
!! 执行上一条命令
!n执行第n条
!word 执行最近一条以word开头的
命令补全
bash-completion 命令包补全
定义别名
.bashrc
/etc/profile.d/
alias restartnet= systemctl restart network.service
unalias restartnet
通配符
*代表任意一个或多个字符
?代表单个字符
ls [0-9].txt 代表范围当中的一个
ls {1,2}.txt 同上,只是写法不同
重定向
cat 1.txt > 2.txt
cat 1.txt >> 2.txt
cat 1.txt 2> err.txt 2> 表示将错误输出重定向到一个文件中
ls [12].txt aaa.txt &> a.txt
&>错误和正确均重定向到一个文件
ls [12].txt aaa.txt > 1.txt 2>a.txt --将不同错误打印到不同的文件