Linux ECs: linux operation basics and linux ECs Basics
1. Shell
Shell is the user interface of the system. The shell interpreter converts commands into system function calls and transfers them to the kernel for completion. If it is an external command or utility, then try to find the directory in the hard disk and transfer it to the memory, then interpret it as a system function call and transfer it to the kernel for execution.
2. Linux directory structure
Linux is a directory tree structure. The file system structure starts from a root directory (/). The root directory can contain any file or directory, the sub-directory contains any number of files or directories.
This structure of linux allows a hierarchical relationship between a directory and its files/subdirectories.
2.1 common directory names and descriptions
/: The starting position of the file system structure and becomes the root. Bin: stores basic command programs (which can be called by any user ). Boot: stores the files read when the system starts, including the system core files. Dev: interfaces for storing device files, such as printers and hard drive lights. Etc: stores system configuration files. Home: stores the exclusive user directory ). Lib/lib64: The Shared Library and kernel module required to store the program running in the root file system. Lost + found: stores some system check results and finds that illegal files or data are stored here. Normally, this directory is empty unless the hard disk suffers unknown damage. Mnt: mount point directory of the temporary file system. Media: the mount point of the plug-and-play storage device is automatically created under this directory, such as CD/DVD. Opt: third-party software storage directory. Proc: A Virtual File System that stores the current memory. Root: Super User directory. Sbin: similar to bin, it stores system boot and management commands, but only the root user can access it. Srv: the directory where the system provides external services, such as Web virtual hosts. Tmp: the user places various temporary files usr: used to store system applications. Var: stores frequently changed files, such as log files, temporary files, and emails.
3. Common Linux operating commands
1. Common directory operation commands
Ls: displays the file and directory list
Cd: Switch Directories
Pwd: displays the current directory
Mkdir: common directory
Rmdir: delete an empty directory.
Tree: displays the directory tree.
2. current working directory
"." Indicates the current directory
"./" Indicates the current directory
".." Indicates the parent directory of the current directory
"-" Indicates using the cd command to convert to the directory before switching the directory.
"~" The absolute path name of the user's main directory.
Example:
Cd-switch between the last working directory and the current path
Cd... switch to the upper-level directory
Cd ~ Returns the Home Directory of the root user.
3. Path
Path refers to the location of a file or directory in the file system.
Determine the path: complete description of the file location.
Relative Path: Specifies the location relative to your current working directory.
4. ls command
-A: List all files in the directory (all)
-L: list the detailed information of an object, usually known as "long format".
-D: displays detailed information about the directory.
-A: All files except ".", "." are displayed.
-R: recursively lists all objects in the subdirectory.
-H: displays the file size in readable units.
-S: sort the output by file size
-T: Output in chronological order
-I: the node number of the file is output before the file is output.
Rename Command
Touch g0a..zw..txt
Rename. txt. php * txt
The function is to change the end of all txt files in the directory to the end of php.
Rename
6: stat command
View the metadata of a file (the information of the file itself)
Atime: Last access time
Mtime: last modification time
Ctime: Status Change Time
7: ln command
1. Hard link:
Set a directory item for a file instead of creating a new file. The advantage is that after a hard link is created, the file will not be deleted as long as the inode number is not 0.
Note:
Cannot create hard links to directory files
Hard links cannot be created across file systems
2. Symbolic Link
It is also called a soft link, which is equivalent to a shortcut on windows. Deleting a symbolic link does not affect the source file.
Example:
Ln + source file + target file: Create a hard link
Ln +-s + source file + target file: Create a soft connection