File system and directory structure

 

/ bin stores binary executable programs

/ sbin stores binary programs executable by the root user

/ boot Store boot files

[centos8 the root @ ~] # LL / Boot

 -rwxr-XR-X. . 1 the root the root   8,106,744 On Dec   . 5  05 : 58 vmlinuz- 4.18 . 0 - 147 core part .el8.x86_64 // kernel, the operating system

 

 

 

/ dev stores the hard disk device

[root @ centos8 ~] # ll / dev 
crw -r--r--. 1 root root 10 , 235 Apr 18  17 : 27 autofs    // The first c represents the character device 
brw-rw ----. 1 root disk       8 ,    0 Apr 18  17 : 27 sda   // The first d stands for block device

 

/ etc configuration file directory

/ home stores the user's home directory

[root@centos8 ~]# ls /home
miao

/ mnt Temporary file mount point

/ media Mount point for portable mobile devices

/ opt third-party application installation location

/ proc virtual folder stores files related to memory

/ sys System and memory information, mainly hardware information

/ run stores temporarily generated files

/ tem Temporary file storage location

/ usr stores operating system related files, such as help files 

/ var stores changed content (such as web content, logs)

[root@centos8 ~]# ls /usr
bin games include lib lib64 libexec local sbin share src tmp

 

Linux file system layered structure

Reference document: http://www.pathname.com/fhs/

[root@centos8 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk 
├─sda1 8:1 0 2G 0 part /boot
├─sda2 8:2 0 10G 0 part /
├─sda3 8:3 0 5G 0 part /data
├─sda4 8:4 0 1K 0 part 
└─sda5 8:5 0 2G 0 part [SWAP]
sr0 11:0 1 7G 0 rom /run/media/miao/CentOS-8-1-1911-x86_64-dvd

[root@centos8 ~]# ls /bin /sbin /lib /lib64 -ld
lrwxrwxrwx. 1 root root 7 May 11 2019 /bin -> usr/bin
lrwxrwxrwx. 1 root root 7 May 11 2019 /lib -> usr/lib
lrwxrwxrwx. 1 root root 9 May 11 2019 /lib64 -> usr/lib64
lrwxrwxrwx. 1 root root 8 May 11 2019 /sbin -> usr/sbin

 

 

Components of the application

Binary programs: / bin, / sbin, / usr / bin, / usr / local / bin, / usr / local / sbin

Library files: / lib, / lib64, / usr / lib64, / usr / local / lib, / usr / local / lib64

Configuration files: / etc, / etc / DIRECTORY, / usr / local / etc

Help files: / usr / share / man, / usr / share / doc

 

The character color definition is stored in the following file

[root@centos8 ~]# cat /etc/DIR_COLORS

File types under linux

- regular file 

d directory file 

b block device 

c character device 

l symbolic link file 

p pipe file pipe 

S socket file socket

 

 

2 File operation commands

2.1 Display the current working directory

Each shell has a current working directory CWD: current work directory

Display the absolute path of the current shell CWD

pwd命令:printing working directory

-p shows the actual physical path

-L shows the connection path (default)

[root@centos8 bin]# pwd -L
/bin
[root@centos8 bin]# pwd -P
/usr/bin

 

2.2 Absolute and relative paths

Absolute path: starting from the root directory (/)

relative path

 

 

 

2.3 Change directory

Command cd: change directory

Option-P: switch to a physical path, not a linked directory

Absolute or relative paths can be used

Switch to the upper directory: cd ..

Switch to the current user's home directory: cd

Change to the last directory: cd-

 

Base name

[root@centos8 ~]# basename /etc/sysconfig/network
network

 

Directory name

[root@centos8 ~]# dirname /etc/sysconfig/network
/etc/sysconfig

 

 

2.4 List directory contents

[root@centos8 ~]# alias ll lias ll='ls -l --color=auto'

 2.5 View file status stat

[root@centos8 ~]# stat /etc/passwd
  File: /etc/passwd
  Size: 2424            Blocks: 8          IO Block: 4096   regular file
Device: 802h/2050d      Inode: 16810466    Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Context: system_u:object_r:passwd_file_t:s0
Access: 2020-04-18 17:28:19.987948935+ 0800 // read the contents of the file 
the Modify: 2020 - 04 - 18 is  . 17 : 28 : 19.966948935 + 0800 to change the contents of the file // 
Change: 2020 - 04 - 18 is  . 17 : 28 : 19.967948935 + 0800 @ original data change occurred

2.6 View file types

file-option file name

 

Drag and drop files in windows to centos connected by xshell

Installation tools

[root@centos8 ~]# yum -y install lrzsz
CentOS-8 - AppStream                                                                         1.4 kB/s | 4.3 kB     00:03    
CentOS-8 - Base                                                                              2.2 kB/s | 3.8 kB     00:01    
CentOS-8 - Extras                                                                            812  B/s | 1.5 kB     00:01    
Dependencies resolved.
=============================================================================================================================
 Package                   Architecture               Version                               Repository                  Size
=============================================================================================================================
Installing:
 lrzsz                     x86_64                     0.12.20-43.el8                        BaseOS                      84 k

Transaction Summary
=============================================================================================================================
Install  1 Package

Total download size: 84 k
Installed size: 190 k
Downloading Packages:
CentOS-8 - Base                              0% [                                          ] 1.9 kB/s |   0  B     00:00 ETA

lrzsz-0.12.20-43.el8.x86_64.rpm                                                              154 kB/s |  84 kB     00:00    
-----------------------------------------------------------------------------------------------------------------------------
Total                                                                                         51 kB/s |  84 kB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                     1/1 
  Installing       : lrzsz-0.12.20-43.el8.x86_64                                                                         1/1 
  Running scriptlet: lrzsz-0.12.20-43.el8.x86_64                                                                         1/1 
  Verifying        : lrzsz-0.12.20-43.el8.x86_64                                                                         1/1 

Installed:
  lrzsz-0.12.20-43.el8.x86_64                                                                                                

Complete!

Then drag the file on windows directly to the xshell window, upload it and view the content

[root@centos8 ~]# cat win.txt
a
b
c[root@centos8 ~]# 

Drag and drop the txt file with Chinese refueling written in windows to xhell

[root @ centos8 ~] # cat win1.txt 
China 
Come on [root @ centos8 ~] #

Note that the ANSI encoding method of the windows system may be inconsistent with UTF-8 in Linux, which is likely to cause garbled characters. Pay attention to the encoding format when transferring files in different operating systems

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

------------ End of recovery content ------------

Guess you like

Origin www.cnblogs.com/miaocongcong/p/12730803.html