Chapter II
First, the Linux file system
1. Basic Concepts
The Linux file system is a single tree structure, with the root "/", the file name is case sensitive, except "/" are available characters, the file name with "." Starts as a hidden file.
2. Common folders
Bin: Executable binary file (command).
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: A large software 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 hold information that changes frequently.
/ETC/PASSWD: Saving user information
/etc/shadow: Save user password
/etc/group: Saving Group information
3. File system common Commands PWD: Show current working directory -p displays the current path on behalf of the current directory instead of using the link path CD: Switch directory . Represents the current directory .. Top level directory -Previous working directory ~ Current User home directory ~ Username user name's home directory LS: List Directory contents -A show all files, including hidden files -L Show Details -R lists includeDirectory of its subdirectories -D View Directory Properties -ld Show directory details ll:=ls-l Touch: Create a new blank file, if the file already exists, refresh the date modified file: View file type Cat: View text file contents CP: Copy a file or directory MV: Move or rename a file or directory RM: Delete file or directory mkdir: Create a directory -m Create directory is the specified permission, and is set directly, regardless of default permissions (Umask) -p Create the desired directory recursively rmdir: Delete an empty directory -p to delete the upper empty directory as well
Second, other commonly used commands
1. Date, calendar, etc.
Date: Day
Date +%y--%m--%d
Date +%h:%m:%s
Cal: Calendar
Uptime: Get host run time and query Linux system load and other information
2. Output, view, etc.
Echo: Displays the content entered at the command line
Cat: Display file contents
Head:-n Display head n rows
Tail:-n display tail n rows,-F continuous Display file update content
MORE: Page turn display file content, can only page down
Less: page turn display file content, can page up and down
3. View hardware and other related information
LSPCI: Viewing PCI devices
LSUSB: Viewing USB devices
Lsmod: Viewing the loaded module
4. Shutdown, restart, etc.
Shutdown: Turn off the computer for reboot
Poweroff: Turn off the computer now
Reboot: Restart your computer now
5. Archive, Compress
Zip: Compressed file
Unzip: Extracting files
Gzip: Compress files
Tar: Archive file
6. View and get help
Help command: For internal commands
Command--help: Applies to external commands is a tool option that can be used to display information about some tools. These help information is the author of the program Plus go.
Man command: Displays the contents of the System manual page
Info command: is a menu-based hypertext system that was developed by the GNU Project and released by Linux.
Third, Linux user management
1. Concepts of users and groups
The files and processes in 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. Classification of users
Super Admin root User (UID 0)
System User (UID 1-499)
Normal User (UID 500 or above)
3. User-related files and commands
Who: Show all users currently logged in
W: Show multiple logged-in users and in-progress operations
Useradd: Create User
Usermod: Modify user-related information
Userdel: Deleting users
Iv. Linux Rights Management
1. Basic concepts of authority
Permissions are a mechanism 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 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.
2.UGO Models
u user G Group O other users and groups
Permissions |
File |
Directory |
R |
Can read file contents |
Catalog contents can be listed |
W |
Can modify the contents of the file |
You can create, delete files in a directory, rename an existing file or directory, and transfer the location of files or directories within that directory |
X |
Can be executed as a command |
Access to directory content (indicating whether the directory can be entered) |
Drwxr-xr-x
File type User rights group permissions other permissions
The first property represents the type of the file: D represents the Directory
-Representative documents
L is indicated as a link file
B is indicated as an interface device available for storage in the device file
C is indicated as a serial port device in the device file, such as a keyboard, mouse
CHOMD: Change Permissions command EG:CHOMD 774 tll
3. The concept of default permissions and special permissions
Umask: Used to specify the default permissions for new files and directories
Default permission =666-umask value for new file
Default permission =777-umask value for new directory
Linux Review II