Linux system Management of operation and maintenance notes (I.)

Source: Internet
Author: User

1, Account management:

Account Additions:

Add a user name, set a password (USERADD,PASSWD), add a group (groupadd), join a user to a group (USERMOD-G);

Create a user and specify the home directory (useradd-d)

Add a user to two groups (Usermod-g group1,group2 user) at the same time, and see if a user belongs to a group (groups);

View group, passwd, Shadow, Gshadow use commands: Example: Cat/etc/grouop or Tail-1 (2, 3, 4 ...)/etc/group

or grep newgroup/etc/group

To add users to a group: GPASSWD-A user Group

Remove users from group: gpasswd-d user Group


Deletion of Accounts:

Delete account (Userdel user,userdel-r user), delete (RM-RF user), delete group (Groupdel group), delete (RM-RF group) completely;

Delete Password: passwd-d user


Account permissions:

change user name (usermod-l newuser user or usermod-d/home/newuser newuser,mv/home/user/home/newuser);

Change group name (rename): Groupmod-n newgroup Group

Lock account: Usermod-l user

Unlock: Usermod-u User

Query password status: Passwd-s user

Set User group administrator: GPASSWD-A user name to manage user groups


View Current User Uid:id

View Users: WhoAmI


2, File Management:

New file: Touch file

To view the contents of the file: Cat-n file (outputs the contents of the files from Nth line) or NL file (outputs the contents from the first line and displays the line numbers);

More file (starting from the first line) or less file (better than more); Head-n file (only the first n rows are displayed);

Tail-n file (only the following n rows are displayed)

New Catalog: mkdir directory

Add permissions: chmod 777 file or chmod ugo+rwx file

Delete Files: RM file

Delete files or directories: RM-RF directory

Delete directory: RmDir directory

Find file: Find/-name "file" or Find/-name ' *file* ' (Fuzzy Lookup) or find/-name "file"-ls (find file and display file information)

View current directory: PWD

3, partitioning, formatting:

Partitioning with fdisk (fdisk-l;fdisk/dev/sd*)

Formatted partition: With Mkfs.bfs mkfs.ext2 mkfs.jfs mkfs.msdos Mkfs.vfatmkfs.cramfs

Mkfs.ext3 Mkfs.minix mkfs.reiserfs Mkfs.xfs and other commands to format the partition (mkfs.ext3/dev/sda*)

Loading: mkdir/mnt/sda*

mount/dev/sda*/mnt/sda*

Df-lh

Entry: cd/mnt/sda*

View hard disk Capacity: DF


4, display current version information: Uname-r[-a]

Show current process: PS or ps-a (show All Programs) or Ps-aux (-u Show All user programs)

Kill process: Kill-q (or-ls stop process)

Dynamic monitoring display process: Top

View memory Information: free-m

Shutdown: shutdown-h Now

Timed Restart: shutdown-r +30 (restart after 30 minutes)


This article from "Operations Notes" blog, declined reprint!

Linux system Management of operation and maintenance notes (I.)

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.