Linux_ file system and document management basics

Source: Internet
Author: User

File system:
Rootfs: Root file system


/boot: System boot related files, such as kernel, INITRD, and Grub (bootloader)
/dev: Device files
Device files:
Block devices: Random access, data blocks
Character Devices: Linear access, by character
Device number: Main device number (major) and secondary device number (minor)
/etc: Configuration file
Home directory for users, the home directory of each user is usually the default of/home/username
/root: Administrator's home directory
/lib: library file
Static Library,. A
Dynamic library,. dll,.so (Shared object)
/lib/modules: Kernel module files
/media: mount point directory, usually mounted on a mobile device
/MNT: Mount additional temporary file system
/OPT: Optional directory for early installation of third-party software
/proc: Pseudo file system, kernel mapping file
/sys: Pseudo file system, property mapping file related to hardware device
/tmp: Temp file,/var/tmp
/var: a variable file
/bin: Executable file, user command
/sbin: Managing Commands

/usr: Shared read-only files globally


File naming rules:
1, the length can not exceed 255 characters
2. Cannot use "/" as file name
3. Strictly case-sensitive

Directory Management:
Tree: Viewing the directory tree

mkdir: Creating an empty Directory
-P: Recursive creation
-V: Show more information

RmDir: Delete Empty directory
-P: Recursive delete empty directory, single branch

Lists, lists the files under the specified path
-L: Long format displays full information
File type: the
-: Normal file (f)
D: Catalog file
B: Block device files (blocks)
C: Character device file (character)
L: Symbolic Link files (symbolic link file)
P: Command pipe file (pipe)
S: Socket file (socket)

File permissions: 9-bit, every 3-bit group, each group: rwx (Read, write, execute), r--

Number of hard links to files

Owner of the file

Genus Group of files

File size (size), default unit is byte

Timestamp (timestamp): Last Modified Time
Access: Access
Modified: Modify, the file content has changed
Change: change,metadata, meta data
-H: Unit conversion
-A: Show hidden files starting with.
. Represents the current directory
.. Indicates a parent directory
-D: Display the directory's own properties
-i:index Node,inode (Index node)
-r:desc sort
-R: Recursive (Recursive) display

Cd:change Directory
CD ~username: Enter the user's home directory
CD-: Switch back and forth between the current directory and the previous directory

File Management:
File: Show Files Type
Stat: View the detailed status of a file
Touch: Create an empty file
-A: Change access time only
-M: Change only the modified file
-T: Specify timestamp [[CC]YY]MMDDHHMM[.SS]
-C: Do not create a new file when the file does not exist

Create a file using the file editor

To delete a file:
-R: Recursive delete
-F: Do not prompt for immediate deletion
-I: interactive Delete, hint

Copy file: (Cp,install)
cp:copy, copy a file to a file, copy multiple files to a directory
CP Source_file Destination_file
-R: Recursive replication for copying files in directories and directories
-F: Forcibly copied, overwritten, without prompting
-I: Interactive
-P: Preserve the source file permissions, owner, timestamp
-A: Archive, often used for backup
-L: If the source file is a linked file, copy the linked source file
-P: Copy a linked file instead of a linked source file

Mv:move Moving files
MV Source_file Destination_file

Install-d directory ...: Creating directories

Find the file name:
Whereis [-BMSU] filename
-B: Find only binary files
-M: Find only in the description file path manual
-S: Find source files only
-U: Find other special files that are not among the above three options

To find a file using find:
Find [PATH] [option] [action]
Find/-mtime 0: Finding files within the current time to 24 hours
+ 4: Find files greater than or equal to 5 days ago
-4: Find files in less than or equal to 4 days
4: Find files between 4-5 days

Find/home-user Root--Find all files from the root user in the/home directory

-name filename--Find a file named filename
-size [+-]size--Find files larger or smaller than size (-size +50k)
-type Type--Find a file of type file

-perm mode--Find files equal to mode
-perm +mode--Find the file that must contain all mode, greater than mode
-perm-mode--Find a file that contains any mode

Text Management:
To view text:
-N: Show line numbers
-e: Show Line endings
TAC:CAT reverse Order

MORE: Turn backwards
/String down query string
? string up query string, less available
Space PAGE Down

Head-n filename View file header 20 lines
Head-n -100 filename does not show the last 100 rows

Tail-n filename View file trailing 20 lines
Tail-n +100 filename does not show header 100 rows

-F: Look at the end of the file, do not exit, wait to display new content appended to this file

Text Processing:
-D: Specify delimiter, default is space
-F: Specify the fields to display
-f1,3: Show 1th, section 22 fields
-f1-3: Show 1th to 33rd fields
Text sort:
Sort: Default ASC sort
-N: Sort by value
-T: Specify delimiter
-K: Which field is the sorting criterion
-U: Remove duplicate items, show only once
-F: Ignore case
[Email protected] ~]# sort-t:-k3-nr/etc/passwd

-C: Shows the number of rows in a file that repeats
-D: Show only duplicate rows

Text statistics:
Wc:word Count
-L: Show only the number of rows
-W: Displays only the number of words
-C: Show only the number of bytes
-M: Displays only the number of characters
-L: The longest line contains the number of characters

Character Processing:
TR: Used to convert or delete characters
[[email protected] ~]# echo "AAAAHSDF" |tr ' A-Z ' A-Z '
-D: Delete characters
[[email protected] ~]# echo "AAAAHSDF" |tr ' a '-D

Linux_ file system and document management basics

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.