File command and its usage
Windows:pe
Linux:elf
File system:
Rootfs: Root file system
Fhs:linux
LS/view root directory
/boot: System boot related files, such as kernel, INITRD, and Grub (bootloader)
/dev: Device files
block device: Randomly accessed device data block hard drive
character device: Linear access keyboard mouse display by character
Device number: Main device number (major) and secondary device number (minor)
/etc: Configuration file
/home directory, default to home Next directory with the same name as the user name/home/usernane
/root: Administrator's home directory
/lib: library files and kernel module files
/lib/modules: Kernel module file no program execution portal can only access cannot execute
Static Library. A
Dynamic Library. dll, so (shared object)
/media: mount point directory, mobile device
/MNT: Additional Temporary file system
Actually, all 2 of them are universal, just rules.
/OPT: Optional Directory installation directory for third-party programs early to install third-party software
/proc: Pseudo file system without file kernel mapping file power off to NULL
/sys: Pseudo file system, property mapping files related to hardware devices such as disk I/O queues Power off is empty
/tmp: Temporary files One months regular cleanup everyone created by themselves but can only delete their own
/var/temp
/var: changeable file: Log mail cache run process ID number
/bin: Executable file user command
/sbin: Managing Commands
/usr:shared,read-only globally shared read-only files
/usr/bin
/usr/sbin
/usr/lib
Libraries that are required to run functions after system startup, etc.
/usr/local:
/usr/local/bin
/usr/local/bin
/usr/local/lib
Naming rules:
1. Length cannot exceed 255 characters
2. Cannot use/when file name
3. Strictly case-sensitive
Relative path
Absolute path
File Management
Directory Management
Ls
Cd
Pwd
mkdir: Creating an empty Directory
/root/x/y/z
mkdir x
mkdir x/Y
mkdir x/y/z
Tree: Viewing the directory tree
/root/x/y/z
Mkdir:
- P If no parent directory is created
-V Show Results
mkdir-p /root/x/y/z If no parent directory is created
MKDIR-PV /root/x/y/z Display creation process
Mkdir-pv/root/x/{y/m,z} curly Braces expand
Or
mkdir-pv/root/x/y/m /root/x/ Z
Create a A_b,a_c,d_b,d_c under/mnt/test2/
{A,d}_{b,c}
mkdir-pv/mnt/test2/ {a,d}_{b,c}
To delete a directory:
Rmdir/mnt/test Delete Empty Directory
RmDir
-P Delete non-empty directory
File creation and deletion
Touch a creates an empty file of a
File a View files
Touch is primarily used to modify timestamps
-C does not create a view timestamp if it does not exist or is not created
-A Modify access time
-m-t 201212121212 file modified to a timestamp
Stat A View the timestamp status of a file
650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "border=" 0 "style=" Background:url ("/e/u261/ Lang/zh-cn/images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>
Stat
To create a file, you can use the file editor
Ascii:
128 different characters:
binary :
2^6 =0,63
2^7=0,127
GB19030 GBK GB2312 Unicode
Nano Simple text Editor
Nano text
Ctrl+o Save exit
Delete file: RM Hello
\ls Color Removal
Rm
-I confirm before delete
-F forcibly removed
-R recursively delete files and directories in the directory
-RF forcibly deleted recursively delete files and directories in a directory
Rm-rf/mnt/test2
Copying and moving files
Cp:copy
-R recursion
-R recursion
-I interaction warning
-F forcibly overwrite
-P reserved Property belongs to group of main # # #
-A Keep connected recursive replication archive replication Common backup
CP SRC DEST source file destination file
CP file1 File2 File3 The last one is the target. Unable to implement 2 files to a file
cp/etc/passwd/tmp/target is a directory and there's a file in it.
Cp/etc/passwd/tmp/test does not exist then copy as test if present overwrite
CP file1 file2 dirctory multiple source files The last one must be a directory
cp/etc/init.d//tmp The files inside the default replication directory do not replicate the directory itself
Cp-r /etc/init.d//tem/hello/entire copy to Hello directory
Cp-f if the target has a forced override
Cp-i Prompt Warning message
Cp/etc/{password,inittab}/tmp
MV Move File
MV SRC DEST
The same directory is renamed
mv/tmp/hello//var/tmp/abc If copy directory destination is not directory cannot move if directory is saved to directory
Mv-t DEST src = = =mv src DEST
copying files and specifying properties similar to CP
Install
- D DIRECTORY .... Create a directory
-M Specify permissions
-O Specifies the owner
-T DIRECTORY SRC ....
This article is from the "Jiawu notes" blog, so be sure to keep this source http://jiawu.blog.51cto.com/9349234/1586766
02_02 Linux Root file system detailed