Home  >  Article  >  System Tutorial  >  Detailed explanation of commonly used FAQs in Ubuntu operating system

Detailed explanation of commonly used FAQs in Ubuntu operating system

WBOY
WBOYforward
2024-01-12 14:39:261173browse

1. Record how to view the crontab log on ubuntu server

crontab logging

Modify rsyslog

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

cron.* /var/log/cron.log #Remove the comment character in front of cron

Restart rsyslog

sudo service rsyslog restart

View crontab log

less /var/log/cron.log

2. Reset the default editor of crontab -e in ubuntu

Ubuntu System Admin Set up scheduled tasks on the first-line server, and accidentally selected nano. Since I have been exposed to the redhat series before, I was not used to using nano, so I wanted to reset it. I checked online, and it seemed that it was not available. .

In desperation, I reinstalled a server to test, and found that when you select the editor with crontab -e for the first time, you will be reminded: If you want to change the selection in the future, enter select-editor. Alas, you are still not careful enough. . . sudo select-editor select vim to get it done. .

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

The selected number is "3", /usr/bin/vim.basic.

3. Change ubuntu dash shell to bash

The default script parser under ubuntu shell is dash, which will cause some bash scripts to fail to execute.

Change back to bash as follows:

sudo dpkg-reconfigure dash

Choose NO

4. How to modify resolv.conf

unbuntu will reset resolv.conf every time it restarts

1. Write the dns-nameservers in the /etc/network/interfaces file into resolv.conf

2. Copy the contents of /etc/resolvconf/resolv.conf.d/base to resolv.conf

Therefore, if we want to ensure that resolv.conf remains unchanged after each restart, we must start by modifying the above two files

5. How to modify the IP

Just modify the following configuration file

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

6. Modify the host name

Just modify the following two files

/etc/hostname

/etc/hosts

The above is the detailed content of Detailed explanation of commonly used FAQs in Ubuntu operating system. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:jb51.net. If there is any infringement, please contact admin@php.cn delete