1. 重启系统
> sudo reboot
2. 清屏
> clear
3. 退出当前shell
> logout
4. 输出内核相关信息 例如内核版本号
> dmesg | less # 其中,less能够让输出的信息整屏可向前滚动移动显示。
The dmesg command is used to write the kernel messages in Linux and other Unix-like operating systems to standard output (which by default is the display screen).
在系统启动过程中,会显示内核信息,例如内核所发现的硬件设备有哪些。
5. 切换为root账户
> su
6. 改变账户密码
> passwd
7 列出系统下的所有用户
# 系统用户信息都存在 /etc/passwd 中; 下边命令输出每行的第一列即为系统登陆账户,非常多呢。
> cat /etc/passwd
8. 关机
> shutdown -h now
9. 查看当前哪些用户登录了主机
> who
10. 显示目录下的内容
#以列表形式显示当前目录下的内容,其中'.' 开始的目录为隐藏的。第一列为用户权限,第二列含目录数目,第三列所有者,第四列群组,第五列大小,第六列最后修改时间,最后一列为名称。
> ls -al
# 显示文件夹
> ls -F
11. 把缓冲区尚未写入的内容写到硬盘
> sync
12. 复制目录文件
> cp
13. 移动目录档案
> mv
15. 建立目录
> mkdir
16. 删除目录
> rm
17. 当前工作目录
> pwd
18. 显示文档内容
> cat
19. lsb_release -a
20. 查看某包是否已经安装
>yum list installed | grep 'gcc'
21. 安装包
> yum install "包名"
(yum 不到情况下,通过google找到rpm,下载安装)
> wget xxxx.rpm
> rpm -ivh xxx.rpm
22. > info [gcc] /man [gcc] --Gets more information about the commands using info.
23. 查看文件类型时可用
> file [文件名]
24. Change the file mode to make the file executable for all users using the chmod command
> chmod +x [File name]
25. 添加当前目录到环境变量中去
> PATH
> PATH=$PATH:.
26. 管理自个写的shell脚本, 如果禁止他人修改,可以删除写权限
$cp [脚本文件] /usr/local/bin
$chown root /usr/local/bin/shellScripts
$chgrp root /usr/local/bin/shellScripts
$chmod 755 /usr/local/bin/shellScripts
27. 内存检查
$ grep MemTotal /proc/meminfo
$ free
28. 磁盘空间检查
$ df -h
29.显示系统架构
$ cat /proc/version
$ uname -a
$ uname -r
$ lsb_release -a
30. 主机名
$ hostname
/etc/sysconfig/network中的hostname要与/etc/hosts中的一致