date
%F 显示年月日
%H 显示小时
%M 显示分钟
%S 显示秒
%T 显示时间
eg:
创建一个文件以当前时间命名:
或者 touch myfile-`date +%F-%T`
/dev/null 可用于清除文件日志
cat /dev/null > /var/log/wtmp
别名: alias
alias ll='ls -l'
此方法更改别名只针对当前登录有效,若系统重启当失效;若想别名长期有效,可以更改
/etc/profile或自己的~/.bashrc中设定指令的别名。
/etc/bashrc 设置为全系统可用
/.bashrc 设置给单用户使用.
unalias 撤销别名
unalias ll
显示Linux 系统变量
/etc/profile
/etc/bash.bashrc
交互式登录用户执行配置文件的过程:
/etc/profile --> /etc/profile.d/* --> ~/.bash_profile --> ~/.bashrc --> /etc/bashrc
eg: 让每位用户登录系统都显示一句话“Hello, How are you”
显示变量:
set
export
printenv