使用者工具

網站工具


os:linux:ubuntu_技巧

Ubuntu 技巧

使用 root 登入 Ubuntu

1. 首先點選左上角的 附屬應用程式 中的 終端機

2. 然後下一道指令去變更 root 的密碼,如下圖所示

$sudo passwd root

3. 再來點選 系統 –> 管理 –> 登入畫面

4. 在登入視窗的偏好設定中點選 安全性

5. 在 安全性 的選單中,勾選 允許本地端系統管理員登入

6. 請先把系統 登出

7. 輸入您的帳號 root

8. 輸入您 root 的密碼

9. 以 root 登入時會出現這個訊息這時請直接點選 Continue 即可


使用 root 開啟檔案資料夾

# sudo nautilus

解决vi方向键和退格键失效的方法

解决办法:

修改 /etc/vim/vimrc.tiny , 将

1. set compatible 改成 set nocompatible

2. 添加 set backspace=2

即可。


Ubuntu 12.04 LTS 如何讓root登入

請打開終端機來修改一個檔案

1. vim /etc/lightdm/lightd.conf

2.在最後面加上這一行

greeter-show-manual-login=true

3. 保存起來 重開機

4. 登入畫面多一個login的選項!

PS. 當然你須先修改 root 的密碼

sudo passwd root

Ubuntu 12.04 LTS 文字模式登入

開啟終端機,編輯 /etc/default/grub,找到下列這行後,加上#字。

#GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

再輸入下列此行

GRUB_CMDLINE_LINUX_DEFAULT="text"

存檔離開後

再輸入下列此行

sudo update-grub

重新開機


Ubuntu 設定固定 IP

由於安裝的 Ubuntu 是Desktop的版本,所以,系統裝好了之後預設都是用 Dhcp來取得 IP,記錄一下用手動方式來設定IP

# sudo vi /etc/network/interfaces

一、單網卡單 IP

auto eth0 ## 重要,這一行一定要設定
iface eth0 inet static
address [IP] ## 請將 [IP] 換成你要的 IP
netmask 255.255.255.0
gateway 192.168.1.1

二、單網卡多個 IP(直接在網卡後,加上 “:n“)

auto eth0:0
iface eth0:0 inet static
address [IP]
netmask [遮罩]
gateway [閘道]

auto eth0:1
iface eth0:1 inet static
address [IP]
netmask [遮罩]
gateway [閘道]

設定好了之後,需要重新啟動網卡才會生效,可以利用下列指令來達到這個動作

# sudo /etc/init.d/networking restart

Ubuntu下更改eth0網卡名稱為eth1

這個方法用於解決Ubuntu下更換網卡後,新網卡變更為eth1,並且源網卡的名稱eth0,無法給新網卡用的情況。也可以用於為網卡更名。

網卡MAC地址改變之後,在Linux中找到網卡,新的網卡會被識別為eth1或者更為靠後的網卡寫入到/etc/udev/rules.d/70-persistent-net.rules這個文件中,修改/etc/udev/rules.d/70-persistent-net.rules這個文件,將eth0的MAC地址修改為改變後的地址就可以。

編輯 /etc/udev/rules.d/70-persistent-net.rules

# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device 0x1022:0x2000 (pcnet32)
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:06:59:ab", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x1022:0x2000 (pcnet32)
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:7d:11:9e", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x1022:0x2000 (pcnet32)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:d7:89:88", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

將其中的eth0,改為eth1,保存後重啟系統即可。


Install Development Tools

# sudo apt-get install build-essential

os/linux/ubuntu_技巧.txt · 上一次變更: 2019/11/16 08:12 (外部編輯)