Basic Linux Operations

Source: Internet
Author: User

[[Email protected] Desktop]# hostnamectl set-hostname Server change name

I. Copy, delete, move

– Create a subdirectory under directory/opt NTD

[Email protected]/]# cd/opt/

[Email protected] opt]# mkdir NTD1

[[email protected] opt]# ls

– Create file Readme.txt in directory/opt/ntd/, write content with vim I love Linux



– Copy the/etc/passwd and/etc/resolv.conf to the/OPT/NTD directory at the same time


– Copy file/etc/redhat-release to/root/and rename to Version.txt

– Move the file/root/version.txt to the/opt/ntd/directory

1.CP command

Format: CP [Options] ...  Original file ... Target path

Common Command Options

-R: Recursive, must have this option when copying directories

-P: Keep the original file permissions, modification time and other properties unchanged

3.MV Move or rename

Format: MV [options] ...  Original file ... Target path

2.RM Delete

Format: RM [Options] ... File or directory ...

Common Command Options

-R,-f: Recursive delete (with directory), forced delete

Two. User. Group

Create a user account named stu02

New group Account Stugrp

change user stu02 user name to stu03

Create user

# ID Account name Verify that the system exists for this account

# useradd account name Create account

Set Password

#passwd account Setup Password

Modify account information

#usermod

-L new Account old account Change login name

Delete Account

Delete an account #userdel account

-R along with home directory delete

Create a group

#groupadd Group Name

-G GID specifies GID when creating group

Add a Delete member (user) to a group

#gpasswd

-A: Add specified user as group member

-D: Delete the specified member user from within the group

C. Deleting a group

#groupdel Group Name

Three. Backup and recovery

– Backup/boot,/home folders, saved as boothome.tar.gz files

– Release boothome.tar.gz to Folder/root/boothome/

Make a. Tar package and compress

Basic usage

Format: TAR-ZCF backup file. tar.gz Document Path ...

Format: TAR-JCPF backup file. tar.bz2 Document Path ...

Format: TAR-JCF backup file. Tar.xz Document Path ...

Unzip. Tar Package

Basic usage

Format: TAR-XPF backup file. tar.gz

Format: tar-xf backup file. tar.bz2

Format: tar-xf backup file. tar.xz [-C destination Folder]

Four. What are the LS common options? The respective roles?

. ls command

Format: ls [options] ... [Directory or file path]

Common Command Options

-A: Includes the name with the. Hidden document at the beginning

-L: Display in long format

-H: Must be combined with-l to provide easy-to-read capacity units (K, M, etc.)

-D: Display the properties of a directory


Basic Linux Operations

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.