Get the App
SLTechnology News&Howtos  ›  Servers  › 

File user group management

Shulou Source: shulou.com Published: 2022-06-03 06:23:47 10月12日 Update

1. Display / etc directory, starting with a non-letter, followed by a letter and other files and directories of any length and any character

Ls / etc/ [^ [: alpha:]] [[: alpha:]]

2. Copy all files or directories that begin with p and end with non-numbers in the / etc directory to the / tmp/mytest1 directory.

Cp-r / etc/p [^ 0-9] / tmp/mytest1

3. Convert the contents of the / etc/issue file to uppercase and save to the / tmp/issue.out file

Cat / etc/issue | tr "[[: lower:]]"[[: upper:]]" > / tmp/issue.out

4. Create a group distro with a GID of 2019

Groupadd-g2019 distro

5. The mandriva,UID of the created user is 1005, and the basic group is distro

Useradd-u1100-g2019 mandriva

6. Create a user mageia with a UID of 1100 and a home directory of / home/linux

Useradd-d/home/linux-u1100 mageia

7. Add a password to the user mageia, whose password is mageedu, and set the password to expire 7 days later

Passwd mageia mageedu

Passwd-M7 mageia

8. Delete mandriva, but keep its home directory

Userdel mandriva

9. The slackware,UID of the created user is 2002, the basic group is distro, and the additional group peguin

Groupadd peguin

Useradd-u2002-gdistro-Gpeguin slackware

10. Change the shell of user slackware to / bin/tcsh

Usermod-s / bin/tcsh slackware

11. Add an additional group admins to the user slackware

Groupadd admins

Usermod-aG admins slackware

Tags: Directory user file password letter beginning attachment content uppercase diva character number length home user group management Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Shulou Information Redmi Shulou Tech Info vpn