Linux学习笔记(不断更新。。。)

Linux学习笔记(不断更新。。。)

获取Root权限

在终端中输入:
sudo passwd root
Enter new UNIX password: (在这输入你的密码)
Retype new UNIX password: (确定你输入的密码)
passwd: password updated successfully

以后,如果在想获得root权限,只需进行如下的操作:
su root
Password: (在此输入你上面设置的密码)

如果要再次禁用 root 帐号,

那么可以执行 sudo passwd -l root


vi(shell文本编辑器)保存、退出命令
:w /* save not exit */

:w newfilename /* save as use name "newfilename" */

:q /* exit, only the file not changed */

:q! /* exit not save file, all change will been give up */

设置IP
我这里网卡名为:enp2s0,同时记录下掩码地址,下面会用到这两个参数。

  终端输入vi /etc/network/interfaces命令编辑配置文件,增加如下内容:     
    auto enp2s0
    iface enp2s0 inet static
    address 192.168.1.211
    netmask 255.255.255.0
    gateway 192.168.1.1
    iface enp2s0 inet6 auto

重启网络

gec@ubuntu:~$ sudo /etc/init.d/networking restart

* Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces

* Reconfiguring network interfaces...

原文地址:https://www.cnblogs.com/Rock-lynn/p/14000536.html