基础篇

1.基础一

1.1 获取操作系统的基本信息

$ uname -a
Linux myself 4.2.0-27-generic #32~14.04.1-Ubuntu SMP Fri Jan 22 15:32:26 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

上面的命令输出,有以下的信息

  • Linux 14.04.1-Ubuntu 为操作系统版本
  • linux 的内核版本为4.2.0-27-generic
  • x86_64说明是64位的操作系统
  • 当前用户名是myself

1.2 新安装的ubuntu操作系统root密码

>新安装的ubuntu操作系统,在安装过程中建立了一个新的用户,如:hanxt。没有为root用户设置密码的步骤。
所以root密码是随机变化的。如果需要利用root用户,需要用hanxt用户登录,为root用户修改密码

hanxt@ubuntu1:~$ sudo passwd
[sudo] password for hanxt: (此处输入hanxt的密码)
Enter new UNIX password: (此处输入root密码)
Retype new UNIX password: (再次输入root密码)
passwd: password updated successfully

1.3 crontab服务使用

  • 查看crontab服务是否启用,该命令ubuntu亲测可用
    service cron status
    
  • crontab -e,每隔5分钟与ntp授时服务器同步时间,需要root用户(su root)
*/5 * * * * /usr/sbin/ntpdate cn.pool.ntp.org  > /home/aexit1/ntpdate.log
touch /home/aexit1/ntpdate.log
chown root:root   /home/aexit1/ntpdate.log

1.4 修改系统主机名

1.修改hostname为driver1

hostname driver1

2.修改/etc/hosts

192.168.1.32  driver1

重新登陆,hanxt@driver1:~$

文章导航