Linux Getting Started third exam questions

Source: Internet
Author: User
Tags egrep

1.1 Write the purpose of the file or directory

1./etc/hosts local IP domain name resolution

2./etc/sysconfig/network Modify Host Name

3. Automatic mounting of the/etc/fstab system

4. boot file for/etc/rc.local boot

5./etc/inittab System Operating Sector

6./ETC/INIT.D Storage Service Script

7./etc/profile Environment variables

8./usr/local The default installation path

9. Management Log for/var/log/message system

Security Log for/var/log/secure system

One./var/spool/cron/root root user's scheduled task profile

Some basic information about the/proc/cpuinfo CPU

Some basic information about/proc/meminfo memory.

Load information for/PROC/LOADAVG systems

Mount information for the/proc/mounts system.

1.2 Please write out the redhat, what is the configuration file for configuring the network card and DNS?

Answer:

Configure network card: Etc/sysconfig/network-scripts/ifcfg-eth0

DNS:/etc/resolv.conf

1.3 Please say Linux system from power on to enter the login interface throughout the process

Answer:

BIOS self-Test

MBR boot

Grub Menu

Load kernel

Running the init process

Read Etc/inittab

Execute initialization Script/etc/rc.sysinit

Load kernel module/ETC/RC.D/RC3.D

Executive Etc/rc.locla

Run/bin/login Login

1.4 What is the way to start a script or service on the system boot?

Answer:

Method One:

Put the script in the ETC/INIT.D directory to add the Chkconfig management

In the script to join the Chkconfig management boot order

# chkconfig:2345 55 25 2345 Run several times 55 boot boot sequence 25 off order

Method Two:

Place the script in the rc.local boot program

1.5☆ has a hao.txt file that converts all the letters in the box to uppercase.

Answer:

Method One:

[Email protected] init.d]# echo kaile | TR ' [A-z] ' [A-z] '

Kaile

[[Email protected] hao]# TR ' A-Z ' A-Z '

Method Two:

awk ' {print ToUpper ($)} ' Hao.txt

Method Three:

[[Email protected] hao]# sed ' s#[a-z]#\u& #g ' hao.txx

1.6 Give at least 3 kinds of commands to remove the IP address of the network card

Answer:

Method One:

[Email protected] init.d]# hostname-i

192.168.56.3

Method Two:

[Email protected] init.d]# ifconfig eth0 | Awk-f "[:]+" ' Nr==2{print $4} '

192.168.56.3

Method Three:

[Email protected] init.d]# ifconfig eth0 | Sed-rn ' 2s#^.*addr: (. *) BCA.*$#\1#GP '

192.168.56.3

Method Four:

[Email protected] init.d]# ifconfig eth0 | Egrep-o "[0-9.] +" | Sed-n ' 8p '

192.168.56.3

There are at least 20 ways to do this without demonstrating that you can

Command Description:

Awk-f Specify delimiter condition second line

SED match Regular

grep matching Regular

Play Three Musketeers.

1.7 If you write data to disk, the following error is indicated: No space left on device, through Df-h view disk space, found not full, may I ask what is the reason?

Answer:

The inode is full, and there's a lot of small files that take up the system's inode, causing the inode to be full, so we must first find these small files and delete these small files

1.8 Execute the command to take out the IP address of eth0 in Linux

Answer:

Ifconfig eth0 | Awk-f "[:]+" ' nr==2{prine$4}

Ifconfig eth0 | Awk-f "[:]+" ' Nr==2{prine $4} '

Ifconfig eth0 | Awk-f "[:]+" ' Nr==2{print $4} '

Ifconfig eth0 | Sed-n ' 2p ' |sed ' s#^.*dr# #g ' |sed ' s#bc.*$# #g '

Ifconfig eth0 |grep ' inet addr ' |cut-d ': "-f2 |cut-d" "-f1

Ifconfig eth0 |grep ' inet addr ' |egrep-o ' [0-9.] + ' |grep-v 255

1.9 Find files larger than 50k less than 100k in the system, copy them into the/tmp directory (4 ways)

Answer:

The first method:

Find-type f-size +50k-size-100k|xargs-i CP {}/TMP

The second method:

CP $ (Find-type f-size +50k-size-100k)/tmp

The third method:

Find-type F-size +50k-size-100k-exe c CP {}/tmp \;

The fourth method:

Find-type f-size +50k-size-100k|xargs cp-t/tmp

1.10 1.10 Please give the example of a date command in the following format: 11-02-26. Then give the implementation of the weekly output such as: Saturday output of 6, please give the command separately. Printed three days ago date format such as: 2011-02-26

Answer: [[Email protected]/]# date +%y-%m-%d

17-03-28

Date +%w

2

[Email protected] ceshi]# date-d " -3day" +%f

2017-02-11

Command Description:

Date View Set system date

%F is displayed by month and day

%w Show Day of the week

1.11 1.11 The/etc/directory package compression is placed in the/backup directory and requires a different file name to be backed up each day, writing out the operation process. (10 points)

Answer:

CD/

Tar zcf/backup/etc_$ (date +%y-%m-%d-%h_%m). tar.gz/etc

Command Description:

Tar compression command

ZCF Packaging and compression

TF View packaged compressed files

XF Unzip the package file

-C Specify Unzip directory

$ (date) This is the first execution of the parentheses inside the command equivalent to the anti-quote

This article is from "Ah Kai" blog, please be sure to keep this source http://kaile.blog.51cto.com/12459560/1920608

Linux Getting Started third exam questions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.