Old boy-linux-36 Second exam question-summary Lu Xiaoxue

Source: Internet
Author: User
Tags echo command


1 You want the script to run in the background when you execute the script need to add (&) after the script name


2 File system can be set up automatically by modifying file (/etc/fstab)


3 The following command is known and the returned result is the return result of Echo $user is ( empty )

[email protected] ~]$ cat test.sh

User= ' WhoAmI '

[Email protected] ~]$ sh test.sh && echo $user

Note: Because the script is a sub-process local variables need to export set global variables or write to/etc/passwd


4 Linx system boot after loading hardware drivers and file systems, etc. the kernel will boot to (init) Program This is also after the boot process is completed

The kernel runs the first program we can modify the default boot level (init3) to allow the system to automatically use the command mode directory after a reboot


5 in a Linux system, when there are no conditions in the LAN to establish a DNS server, but also want to let users within the LAN can use the computer name

Should be configured when accessing each other (hosts)


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

①/etc/sysconfig/network-scripts/ifcfg-eth0

②/etc/resovl.conf


1.2 Create the directory/data/oldboy,/etc/passwd the first 20 rows to the/data/oldboy/oldboy.txt file.

[Email protected] data]# head-20/etc/passwd >oldboy.txt

[Email protected] data]# awk "nr==1,nr==20"/etc/passwd >oldboy.txt

[Email protected] data]# sed-n "1,20p"/etc/passwd >oldboy.txt


1.3 redirect 5-15 rows from the/etc/passwd file to/tmp/oldboy/test.txt (at least two methods)

[Email protected] tmp]# cat-n/etc/passwd|awk "nr>4&&nr<16" >oldboy/test.txt

[Email protected] tmp]# nl/etc/passwd|sed-n ' 5,15p ' >oldboy.test.txt

[Email protected] tmp]# Nl/etc/passwd|awk "nr==5,nr==15" >oldboy.test.txt

[Email protected] tmp]# head-15/etc/passwd|tail-11>oldboy.test.txt


1.4 Require command not found when using RM command, how do I implement (alias)?

Temporary entry into force

[[email protected] data]# alias rm= "echo Command not Found"

[Email protected] data]# RM

Command not Found

Permanent effect

[[email protected] data]# echo "Alias rm= ' echo Command not found '" >>/etc/profile

[Email protected] data]# source/etc/profile


1.5 Replace All Oldboy in the/data/oldboy/directory with Bingbing.

[[email protected] data]#find oldboy-type F |xargs sed-i ' s#oldboy#bingbing#g '


1.6 Delete all files except the passwd file in the/tmp/oldboy/directory.

[[email protected] tmp]# Find/-type f! -name ' *passwd ' |xargs rm-f

[[email protected] tmp]# Find/-type f! -name ' *passwd '-exec rm-f {} \;

[Email protected] tmp]# rm-fr ' find./-type f! -name ' *passwd '


1.7 Please say what you know the following characters in Linux can represent the meaning of

~  . .. |>>><<< #

~ Normal User's home directory

. Current directory

.. Top level Directory

> Output redirection

>> Append output redirection

< input redirection

<< Append input from orientation

# Notes


1.8 describes several of the startup/RunLevel levels of Linux and what they mean.

0 Turn off the machine

1 Single-User mode

2 Multi-user mode without NFS

3 Multi-user command-line mode

4 Non-used

5 Desktop Mode

6 restart


1.9 Find all the files in the/oldboy directory that are 7 days old, ending with log and larger than 1M, and move the files to/tmp.

Parameters involved:

-type Type D directory f file

-mtime modification Time

-size size

Find/oldboy-type f-name ' *.log '-mtime+7-size +1m|xargs-i MV {}/tmp

Xargs-i can use {} to move what find finds to/TMP or MV-T/tmp


Find/oldboy-type f-name ' *.log '-mtime+7-size +1m-exec MV {}/tmp \;


MV-T/tmp $ (find/oldboy-type f-name ' *.log '-mtime+7-size +1m)

MV-T specifies that the source file is moved to the destination file without having/tmp back


MV ' Find/oldboy-type f-name ' *.log '-mtime+7-size +1m '/tmp

' Inverse quotation marks are equivalent to $ () execute the contents of the symbol first and then to the previous command.


1.10 How do I see if I turn on port 80 and see if the sshd process exists?

Netstat-luntp|grep 80

Telnet IP address 80 under Windows

Ps-ef|grep sshd Viewing process


1.11 List The Linux common packaging compression tools you know and their compression decompression parameters.

Tar ZCVF Packaging

-G GIZP

-C Create creates a compressed file

-f file Specifying backup files

-V Show Operation procedure

-t list lists the contents of the backup file

-X Get restore files from backup files



Old boy-linux-36 Second exam question-summary Lu Xiaoxue

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.