Linux Exercises and Answers

Source: Internet
Author: User

<<< First unit exercises >>>

    1. User Login system graphical interface with student

    2. Open a Bash

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/88/05/wKioL1fn-7HClS9DAACjLv8_lgs440.png-wh_500x0-wm_3 -wmp_4-s_73192455.png "style=" Float:none; "title=" 1.png "alt=" Wkiol1fn-7hcls9daacjlv8_lgs440.png-wh_50 "/>

3. Modify the student password to update the password to "T3st1ngtlme" (host letters and numbers)

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/88/09/wKiom1fn-7KStsngAACDXSNhoXQ898.png-wh_500x0-wm_3 -wmp_4-s_2937021164.png "style=" Float:none; "title=" 2.png "alt=" Wkiom1fn-7kstsngaacdxsnhoxq898.png-wh_50 "/>

4. Display the current system time, the display format is: "Hours: minutes: Seconds am/pm" (am/pm for the last afternoon logo)

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/88/05/wKioL1fn-7LyWXtAAACrlM5TIk0716.png-wh_500x0-wm_3 -wmp_4-s_1349291850.png "style=" Float:none; "title=" 3.png "alt=" Wkiol1fn-7lywxtaaacrlm5tik0716.png-wh_50 "/>

5. Display the file type of "/usr/bin/clean-binary-files"

6. Statistics for "/usr/bin/clean-binary-files" File size

5, 6 with the file command

7. Use a shortcut to invoke the 4th command that has been executed in the shell

Use! Command number

8. Use a shortcut to execute the most recent command with the "date" keyword

<<< Unit two exercises >>>

    1. Create a file with commands and regular expressions as required

(1) create 12 files with one command Westos_classx_linuxy (the value range of x is 1-2,y 1-6)

(2) These files are included in the study directory of the root user's desktop

[Email protected] desktop]# mkdir Study

[[email protected] study]# touchwestos_class{1..2}_linux{1..6}

[Email protected] study]# mvwestos_class*_linux* study/

(3) create 8 files with one command Redhat_versionx (the range of x is 1-8)

(4) Redhat_virsionx These files are included in version in the/MNT directory

[[email protected] desktop]# touchredhat_versionx{1..8}

[Email protected] mnt]# mkdir VERSION

[Email protected] desktop]# mvredhat_versionx*/mnt/version/# #这样会产生每一句都会问一下你是否同意移动, the following method is better

-------------------------MV redhat*/mnt/version/

    1. Managing the newly created document requires the following

(1) Copy the odd files from the Redhat_versionx to the desktop single with one command

[Email protected] desktop]# mkdir single/

[Email protected] desktop]# cp/mnt/version/redhat_versionx{1,3,5,7,9} single/

[Email protected] desktop]# CD single/

[[email protected] single]# ls

REDHAT_VERSIONX1 redhat_versionx3 redhat_versionx5 redhat_versionx7

(2) Copy an even number of files in the Redhat_versionx to/double with one command

[Email protected] desktop]# mkdir double/

[Email protected] desktop]# cp/mnt/version/redhat_versionx{2,4,6,8} double/

[Email protected] desktop]# CD double/

[[email protected] double]# ls

Redhat_versionx2 redhat_versionx4 redhat_versionx6 redhat_versionx8

[Email protected] double]#

650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M02/88/09/wKiom1fn-7TjL4RxAAMi21_CQjc866.png-wh_500x0-wm_3 -wmp_4-s_1886375886.png "style=" Float:none; "title=" 4.png "alt=" Wkiom1fn-7tjl4rxaami21_cqjc866.png-wh_50 "/>

(3) use a command to move Class1 files in Westos_classx_linuxy to the CLASS1 of the current user's desktop

mkdir CLASS1

mkdir CLASS2

MV Westos_class1* CLASS1

MV Westos_class2* CLASS2

--------------------------------------------------

[Email protected] study]# mvwestos_classx1_linuxy{1..6}/root/desktop/class1

[[email protected] study]# ls

Westos_classx2_linuxy1 Westos_classx2_linuxy3 Westos_classx2_linuxy5

Westos_classx2_linuxy2 Westos_classx2_linuxy4 Westos_classx2_linuxy6

(4) use a command to move class2 files in Westos_classx_linuxy to the CLASS2 of the current user's desktop

[Email protected] study]# mvwestos_classx2_linuxy{1..6}/root/desktop/class2

[Email protected] study]# CD.

[Email protected] desktop]# CD CLASS2

[[email protected] class2]# ls

Westos_classx2_linuxy1 Westos_classx2_linuxy3 Westos_classx2_linuxy5

Westos_classx2_linuxy2 Westos_classx2_linuxy4 Westos_classx2_linuxy6

    1. Back up all files in the/etc directory with numbers and ending with. conf to Confdir on the desktop

cp/etc/*[[:d igit:]]*.conf comfdir/

    1. Delete all the files you just created or backed up

[Email protected] desktop]# RM-FR class*

[Email protected] desktop]# RM-FR single

[Email protected] desktop]# RM-FR Confdir

[[email protected] desktop]# RM-FR DOUBLE

[Email protected] desktop]# RM-FR Study

650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M01/88/05/wKioL1fn_EKC8pXyAAB_1_9mSHg993.png-wh_500x0-wm_3 -wmp_4-s_2973325924.png "title=" 5.png "alt=" Wkiol1fn_ekc8pxyaab_1_9mshg993.png-wh_50 "/>

<<< Unit Fourth Exercise >>>

    1. Execute the find/etc-name passwd command under the student user and manage its output requirements as follows:

(1) Show all correct output, mask error output

find/etc/-namepasswd 2>/dev/null

--------------------------------------------------------------------

find/etc/-namepasswd 2> File

(2) save correct output to/mnt/find.out, error output to/mnt/find.err

[Email protected]]$ find/etc/-name passwd >/mnt/file.out 2>/mnt/file.err

Bash:/mnt/file.out:persion denied # #出错 because of insufficient authority

[Email protected]]$ Su-# #改权限

PASSWD:

[Email protected]]$ chmod 777/mnt/

[Email protected]]$ chmod ugo+rwx/mnt/# #给mnt最大的权限

[[Email protected]]$ logout

[Email protected]]$ find/etc/-name passwd >/mnt/file.out 2>/mnt/file.err # #student有了权限翻身农民把歌唱

(3) Create the/mnt/find.all file and save all output to this file

find/etc/-namepasswd &>/mnt/file.all

(4) Save all output to/mnt/find.all again, and keep the source file contents

find/etc/-namepasswd &>>/mnt/file.all

# #即将所有的内容再次保存到file. All, do not overwrite the original content

(5) block all output from this command

find/etc/-namepasswd &>> Filee

# #将所有的输出都保存在指定的文件里就好, because only one copy of the output, if the user specified the output location, it will not be displayed on the output interface

(6) Show all output of this command and save output to any file on the desktop

find/etc/-NAMEPASSWD # #未对输出界面的输出作干涉

(7) save correct output to/mnt/find.out.1, mask error output

find/etc/-namepasswd >/mnt/file.out.1 2>/dev/null

    1. Processing files in file/usr/share/mime/packages/freedesktop.org.xml requirements are as follows:

* Locate the line containing ICH in this file and save these lines to/root/lines

* Replace the space in/root/lines with vim, but keep the contents of the file


Linux Exercises and Answers

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.