Linux First Exam Questions

Source: Internet
Author: User

1.1 I want to create a oldboy.txt file under the/data/oldboyedu directory

[Email protected] ~]# cd/data/oldboyedu

-BASH:CD:/data/oldboyedu:no such file ordirectory

1. Why this error has occurred

2. How do I resolve this error?

No /data/oldboyedu this directory

Mkdir-p/data/oldboyedu

Touch/data/oldboyedu/oldboy.txt

1.2 The question , add the content "I Love studying Linux" to oldboy.txt. (not less than 2 methods )

Method One

Vim/data/oldboyedu/oldboy.txt

I Love studying Linux.

Method Two

echo "I love Studyinglinux." >>/data/oldboyedu/oldboy.txt

Method Three

Cat >>/data/oldboyedu/oldboy.txt<<eof

I Love studying Linux.

Eof

1.3 Copy the/data directory to the/tmp directory

cp-r/data//tmp/

1.4 said these special symbolic meanings : > >> 2> 2>> # ( pound ). ( point ): ( two points )

> output REDIRECT symbol >> append output redirect 2> standard error Output redirect

2>> standard error Append output redirect # comment . current directory

.. Top level directory of current directory


1.5 test.txt content is :

Trainning

Fanbing

Binglidao

please give the command that does not contain the trainning string when outputting the contents of the Test.txt file .

method One: Tail-2 ett.txt

method Two:grep-v "Trainning" Ett.txt

method Three:sed '/trainning/d ' ett.txt

method Four:sed-n ' 2,3p ' ett.txt

method Five:awk '!/trainning/' ett.txt

method Six:awk ' nr==2,nr==3 ' ett.txt

1.6 New company, boss let you restrict the RM command on the server , when the user enters the RM command Prompt "rm commandis not allowed to use. " What are the steps to be implemented?

Alias rm= ' echo RM commandis notallowed to use '

Source/ect/profile

Modify Comment VIM/ROOT/.BASHRC


1.7 Take out the contents of the file ett.txt from the first of the lines.

method One: sed-n ' 30,40p ' ett.txt

method Two:awk ' nr==30,nr==40 ' ett.txt


1.8 Change the trainning in the Test.txt file to Oldboy.

sed ' s#trainning#oldboy#g ' test.txt


1.9 finds all files in the/data directory ending in. txt, and modifies the trainning in the file to Oldboy.

find/data-type f-name "*.txt" |xargs sed ' s#trainning#oldboy#g '


1.10 Find All files under /oldboy that are larger than 1M at the end of the log are copied to /tmp .

Find/oldboy-type f-name "*.log"-size +1m |xargs cp-t/tmp

CP $ (Find/oldboy-type f-name "*.log"-size +1m)/oldboy

1.11 What is the operating level of Linux, describe the meaning of different numbers of Linux running levels? (Additional questions)

0 turn off the machine

1 Single-user mode

2 Multi-user mode (no NFS)

3 full Multi-user mode

4 not used

5 Graphical Interface

6 Restart

1.12 Please describe the difference between buffer and cache ( additional questions )?

Buffer: The memory space in which data is written to memory is called buffer buffers

Cache: The memory space to read data to memory is called the cache cache


This article is from the "Heyong" blog, make sure to keep this source http://heyong.blog.51cto.com/13121269/1954288

Linux First 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.