linux01--file Management, common command Rights Management

Source: Internet
Author: User

A. Ø File System1. Linux file system features Linux file system is a single tree structure • File system root is "/" • Filenames are case sensitive, except that "/" are available character filenames with "." Start with hidden files • File paths are separated by "/" instead of "\", 2. File Bin: Executable binaries (commands) under the root directory. Boot: Boot directory, boot the required files. Dev: Hardware device. etc: Configuration file. Home: Home directory, each ordinary user under the home has a user name and the same folder, except the root user. Lib:linux run the library file. lost+found: File system files. Media and MNT: Mount the device directory. opt: Large software that is typically used to install users. proc: Real-time information of the system, saving the information in memory. sbin: Executable binaries, sbin commands that only super users can run. SYS: System bottom-level information. tmp: Temp directory, content is automatically emptied. usr: User-installed application software. var: used to store information that changes frequently.two. Ø System common Commands•pwdcommand to display the current working directory ·CDUsed to switch the directory ".": Current Directory "...": Top level Directory "~": Home Directory "-": Previous working directory • List contents:ls-A: View all files (with hidden files)-L: Show Details-R: List all subdirectory structures-ld: Displaying directory and link information ·Touchcommand to create a new blank file, or refresh the modified date if the file already exists. • View File types:file• View text file contents:Cat•CP: Copy file or directory common Parameters-R: Recursively replicate entire tree-V: Shows details of the replication process ·MV: Move or rename a file or directory ·RM: Delete file or directory common Parameters-I: Interactive-r: Recursively delete directory and include Content-F: Force Delete ·mkdir: Create a directoryrmdir: Delete an empty directory ·Date: View or set the current system time +%: Used to set a specific format ·Cal: Show Calendar ·Uptime: View system Run time • Output, view commands •Echo: Displays the content entered at the command line ·Cat: Show file Contents ·Head:-nShow head n rows ·Tail:-nShow tail n rows,-F continuous Display file update contents · More: page display of file contents, can only page down · Less: page display file content, page up and down • View hardware information • View hardware information requires Administrator privileges ·Lspci: View PCI Device-V: View more information ·Lsusb: View USB Device-V: View more information ·Lsmod: View loaded Modules • Shutdown, restart •shutdown: Shut down or restart the computer-H: Turn off computer-r: Restart the computer ·Poweroff: Turn off the computer immediately ·reboot: Restart the computer now • Archive, compress •Zip: Compressed file • Syntax: Zip compressed after file name compressed file name ·Unzip: Extract Files • Syntax: Unzip compressed file name ·gzip: Compressed file ·Tar: Archive file tar–cvf archive file name archived files TAR–XVF archive file name tar–cvzf archived file name Archive • Get help •- HOr-helpParametersMansCommandInfoCommand Doc Document:/usr/share/docthree. Ø User Management1. Basic concepts of users and groups the files and processes in the Linux are bound together with the user. • The user's identity determines the resources (files, processes) that can be used and manipulated. • Each user name has a corresponding UID each user is subordinate to one or more groups. 2. The user is divided into three types: • Super Administrator root user (UID 0) • System User (uid 1-499) • Normal User (UID 500 or above) 3. Related Commands ·ID: View current user's information ·passwd: Modify the current user password ·WhoAmI: Show Current User ·W.H.O.: Displays all users who are currently logged on ·W: Displays all logged-in users and ongoing actions • Save user-related information in the following files ·/etc/passwd: Save user Information ·/etc/shadow: Save user Password ·/etc/group: Save Group Information ·Useraddcommands for creating users • Basic syntax: Useradd user name • Common parameters:-d: Specify home directory-s: Specify after login shell-u: Specify UID-g: Specify Group ·UsermodCommands for modifying user-related information • Basic syntax: usermod parameter User name • Common parameters-l: Modify user name-u: Modify UID-d: Modify home directory-g: Modify the owning group-l: Lock the user-u: Unlock the user ·UserdelFor deleting users • Basic syntax: Userdel user name • Common parameters:-r: Delete User's home directory while deleting usersØ Rights Management• Permissions are mechanisms that the operating system uses to restrict access to operating system resources (files, devices, and so on) for users, groups, and processes. • Permissions are divided into: Read, write, execute, Linux represented as R, W, X. Each file and directory in Linux has a owning user and owning group, and the corresponding permissions are set. • Each process runs as a user and inherits the permissions of that user. Linux using the UGO model for Rights Management • U on behalf of user, G for group, O for other users and groups • Each file is represented by 9 permissions, 3 groups representing the read, write, and execute permissions of the Ugo, respectively. • For example: rwxrw-rw-You can view the permissions of a file by using the ls-l command ls-l command to view the permissions of a file • The first property represents the type of the file [d] represents the directory [-] then the file [L] is indicated as a link file [C] is the serial port device in the device file, such as the keyboard, mouse, and Change permissions command:chmod

RWX can be represented by numbers, respectively.

R--4

W--2

X--1

The combination of rwx can be represented by the and representation of these numbers (bitwise OR)

rwx = 4+2+1 = 7

R-x = 4+0+1 = 5

---= 0+0+0 = 0

Rwxr-x---can be expressed in 750来.

Grammar:

chmod [-r] XYZ file

Where XYZ is three sets of rwx attribute values and

• Default Permissions • New files and directories have a default permission, specified by the Umask property of the current terminal, the default permission = Total permission value-umask value. root User's umask value is generally 022, the average user is generally 002 • For normal users: • File default permission value =666-002=664 directory default permission value =777-002=775 use command umask to set and view umask values. In addition to normal permissions, Linux also provides three special permissions suid: For files, it means to execute as the user of the file, not the current user, and no impact on the directory. Sgid: In the case of a file, it is performed as a group of files belonging to, or to a directory, any new files created in that directory that belong to groups and directories that belong to the same group. Sticky: For a directory, users who have write access to the directory can only delete files owned by themselves and cannot delete other users ' files.

linux01--file Management, common command Rights Management

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.