Ubuntu常用命令及配置

1. 常用命令:

系统操作相关:

  • 切换到纯命令:alt+ctrl+F6
  • 切换到图形界面:alt+ctrl+F7
  • 打开命令终端:alt+ctrl+T
  • 要屏幕自适应,得先安装增加功能

terminel终端

  • 切换至root权限:sudo -i
  • 切换至zhjaa用户:su zhjaa
  • 编辑文件:vi interfaces
  • 进入编辑模式:aios
  • 进入命令模式:etc
  • 进入尾行模式:冒号
  • w保存q退出wq保存退出!强制执行

2. 配置网卡:

vi /etc/network/interfaces:
# The loopback network interface 
auto lo 
iface lo inet loopback 
 
# The primary network interface 
auto eth0 
iface eth0 inet dhcp 
 
# Virtualbox Host-only mode
auto eth1 
iface eth1 inet static 
address 192.168.56.101
netmask 255.255.255.0 
#network 192.168.56.0 
 
# Virtualbox Bridged mode
#auto eth1
#iface eth1 inet static 
#address 192.168.0.190 
#netmask 255.255.255.0 
#gateway 192.168.0.1

设置DNS
sudo vi /etc/resolv.conf   
enter the following details   
search test.com   
nameserver 192.168.3.2

重启网卡:
sudo /etc/init.d/networking restart

//安装ssh
sudo apt-get update
sudo apt-get install ssh

3.常用命令

重启命令:

1、reboot
2、shutdown -r now 立刻重启(root用户使用)
3、shutdown -r 10 过10分钟自动重启(root用户使用)
4、shutdown -r 20:35 在时间为20:35时候重启(root用户使用)
如果是通过shutdown命令设置重启的话,可以用shutdown -c命令取消重启

关机命令:


1、halt 立刻关机
2、poweroff 立刻关机
3、shutdown -h now 立刻关机(root用户使用)
4、shutdown -h 10 10分钟后自动关机
5、reboot
如果是通过shutdown命令设置关机的话,可以用shutdown -c命令取消重启

重启网卡方法:

查看网卡信息: ifconfig
设定一个网卡IP:ifconfig eth1 192.168.1.10 netmask 255.255.255.0
重启网卡使设定生效:sudo /etc/init.d/networking restart
用ubuntu的系统——>系统管理——>网络的网络设置
关闭网卡 ifdown eth0
开启网卡 ifup eth0
重启网卡,优点是可以指定网卡,不影响其他网络接口
posted @ 2017-04-25 11:35  漂过太平洋  阅读(260)  评论(0)    收藏  举报