Linux Practice Notes

Source: Internet
Author: User

Mount: Mount command

Mount/dev/sda2/mnt/server

Cd/mnt/server

You cannot uninstall in the/mnt/server directory, or if you have a program that uses a disk in mount.


Du-s look at the size of the folder

Du-h Mark K or M


Usage of DF Resources

Df-h Mark K or M


Su-Completely switched past

Su didn't switch over completely.


Linux User and Group management

Useradd passwd Userdel groupadd gpasswd Groupdel

Useradd--/etc/passwd--/etc/shadow--/etc/group--/etc/gshadow

Create a/home/shrek at the same time

Then CP to/etc/skel/.*/home/shrek

Chown-r Shrek.shrek/home/shrek


/etc/passwd

Shrek:x:500:501::/home/shrek:/sbin/nologin

Shrek User Name

X: The password is stored in the shadow file.

UID500

501 Groups of ID501

:: In the middle of the colon, put a function description or comment for the user

User home Directory/home/shrek

Shell/sbin/nologin used by the user


/etc/shadow

Shrek:[email Protected]@#$%%#%23425$:13822:0:999999:7:::

Shrek User Name

Passwords that have been encrypted

13822 from January 1, 1970 onwards to how many days now. Linux time

0 The shortest history of password changes, and how long you can change them. 0 to never expire.

99999 expiration time, 99,999 days to expire.

7 How many days before your password expires

:: Password disabled for Linux time


/etc/group

shrek:x:501:

If Todd is added to the group, it can be shrek:x:501:todd directly, other users

Linux users only differentiate between a UID of 0 and a UID of not 0.


/etc/gshadow

Rarely used.


Tail-5/etc/passwd only see the last five lines of passwd.

head-5/etc/passwd View passwd header Five elements file.


Useradd-g root,bin,todd Shrek

Assign Shrek to join multiple groups at the same time.

But if you do it again,

Useradd-g mysql,ttt Shrek

Then Shrek joins only MySQL and TTT because it specifies which group the Shrek belongs to, not the cumulative increment group.



Want to have multiple users join a group

Gpasswd-m SHREK,TODD,TTT Root

Add multiple users (SHREK,TODD,TTT) to the root group


Head/etc/group Verify that there are several users behind the root group.


What if I accidentally put/etc/passwd or/etc/shadow delete?

Single User

ls/etc/passwd

cp/etc/because a single user has a backup file


Man familiar with the properties of the file detailed


Kill the SSH man.

Skill-9 PTS/2 Kill the PTS/3 process of the machine.


W who user

W Use the most


MESG y

Write Root PTS/2

Write a message to write to PTS/2.

Crtl+d keyboard input ends.


Wall the news to everyone. All the people on the machine will suffer. People on each console will receive this message.


To view a user's logon log:

Last

Lastlog the last logon time for each user.


Finger look at the information of a particular user.



This article is from the "Big da Qi" blog, please be sure to keep this source http://newgate.blog.51cto.com/9210093/1558598

Linux Practice Notes

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.