命令大全

1.history: #显示命令的历史记
选项:

-c #清楚所有的历史记录

-d #删除历史ID对应的命令

-w # 将当前、历史记录保存到默认的文件中~/.bash_history

举例:[root@gaofeng ~]# history 查看历史记录
1 ll
2 cd /etc/yum.repos.d/
3 yum install -y tar zip unzip gzip
4 tar
5 zip
6 yum install -y tar
7 ll
8 yum indtsll -y gzip
9 yum provides gzip
10 yum install ifconfig

alias #设置别名

举例;alias 别名=执行的命令

unalias #取消别名


举例:unalias 别名

shutdown #关机及重启的命令

选项:
-h #关机

-h 0 #关机

-h now #关机

-h 12:00 #定时关机

· -r # 重启

-r 0 #立刻重启

-r now #立刻重启

-r 12:00#定时重启


-c #取消定时的关机或者重启


举例 :
[root@gaofeng ~]# shutdown 17:00
Shutdown scheduled for Tue 2020-07-07 17:00:00 CST, use 'shutdown -c'


[root@gaofeng ~]# shutdown -c

Broadcast message from root@gaofeng (Tue 2020-07-07 16:03:59 CST):

The system shutdown has been cancelled at Tue 2020-07-07 16:04:59 CST!

poweroff #关机命令

举例[root@gaofeng ~]# poweroff
Connection closing...Socket close.

Connection closed by foreign host.

Disconnected from remote host(模板机250) at 16:12:38.

Type `help' to learn how to use Xshell prompt.
[C:~]$



halt #关机命令,本身只会关闭系统,不会关闭电源,需要手动关闭电源

选项:

-p #关闭电源及系统

init #切换运行级别

0 #关机 将运行级别切换为关机级别

6 #重启 将运行级别切换为重启级别

 reboot                 #立刻重启 

 logout #退出当前登录的用户 ,不能退出非登录式shell

exit #退出当前登录的用户,主要用于脚本退出

11. ip

address #显示所有IP地址 简写为 a

address show eth0 #显示某个网卡的信息 简写为 a s eth0

举例(1)
root@gaofeng ~]# ip a


1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:61:38:85 brd ff:ff:ff:ff:ff:ff
inet 10.0.0.250/24 brd 10.0.0.255 scope global noprefixroute eth0
valid_lft forever preferred_lft forever
inet6 fe80::5356:2ac5:e050:737a/64 scope link noprefixroute
valid_lft forever preferred_lft forever


举例(2)

[root@gaofeng ~]# ip a s eth0

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:61:38:85 brd ff:ff:ff:ff:ff:ff
inet 10.0.0.250/24 brd 10.0.0.255 scope global noprefixroute eth0
valid_lft forever preferred_lft forever
inet6 fe80::5356:2ac5:e050:737a/64 scope link noprefixroute
valid_lft forever preferred_lft forever

原文地址:https://www.cnblogs.com/GAO321/p/13374320.html