Linux常用命令总结

  1. 给普通用户授权                                                                                                                                                                                最简单的方式是用visudo命令,在root ALL=(ALL)  ALL下面一行添加需授权的用户,具体如下(以用户名cloud为例):cloud ALL=(ALL) ALL,cloud用户每次在执行命令时只需在前面添加sudo即可。
  2. 修改主机名 分三步来完成:(1)用hostname xxx  (2) vi /etc/sysconfig/network将HOSTNAME的值改为xxx(3)vi /etc/hosts将localhost改成xxx,注:以上三者名字必须一致。再一次打开终端时,就可以看到我们更改的主机名,可以运用hostname显示主机名,hostname -i显示IP,hostname-f显示显示全域名(FQDN,Fully Qualified Domain Name)。
  3. IP地址、DNS配置                                                                                                                                                                          以root进行更改,vi /etc/sysconfig/network-scripts/ifcfg-eth0
  • 修改IP

BOOTPORT="static"

ONBOOT="yes"随系统启动

IPADDR=""

NETMASK=""

GATEWAY=""

  • 修改DNS  vi /etc/resolv.conf中加入hostname  xxxx
  • 重启网络接口 ifconfig eth0 down    ifconfig eth0 up              service network restart
  1. 两个linux主机间文件传送                                                                                                                                                               传送目录       scp -rp abc cloud@server:/home/...   r表示recursive p Preserves modification times, access times, and modes from the original file
  2. CentOS中ssh  我们安装系统时,已经安装了ssh,我们需要安装用yum isstall openssh-clients,并启用ssh服务,/etc/init.d/sshd start,设置每次开机启动用chkconfig sshd on
原文地址:https://www.cnblogs.com/yueliming/p/2868690.html