首頁  >  文章  >  系統教程  >  ubuntu作業系統常用FAQ詳解

ubuntu作業系統常用FAQ詳解

WBOY
WBOY轉載
2024-01-12 14:39:261178瀏覽

一、記錄一下如何ubuntu server如何查看crontab日誌

crontab記錄日誌

修改rsyslog

sudo vim /etc/rsyslog.d/50-default.conf

cron.* /var/log/cron.log #將cron前面的註解符號去掉

重啟rsyslog

sudo service rsyslog restart

查看crontab日誌

less /var/log/cron.log

二、ubuntu 重設crontab -e的預設編輯器

#Ubuntu System Admin 在第一線上伺服器上設定計畫任務, 不小心選擇了nano, 由於先前接觸的是redhat系列的, 不習慣用nano, 於是想重設下, 網路上查了下, 貌似沒有。 。

無奈之下,重裝一台伺服器測試, 發現當你第一次crontab -e選擇編輯器的時候就會提醒你: 以後若要該改變選擇, 輸入select-editor 唉,還是不夠細心啊。 。 sudo select-editor 選擇vim 搞定。 。

root@ubuntu:/var/www# select-editor

Select an editor. To change later, run 'select-editor'.

1. /bin/ed

2. /bin/nano <---- easiest

3. /usr/bin/vim.basic

4. /usr/bin/vim.tiny

所選的數字是“3”, /usr/bin/vim.basic。

三、ubuntu dash shell 改為 bash

ubuntu shell 下預設的腳本解析器是dash, 會使一些bash腳本執行失敗.

透過如下方式改回bash:

sudo dpkg-reconfigure dash

選擇NO

四、如何修改resolv.conf

unbuntu每次重啟會重置resolv.conf

1.把/etc/network/interfaces檔案裡的dns-nameservers寫入resolv.conf

2.把/etc/resolvconf/resolv.conf.d/base的內容複製到resolv.conf

因此我們要保證每次重啟後resolv.conf不變的話我們就要從如上兩個文件著手修改

五、如何修改IP

##修改如下設定檔即可

cat /etc/network/interfaces

# This file describes the network interfaces available on your system

# and how to activate them. For more information, see interfaces(5).

# The loopback network interface

auto lo

iface lo inet loopback

# The primary network interface

auto eth0

iface eth0 inet static

address 192.168.1.100

netmask 255.255.0.0

network 192.168.0.0

broadcast 192.168.255.255

gateway 192.168.1.1

# dns-* options are implemented by the resolvconf package, if installed

dns-nameservers 192.168.0.1

六、修改主機名稱

##修改如下兩個檔案即可

/etc/hostname

/etc/hosts

以上是ubuntu作業系統常用FAQ詳解的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文轉載於:jb51.net。如有侵權,請聯絡admin@php.cn刪除