Linux Beginner Exercises

Source: Internet
Author: User

1. Create a file with a command and regular expression *) Create 12 files with one command Westos_classx_linuxy (the value range of x is 1-2,y 1-6) *) These files are included in the study directory of the root user's desktop [email  protected] home]# cd /root[[email protected] ~]# lsanaconda-ks.cfg   Documents  Music     Public      videosdesktop          downloads  pictures   templates[[email protected] ~]# cd desktop/[[email protected] desktop]#  cd study/bash: cd: study/: no such file or directory[[email  protected] Desktop]# mkdir study[[email protected] Desktop]# ls9.200    9.21   hehe~      study             westos9.200~  9.21~  hello.exe   untitled folder  westos~[[email protected] desktop]# cd study/[[email protected] study]# touch  westos_classx{1..2}_linuxy{1..6}[[email protected] study]# lswestos_classx1_linuxy1   Westos_classx1_linuxy5  westos_classx2_linuxy3westos_classx1_linuxy2  westos_classx1_ linuxy6  westos_classx2_linuxy4westos_classx1_linuxy3  westos_classx2_linuxy1   Westos_classx2_linuxy5westos_classx1_linuxy4  westos_classx2_linuxy2  westos_classx2_ linuxy6*) Create 8 files with one command Redhat_versionx (the range of x 1-8) *) Redhat_virsionx These files are contained in version in the/MNT directory [[email protected]  Desktop]# touch redhat_versionX{1..8}[[email protected] Desktop]# ls9.200    hehe~             redhat_ versionx3  redhat_versionx7  westos9.200~  hello.exe          redhat_versionx4  redhat_versionx8  westos~9.21    redhat_versionx1   redhat_versionx5  study9.21~   redhat_versionx2  redhat_versionx6   untitled folder[[email protected] desktop]# mv redhat_version* /mnt/ versionmv: target  '/mnt/version '  is not a directory[[email protected]  desktop]# cd /home[[email protected] home]# lsstudent[[email protected] ~]#  cd /mnt[[email protected] mnt]# mkdir version[[email protected] mnt]#  cd desktopbash: cd: desktop: no such file or directory[[email  protected] mnt]# cd /root/Desktop/[[email protected] Desktop]# mv  Redhat_versionx* /mnt/version/[[email protected] desktop]# cd /mnt/version/[[email  protected] veRsion]# lsredhat_versionx1  redhat_versionx3  redhat_versionx5  redhat_ Versionx7redhat_versionx2  redhat_versionx4  redhat_versionx6  redhat_ versionX82. Managing a newly created file requires the following *) to copy the odd-numbered files from the Redhat_versionx to the desktop single using a command [[email protected] desktop]#  cp /mnt/VERSION/redhat_versionX{1,3,5,7,9} SINGLE[[email protected] Desktop]#  cd single/[[email protected] single]# lsredhat_versionx1  redhat_versionx3   redhat_versionx5  redhat_versionx7*) copy a file with even numbers in Redhat_versionx to/double in a single command     [[EMAIL PROTECTED] SINGLE]# CD&NBSP, .... [[email protected] desktop]# mkdir double[[email protected] desktop]#  ls9.200   9.21   double  hello.exe  study             westos9.200~  9.21~  hehe~   single     untitled folder  westos~[[ Email protected] desktop]# cp /mnt/version/redhat_versionx{2,4,6,8} double/[[email  protected] desktop]# cd double/[[email protected] double]# lsredhat_ versionx2  redhat_versionx4  redhat_versionx6  redhat_versionx8[[email  protected] double]# *) use a command to move Class1 files in Westos_classx_linuxy to the CLASS1 of the current user's desktop      In this section, note that you want to move the file to study (that is, the Westos_class1_linuxy location) as the current position. [[Email protected] study]# mv westos_classx1_linuxy{1..6} /root/desktop/class1[[email  protected] study]# lsWESTOS_classX2_linuxY1  WESTOS_classX2_linuxY3   Westos_classx2_linuxy5westos_classx2_linuxy2  westos_classx2_linuxy4  westos_classx2_ linuxy6*) Move the Class2 file in Westos_classx_linuxy to the CLASS2 of the current user's desktop using a command [[Email protected] study]# mv westos_classx2_linuxy{1..6} /root/desktop/class2[[email protected] study]#  CD&NBSP, .... [[Email protected] desktop]# cd class2[[email protected] class2]# lswestos_ Classx2_linuxy1  westos_classx2_linuxy3  westos_classx2_linuxy5westos_classx2_linuxy2   westos_classx2_linuxy4  westos_classx2_linuxy63. Backup/ Etc directory all names with numbers and end with. conf to the Confdir on the desktop      this part for some reason the computer can not run, if there are errors, please advise. [[email protected] study]# cp /etc*[[:d igit:]]*.conf confdir/5. Delete all files that you just created or backed up      rm -f    # #强制删除文件     rm -fr    # #强制删除目录 [[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 


This article is from the "Vidya blog", please make sure to keep this source http://vidyaliee.blog.51cto.com/12087072/1855199

Linux Beginner Exercises

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.