如何在 /etc/rc.conf 中新增行?

如何在 /etc/rc.conf 中新增行?

我跟著本教程要安裝 FreeBSD 10.1,並在顯示「將以下行新增至/etc/rc.conf」的步驟中,我必須在其中新增以下行:

hald_enable="YES"
dbus_enable="YES"
performance_cx_lowest="Cmax"
economy_cx_lowest="Cmax"

但我是 Unix 新手,我不知道如何在 中添加這些行/etc/rc.conf,我嘗試過,cd但它說Too much arguments.如何在 中新增這些行/etc/rc.conf

編輯:我還沒有安裝桌面環境。

答案1

有一個名為 的專用實用程序sysrc,它應該已經安裝在您的 FreeBSD 上。例如:

sysrc hald_enable=YES

這是一行:

sysrc hald_enable=YES dbus_enable=YES performance_cx_lowest="Cmax" economy_cx_lowest="Cmax"

man 8 sysrc更多細節。

或者,對於可以使用的服務service(8)在 FreeBSD 13.0 或更高版本上啟用服務:

service sshd enable

rc.subr(8)在您的系統上確定該enable命令是否受系統上的服務支援。

答案2

需要學習某種文字編輯器。 FreeBSD 有多種可用的工具,例如 nano、ed、vi、emacs 等等。我不想引發一場口水戰,所以我鼓勵你自己學習它們。

如果您想以真正快速而骯髒的方式來完成您的要求,請嘗試:

cat >> /etc/rc.conf << "EOF"

dbus_enable="YES"

performance_cx_lowest="Cmax"

economy_cx_lowest="Cmax"
EOF

答案3

一個簡單的方法是..

echo "hald_enable="YES"
dbus_enable="YES"
performance_cx_lowest="Cmax"
economy_cx_lowest="Cmax"" >> /etc/rc.conf

相關內容