Linux Tips几则

一,查看是否存在某命令

$ command -v foo >/dev/null 2>&1 || { echo >&2 "I require foo but it's not installed.  Aborting."; exit 1; }
$ type foo >/dev/null 2>&1 || { echo >&2 "I require foo but it's not installed.  Aborting."; exit 1; }
$ hash foo 2>/dev/null || { echo >&2 "I require foo but it's not installed.  Aborting."; exit 1; }


二,查看相关用户的命令执行记录

cat /root/.bash_history

mac查看当前用户的执行记录

cat ~/.bash_history


三,需改root密码

sudo passwd root 


四,关闭内存地址随机化

root权限执行
echo 0 >/proc/sys/kernel/randomize_va_space


五,查看Ubuntu版本

sudo lsb_release -a

你可能感兴趣的:(备忘)