Marco Linux cloud computing throughout the second week of class work (20190701-20190707)

1, file management class command on Linux what are its common usage and its associated example demonstrates.
File Management command on Linux there: cp, mv, rm, ls , mkdir, rmdir, cd, pwd, cat, tac, head, tail, more, less
usage and presentation as follows:
cp RM mv, cp is used to copy files or catalog data, rm to delete data, mv to rename or move data
ls: lists the contents of the specified directory
mkdir: create directory
rmdir: remove directory
cd: Change directory
pwd: displays the current directory
cat: forward view text content
tac: flashback to see what text
head: display text, the default display the first 10 lines
tail: display text, the default display 10 lines
more: split-screen display text, each displaying a screen display complete stop
less: split-screen display text content, do not take the initiative to withdraw
[root @ bccobbler etc] # cp /etc/{issue,xinetd.conf} / tmp / the Test /
cp: Overwrite '/ tmp / the Test / Issue'?
cp: Overwrite '/ tmp / the Test / xinetd.conf '?
Issue issue.net
[root @ bccobbler etc] Issue # mv / tmp /
[root @ bccobbler etc] # LS -al / tmp
-rw-r--r--. 1 root root 23 Jan 7 2016 issue
[root@bccobbler tmp]# rm -r test
rm: descend into directory ‘test’? y
rm: remove regular file ‘test/issue’? y
rm: remove regular file ‘test/xinetd.conf’? y
rm: remove directory ‘test’? y
[root@bccobbler tmp]# cp /etc/issue.net /tmp/test/
[root@bccobbler tmp]# rm -rf test/

2, using the command line expanding function, create / tmp / a1, / tmp / a2, / tmp / a1 / a, / tmp / a1 / b, create a directory in / tmp: x_y, x_z, q_y, Q Z
[ @ localhost tmp the root] # mkdir -pv / tmp / {A1 / {A, B}, A2}
mkdir: Created Directory '/ tmp / A1'
mkdir: Created Directory '/ tmp / A1 / A'
mkdir: Created Directory ' / tmp / A1 / B '
mkdir: Created Directory' / tmp / A2
[the root @ localhost tmp] # mkdir -pv {X, Q}
{Y, Z}
mkdir: Created Directory 'x_y'
mkdir: Created Directory 'x_z'
mkdir: the Created Directory 'q_y'
mkdir: the Created Directory 'q_z'
3, metadata information file which, respectively, what is the meaning, what to see? How to modify the file timestamp information.

[@ bccobbler the root tmp] # STAT-eno16777736 the ifcfg
File: 'the ifcfg-eno16777736'
Size: 307 Blocks: the IO Block. 8: 4096 Regular File
Device: fd00h / 64768d Inode: 102 590 871 Links:. 1
Access: (0644 / R & lt -rw- --r--) Uid: (0 / the root) Gid: (0 / the root)
Access: 2018-12-06 22 is: 47: 31.061144161 -0500
the Modify: 2018-12-06 22 is: 47: 31.061144161 -0500
Change: 22 is 2018-12-06: 47: 31.061144161 -0500
Birth: -
Check with stat file metadata information, as see if the card ifcfg-eno16777736 metadata information including the file name, size, block included, the IO block, file permissions, access last access time, modify recent change time, change recently changed time (metadata) and so on. Use the touch command to modify file time stamps. For example, modify the ifcfg-eno16777736 changes in the last time:
[root @ bccobbler tmp] # Touch -m -t 201,907,051,459.30 ifcfg-eno16777736
[root @ bccobbler tmp] # STAT ifcfg-eno16777736
File: 'ifcfg-eno16777736'
Size: 307 Blocks: 8 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 102590871 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2018-12-06 22:47:31.061144161 -0500
Modify: 2019-07-05 14:59:30.000000000 -0400
Change: 2018-12-06 23:03:35.648196240 -0500
Birth: -

4, in order to create the beginning of tfile, followed by the current date and time of the file, the file name of the form in the / tmp directory: tfile-2016-05-27-09-32-22.

[root@bccobbler tmp]# mkdir /tmp/tfile-$(date +%Y-%m-%d-%H-%M-%S)
[root@bccobbler tmp]# ls -al
drwxr-xr-x 2 root root 6 Dec 6 21:57 tfile-2018-12-06-21-57-29

5, the next copy / etc directory of all start with p, ending in a non-digital files or directories to / tmp / mytest1 directory.
[root @ bccobbler tmp] # mkdir / tmp / MyTest1 /
[root @ bccobbler tmp] # cp -a / etc / the p-* [^ 0-9] / tmp / MyTest1 /
[root @ bccobbler MyTest1] # LS
pam.d Plymouth popt.d ppp printcap profile.d passwd Python
passwd pki PM postfix prelink.conf.d Profile Protocols
6, create user tom, specify the UID is 5001, specify the home directory is / tmp / tom, specify the shell as / bin / zsh , designated basic group tom, an additional group Jack
[@ bccobbler the root MyTest1] # the useradd -md / tmp / Tom -u 5001 -s / bin / zsh -G Jack Tom
[@ bccobbler the root MyTest1] ID # Tom
UID = 5001 (tom) gid = 5001 (tom) Groups = 5001 (tom), 1000 (Jack)
[root @ bccobbler MyTest1] # less / etc / passwd | grep tom
tom: the X-: 5001: 5001 :: / tmp / tom: / bin / zsh
7, user and group management commands What? And demonstrate command and usage.
useradd: Create a user
the useradd [Option] User_Name
-u: - UID UID: Custom UID, a default user on a UID plus. 1
-g: - Group GID: Custom basic group, this group must already exist, or an error occurs; Note : group should refer to the name of the group, not the GID? ?
-G: - groups Group1 [, Group2 ... [, GroupN]]: additional set indicating that the user belongs, among a plurality of groups separated by commas
-c: - comment Comment: annotation information indicating
-d: - home home_dir: Customizing the user's home directory
userdel: delete user
userdel [options] User_Name
-r: when you delete a user, also deletes their home directory, default does not delete
groupadd: create a group
groupadd [options] group_name
-g GID: custom GID the default is a group GID plus 1
-r: create a system group
groupdel: delete group
groupdel [options] group_name [root @ bccobbler MyTest1] # groupadd the Test
[root @ bccobbler MyTest1] # groupmod -n test2 the Test
[root @ bccobbler MyTest1] # groupdel test2
[@ bccobbler the root MyTest1] # the useradd -md / Home / Jia Jia
[root@bccobbler mytest1]# less /etc/passwd |grep jia
jia:x:5002:5004::/home/jia:/bin/bash

Guess you like

Origin blog.51cto.com/3401973/2417538