Home > OS >  The ADMIN on the third day
The ADMIN on the third day

Time:09-21

Case 1: command line basic skills
Case 2: mount the CD and access equipment
Case 3: ls list and document creation
Case 4: copy, delete, move
Case 1:1 command line basic skills
1.1 problems
This example requires master the basic operation of the Linux command line environment, complete the following tasks:
Use the Tab KEY to quickly find out the following file:/etc/sysconfig/network - scripts/ifcfg - *,/etc/pki/RPM - GPG/RPM - GPG - KEY - redhat - release
Practice the following quick edit operation: Ctrl + l, Ctrl + u, Ctrl + w; Ctrl + c, Esc +.
Step 1.2
This case shall be carried out according to the following steps,
Step one: by using the Tab key to rapid completion document path
1) appeared to find some Internet connection configuration file
/root @ server0 ~ # ls/etc/sysco
/root @ server0 ~ # ls/etc/sysconfig/netw
/root @ server0 ~ # ls/etc/sysconfig/network - s
/root @ server0 ~ # ls/etc/sysconfig/network - scripts/ifc
/root @ server0 ~ # ls/etc/sysconfig/network - scripts/ifcfg - & lt; TAB>
Ifcfg - br0 ifcfg - br1 ifcfg - lo
253 ifcfg - eno16777736 ifcfg - br0:
2) find RHEL7 validation package key file
/root @ server0 ~ # ls/etc/pki/rp
/root @ server0 ~ # ls/etc/pki/RPM - GPG/RP
/root @ server0 ~ # ls/etc/pki/RPM - GPG/RPM - GPG KEY - redhat - r
/root @ server0 ~ # ls/etc/pki/RPM - GPG/RPM - GPG - KEY - redhat - release
The/etc/pki/RPM - GPG/RPM - GPG - KEY - redhat - release
Step 2: to practice the following quick edit operation
1) clean the edit command line
Fast CLS: Ctrl + l
Delete from the current cursor to the beginning of a line: Ctrl + u
Forward to delete from the current cursor one word: Ctrl + w
2) give up the command line edit
To suspend the current command line: Ctrl + c
3) parameter multiplexing
At the current cursor paste on a command line last parameter: Esc +.
Case 2: mount and gain access to the cd-rom device
2.1 problems
Learn to mount mount operation in this case, it is mainly to complete the following tasks:
CD/ISO/rhel - server - 7.4 - x86_64 - DVD. ISO
The cd-rom mount to the/MNT directory, check/MNT directory content
Uninstall cd-rom device, once again check the directory content
Step 2.2
This case shall be carried out according to the following steps,
Step 1: use the ls command lists the specified file
1) CD/ISO/rhel - server - 7.4 - x86_64 - DVD. ISO
/root @ server0 ~ # mount/dev/cdrom/MNT//mounted equipment
Mount:/dev/sr0 write protected, will be mounted in a read-only way
2) to mount the CD to/MNT directory, check the/MNT directory content
/root @ server0 ~ # ls/MNT//access equipment content
RPM Packages - GPG addons images - KEY - redhat - release
EFI isolinux release - notes TRANS. TBL
EULA LiveOS repodata
The GPL media. 'the RPM - GPG KEY - - redhat - beta
3) uninstall cd-rom device, once again check the directory content
/root @ server0 ~ # umount/MNT/DVD//unloading equipment
Mount:/dev/sr0 write protected, will be mounted in a read-only way
/root @ server0 ~ # ls/MNT/DVD//verify the results
/root @ server0 ~ #
Case 3:3 ls list and document creation
3.1 problems
This example to learn to list view directory content, new document related skills, and familiar with application of wildcard mechanisms, mainly do the following:
Use the ls command lists the specified file:/etc/directory begin with re. Conf at the end of the file,/dev/directory number is a digit console tty device
A command to create the folder/protected/project/tts10
Using vim create a file/etc/hostname, writing a line of content: svr7. Tedu. Cn
3.2 plan
To use wildcards, need to understand the role of each wildcard:
* : any number of any characters
? : a single character
[a-z] : one of multiple characters or continuous range, without ignoring it
{a, min, x, y} : many different sets of strings, perfect matching
Vim is the most commonly used on Linux command line interactive text editor, the main work in three modes: command mode, the input mode, at the end of the line mode,
By vim to open a file, the default in command mode; In command mode, press enter a state of editing, I press the Esc key to return to command mode; From the command pattern input colon: can enter the line mode at the end of the line at the end of the main implement inventory mode, exit the basic operations, such as
Step 3.3
This case shall be carried out according to the following steps,
Step 1: use the ls command lists the specified file
1) list the/etc/directory begin with re. Conf at the end of the file
Use a wildcard * instead of the unknown string,
/root @ server0 ~ # ls/etc/re *. Conf
The/etc/request - key. Conf/etc/resolv. Conf
2) list/dev/directory number is a digit console tty device
Use wildcards? Instead of a single unknown character,
/root @ server0 ~ # ls/dev/tty?
/dev/tty0/dev/tty2/dev/tty4/dev/tty6/dev/tty8
/dev/devices tty1/dev/tty3/dev/tty5/dev/tty7/dev/tty9
Or more rigorous, using [0-9] instead of a single number,
/root @ server0 ~ # ls/dev/tty [0-9]
/dev/tty0/dev/tty2/dev/tty4/dev/tty6/dev/tty8
/dev/devices tty1/dev/tty3/dev/tty5/dev/tty7/dev/tty9
Step 2: new document
1) use the mkdir new folder
/root @ server0 ~ # mkdir -p/protected/project/tts10
/root @ server0 ~ # ls - ld/protected/project/tts10/
DRWXR - xr - x. 2 root root 6 Aug 30 10:11/protected/project/tts10/
2) using vim create or modify text file
/root @ server0 ~ # vim/etc/hostname
//press I key to enter edit mode
//amend the text content to svr7 tedu. Cn
//click the Esc key to return to command mode
//input: wq save the changes and exit the vim editor
/root @ server0 ~ # cat/etc/hostname
Svr7. Tedu. Cn
4 case 4: copy, delete, move
4.1 problems
This example to learn to copy of the document, delete, mobile/renamed related operations, in order to complete the following tasks:
In the current directory to create a subdirectory dir1-name
The folder/boot/grub2/copy to the directory under the dir1-name
The directory under the/root/with the CFG at the end of the file to the dir1-name under
The file/etc/redhat - release copy to/root/, and renamed version. TXT
The file/root/version. TXT to move to the dir1-name directory
Delete the dir1-name directory grub2 subdirectories
Step 4.2
This case shall be carried out according to the following steps,
1) in the current directory to create a subdirectory dir1-name
/root @ server0 ~ # mkdir dir1-name
2) the folder/boot/grub2/copy to the directory under the dir1-name
/root @ server0 ~ # cp -r/boot/grub2/dir1-name/
/root @ server0 ~ # ls - ld dir1-name/*//copy the results
DRWXR - xr - x. 6 root root 104 Aug 30 dir1-name length/grub2
3) under the directory/root/with the CFG at the end of the file to the dir1-name under
/root @ server0 ~ # cp/root/*. CFG dir1-name/
/root @ server0 ~ # ls - ld dir1-name/*//copy the results
Rw -- -- -- -- -- -- --. 1 root root 16793 Aug 30 10:29 dir1-name/anaconda - ks. CFG
DRWXR - xr - x. 6 root root 104 Aug 30 dir1-name length/grub2
4) the file/etc/redhat - release copy to/root/, and renamed version. TXT
/root @ server0 ~ # cp/etc/redhat - release/root/version. TXT
/root @ server0 ~ # ls - ld/root/version. TXT//copy the results
Rw - r - r -. 1 root root 52 Aug 30 at 10:30/root/version. TXT
5) the file/root/version. TXT to move to the dir1-name directory
/root @ server0 ~ # cp/root/version. TXT dir1-name/
/root @ server0 ~ # ls - ld dir1-name/*//mobile/renamed the results
Rw -- -- -- -- -- -- --. 1 root root 16793 Aug 30 10:29 dir1-name/anaconda - ks. CFG
DRWXR - xr - x. 6 root root 104 Aug 30 dir1-name length/grub2
nullnullnullnullnullnull
  • Related