3.1 wildcards, user management
1, display/etc directory, with non-letter beginning, followed by a letter and other arbitrary length of any character files or directories
Copy all files or directories starting with p and ending with a non-number in/etc directory to/tmp/mytest1 directory.
3. Convert the contents of the/etc/issue file to uppercase and save them to the/tmp/issue.out file
Please summarize the description of user and group management class commands and complete the following exercises:
(1), create group distro with GID 2019;
(2)Create user mandriva with ID number 1005; basic group is distro;
(3)Create user mageia with ID number 1100 and home directory/home/linux;
(4)Add a password to user mageia, the password is mageedu, and set the user password to expire in 7 days.
(5)Remove mandriva but keep its home directory;
(6)Create user slackware with ID number 2002, basic group distro, additional group peguin;
(7)Change the default shell of slackware to/bin/tcsh;
(8)Add additional groups admins for user slackware;
1
[root@CentOS7 ~]# touch /etc/1.txt
[root@CentOS7 ~]# touch /etc/1a.txt
[root@CentOS7 ~]# ls /etc/[^[:alpha:]][a-z]*
/etc/1a.txt
2
[root@CentOS7 ~]# rm -rf /tmp/mytest1/*
[root@CentOS7 ~]# mkdir -p /tmp/mytest1/
[root@CentOS7 ~]# cp -rf /etc/p*[^0-9] /tmp/mytest1/
[root@CentOS7 ~]# ll /tmp/mytest1/
total 52
drwxr-xr-x. 2 root root 4096 Nov 12 22:24 pam.d
-rw-r--r--. 1 root root 68 Nov 12 22:24 papersize
-rw-r--r--. 1 root root 2519 Nov 12 22:24 passwd
-rw-r--r--. 1 root root 2482 Nov 12 22:24 passwd-
-rw-r--r--. 1 root root 1362 Nov 12 22:24 pbm2ppa.conf
-rw-r--r--. 1 root root 2872 Nov 12 22:24 pinforc
drwxr-xr-x. 12 root root 151 Nov 12 22:24 pki
drwxr-xr-x. 2 root root 28 Nov 12 22:24 plymouth
drwxr-xr-x. 5 root root 52 Nov 12 22:24 pm
-rw-r--r--. 1 root root 6300 Nov 12 22:24 pnm2ppa.conf
drwxr-xr-x. 2 root root 6 Nov 12 22:24 popt.d
drwxr-xr-x. 2 root root 154 Nov 12 22:24 postfix
drwxr-xr-x. 3 root root 219 Nov 12 22:24 ppp
drwxr-xr-x. 2 root root 105 Nov 12 22:24 prelink.conf.d
-rw-r--r--. 1 root root 233 Nov 12 22:24 printcap
-rw-r--r--. 1 root root 1818 Nov 12 22:24 profile
drwxr-xr-x. 2 root root 4096 Nov 12 22:24 profile.d
-rw-r--r--. 1 root root 6545 Nov 12 22:24 protocols
drwxr-xr-x. 2 root root 79 Nov 12 22:24 pulse
drwxr-xr-x. 2 root root 23 Nov 12 22:24 purple
drwxr-xr-x. 2 root root 35 Nov 12 22:24 python
[root@CentOS7 ~]#
3
[root@CentOS7 ~]# tr [:lower:] [:upper:]
< /etc/issue \S KERNEL \R ON AN \M [root@CentOS7 ~]# tr [:lower:] [:upper:] < /etc/issue >/data/3.log
[root@CentOS7 ~]# cat /etc/issue
\S
Kernel \r on an \m
[root@CentOS7 ~]# cat /data/3.log
\S
KERNEL \R ON AN \M