1. Summary of the directory structure of the system
/File System entry, highest level directory
The command required by the/bin base system is the command required by the smallest system, such as Ls,cp,mkdir. The files in this directory are executable and can be used by the average user
/sbin most of the commands involved in system Management, is the super-user root executable command storage, ordinary users do not have permission to execute this directory command, this directory and the following
The/usr/sbin;/usr/x11r6/sbin or/usr/local/sbin directories are similar; we'll remember that all of the directories sbin contain root permissions to perform.
Files required for the/boot Linux kernel and the system boot program
/dev Device file storage directory
/etc Storage System program or general tool configuration file
/lib,/lib64 library file directory, which contains all the shared library files required by the System program
/lost+found when the system crashes unexpectedly or the machine shuts down unexpectedly, and some file fragments are placed here
/media mount points for plug-and-play storage devices are automatically created in this directory
/mnt This directory is typically used to store mount directories for mounted storage devices.
/opt Some packages will also be installed here, that is, custom packages, some of our own compiled packages, can be installed in this directory
When the/proc operating system is running, the process (running program) information and kernel information (such as CPU, hard disk partition, memory information, etc.) are stored here. The/proc directory is a mounted directory of spoofed file system proc, Proc is not a real file system. This is a very special directory in the system, in fact, there is no partition on this directory. It's actually a real-time, in-memory file system.
/root home directory for Linux super User root
/tmp Temporary file directory, sometimes when users run the program, will produce temporary files
/usr This is a directory of system storage programs, such as commands, help files, and so on.
/var The contents of this directory are constantly changing
##################################################
2.LS Command Summary
Ls-a
List all the files under the file, including "." The beginning of the hidden file (the Linux file hidden file is preceded by the., if present: Represents the existence of the parent directory).
Ls-l
Lists the details of the file, such as creator, creation time, file read-write permission list, and so on.
Ls-f
Add a character at the end of each file to indicate the type of the file. ' @ ' means symbolic link, ' | ' Represents the FIFOs, "/" for the directory, and "=" for the socket.
Ls-s
Prints the size of the file after each file. Size (sizes)
Ls-t
Sort files by time, time (hours)
Ls-a
List except for "." and ".." Other than the file.
Ls-r
List all subdirectories in the directory as files.
Ls-l
Lists the link names of the files. Link (links)
Ls-i
Print out the inode number for each file
Ls-h
List file sizes in an easy-to-understand format (e.g. 1K 234M 2G)
Finally, the meaning of some file colors in Linux files
Green----> representative executable (green means for pass) hehe
Red----> represent compressed files
Dark blue----> representative catalogue
Light blue-----> on behalf of linked files
Grey----> on behalf of some other files
########################################################
3.Linux File System Summary
Linux files are typically created with a number of related applications, such as tools, documentation tools, archive tools .... or CP tools. The way to delete a Linux file is with the RM command.
Linux file type;
The Linux file type and the name of the Linux file represent the meanings of two different concepts. We create through general applications such as File.txt, file.tar.gz, these files, although to be opened with different programs, but in the Linux file type measurement, mostly regular files (also known as ordinary files).
Linux file types are common: ordinary files, directories, character device files, block device files, symbolic link files, etc. now we have a brief description;
Normal file
[Email protected] ~]# LS-LH Install.log
-rw-r--r--1 root root 53K 03-16 08:54 Install.log
We use LS-LH to see the properties of a file, we can see similar-rw-r--r--, it is worth noting that the first symbol is-, such a file in Linux is a normal file. These files are typically created with some related applications, like tools, document tools, archive tools .... or CP tools. This type of file is deleted using the RM command;
Directory
[Email protected] ~]# LS-LH
Total 14M
-rw-r--r--1 root root 2 03-27 02:00 Fonts.scale
-rw-r--r--1 root root 53K 03-16 08:54 Install.log
-rw-r--r--1 root root 14M 03-16 07:53 kernel-6.15-1.2025_fc5.i686.rpm
Drwxr-xr-x 2 users 4.0K 04-04 23:30 mkuml-2004.07.17
Drwxr-xr-x 2 root root 4.0K 04-19 10:53 Mydir
Drwxr-xr-x 2 root root 4.0K 03-17 04:25 public
When we execute in a directory, see similar drwxr-xr-x, such files are directories, directories in Linux is a more special file. Note that its first character is d. The command to create a directory can be used with the mkdir command, or the CP command, where CP can copy a directory to another directory. Remove the RM or RMDIR command.
Character device or block device file
If you enter the/dev directory, list the files, you will see similar to the following;
[Email protected] ~]# Ls-la/dev/tty
Crw-rw-rw-1 Root TTY 5, 0 04-19 08:29/dev/tty
[Email protected] ~]# ls-la/dev/hda1
Brw-r-----1 Root Disk 3, 1 2006-04-19/dev/hda1
We see that the/dev/tty property is crw-rw-rw-, note that the first character in front is C, which represents the character device file. such as the cat and other serial devices
We see that the/dev/hda1 property is brw-r-----, note that the first character in front is B, which indicates a block device, such as a hard disk, an optical drive, and other devices;
This kind of file is created with Mknode and deleted with RM. Currently in the latest Linux distributions, we generally do not have to create the device files ourselves. Because these files are associated with the kernel.
Set of interface files
When we start the MySQL server, a mysql.sock file is generated.
[Email protected] ~]# Ls-lh/var/lib/mysql/mysql.sock
srwxrwxrwx 1 mysql mysql 0 04-19 11:12/var/lib/mysql/mysql.sock
Note that the first character of the property of this file is S. We'll just have a look.
Symbolic Link File
[Email protected] ~]# LS-LH Setup.log
lrwxrwxrwx 1 root root one 04-19 11:18 setup.log install.log
When we look at the properties of a file, we see something like lrwxrwxrwx, note that the first character is L, and this type of file is a linked file. is the new file name by ln-s the source file name. Above is an example that indicates that Setup.log is a soft link file for Install.log.
Summary of simple points:
1. Normal file (-indicated, available ls-l view)
2. Catalogue (d) [in Linux, everything is considered a file, and the external device is considered a file, note that it is anything].
3. Character device file (c)
4. Block device file (b)
5. Socket file (s) [after we turn on the MySQL service, the Mysql.sock file generated under/var/lib/mysql/, the file disappears after the MySQL service is turned off]
6. Piping (p) [Pipe in Linux/unix Chinese very useful thing, must master Kazakhstan]
7. Symbolic link file (l) [kinda like a shortcut under win]
In addition, we can use Ls-al to view all the files in the current directory, which we can see "." and ".." These two files
In fact, "." is to represent the current directory
".." is to represent the parent directory, because Linux sees everything as a file, so there is "." and ".." These two files are feeding ...
###########################################
4.alias Command Summary
The basic use of alias is:
Alias new command = ' original command-options, parameters '
For example: Alias l= ' Ls-l ', enter the L command, which is equivalent to input ls-l command
The system defaults to some alias settings:
[[email protected] ~]# alias
Alias cp= ' Cp-i '
Alias egrep= ' Egrep--color=auto '
Alias fgrep= ' Fgrep--color=auto '
Alias grep= ' grep--color=auto '
Alias l.= ' ls-d. *--color=auto '
Alias ll= ' Ls-l--color=auto '
Alias ls= ' ls--color=auto '
Alias mv= ' Mv-i '
Alias rm= ' Rm-i '
Alias Which= ' Alias | /usr/bin/which--tty-only--read-alias--show-dot--show-tilde '
To cancel the alias alias configuration
Unalias a new command
Example: Unalias L cancels the alias configuration above
Linux Basics-First day