Linux Daily notes 3

Source: Internet
Author: User
Tags bz2

I. Administrative authority and attribution

1. Overview of permissions

Document attribution

Owner (U): The user who owns this file/directory-user

Owning Group (g): The group that owns this file/directory-group

Other users (O): Users other than the owner, the owning group-other

Access rights

Read (R): Allow viewing of content-read

Write (W): Allow content to be modified-write

Executable (x): Allow to run and switch-excute

2. View Permissions Ls-l

# ls-l/ETC/PASSWD

-|rw-|r--|r--. 1 root root 2481 February 09:37/etc/passwd

①②③④⑤⑥⑦⑧⑨⑩

Permission reading order: ⑩①⑥②⑦③④

① File types

- Documents

Catalog D

L Link

② Owner's permissions

R = 4 Read

w = 2 Write

x = 1 executable

- No

③ permissions of the owning group

R = 4 Read

w = 2 Write

x = 1 executable

- No

④ Permissions for other users

R = 4 Read

w = 2 Write

x = 1 executable

- No

⑤ Number of links

Files: Number of links

Directory: How many subdirectories are in this directory (. .. )

⑥ owner

⑦ belongs to Group

⑧ File Size

⑨ File creation time

⑩ File/directory Name

3. Change file Attribution

# chown Master: File/directory Change the owner of a file/directory

# chown: Group file/directory Change the owning group of file/directory

# chown: Genus group File/directory Change the owner and owning group of files/directories

- R recursion

eg

[Email protected] ~]# rm-rf/tmp/*

[Email protected] ~]# Ls-ld/tmp/studir

[Email protected] ~]# Mkdir/tmp/studir

[Email protected] ~]# Ls-ld/tmp/studir

[Email protected] ~]# chown student/tmp/studir/

[[email protected] ~]# ID Student

[Email protected] ~]# Useradd student

[[email protected] ~]# ID Student

[Email protected]td1711 ~]# chown student/tmp/studir/

[Email protected] ~]# Ls-ld/tmp/studir

[Email protected] ~]# chown:users/tmp/studir/

[Email protected] ~]# Ls-ld/tmp/studir

[Email protected] ~]# chown root:root/tmp/studir/

[Email protected] ~]# Ls-ld/tmp/studir


4. Change file/directory permissions

chmod command

Format: chmod [ugoa][+-=][rwx] Document Path ...

-R: Recursive modification (with documents in all subdirectories and subdirectories)

[Email protected] ~]# Ls-ld/tmp/studir

[Email protected] ~]# chmod g-rx,o-rx/tmp/studir/

[Email protected] ~]# Ls-ld/tmp/studir

[Email protected] ~]# chmod u-w,g=rx/tmp/studir/

[Email protected] ~]# Ls-ld/tmp/studir

[Email protected] ~]# chmod a=rwx/tmp/studir/

[Email protected] ~]# Ls-ld/tmp/studir


Second, backup and recovery

1. Make/Release Zip package

A. Compress zip

Format: Zip [-ry] backup file. zip document Path ...


eg

[Email protected] ~]# ls-ld/boot/

[Email protected] ~]# ls/opt/

[Email protected] ~]# zip-ry/opt/boot_bak.zip/boot/

[Email protected] ~]# ls/opt

B. Unzip

Format: Unzip backup file. zip [-D destination Folder]

Format: Unzip backup file. zip


eg

[Email protected] ~]# Ls/tmp/todir

[Email protected] ~]# unzip-d/tmp/todir/opt/boot_bak.zip

[Email protected] ~]# Ls/tmp/todir

2. Make/release. Tar Package

A. Make a. Tar package and compress

Basic usage

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

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

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


eg

[Email protected] ~]# ls-ld/var/log/

[Email protected] ~]# du-sh/var/log/

[Email protected] ~]# mkdir-p/tmp/day03

[Email protected] ~]# tar-zcpf/tmp/day03/log.tar.gz/var/log/

[Email protected] ~]# tar-jcpf/tmp/day03/log.tar.bz2/var/log/

[Email protected] ~]# tar-jcpf/tmp/day03/log.tar.xz/var/log/

[Email protected] ~]# du-sh/tmp/day03/*


B. Unzip the. 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]


eg

[Email protected] ~]# cd/tmp/day03/

[[email protected] day03]# ls

[Email protected] day03]# TAR-XF log.tar.gz

[[email protected] day03]# ls

[Email protected] day03]# RM-RF var

[[email protected] day03]# ls

[Email protected] day03]# TAR-XF log.tar.bz2

[[email protected] day03]# ls

[Email protected] day03]# RM-RF var

[[email protected] day03]# ls

[Email protected] day03]# TAR-XF LOG.TAR.XZ

[[email protected] day03]# ls

[Email protected] day03]# RM-RF var

[[email protected] day03]# ls


Third, access to the CD and ISO image

1. Mounting

Mount device mount point (must be a directory)


2. Uninstall

Umount Equipment

Umount mount point


Optical drive device under 3.Linux

/dev/sr0

/dev/cdrom


Experiment: Accessing a disc file

1. Insert the disc

Put the ISO file into the optical drive

2. Mounting

[Email protected] ~]# Ls/mnt/dvd

[Email protected] ~]# mkdir-p/mnt/dvd

[Email protected] ~]# ls/mnt/dvd/

[Email protected] ~]# mount/dev/cdrom/mnt/dvd/

3. Accessing CD Contents

[Email protected] ~]# ls/mnt/dvd/

4. Uninstall

[Email protected] ~]# Umount/mnt/dvd

[Email protected] ~]# ls/mnt/dvd/


Linux Daily notes 3

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.