Linux File Modification Management

Source: Internet
Author: User
Tags create directory touch command

hierarchy of Linux file systems
tree structure of Linux file system
What is a catalog?
Presentation of the top-level root directory
Two special directories in the file system
Some of the important directories in the Linux system
Bin directory
Sbin Directory
Home Directory
Dev Directory
Etc Directory
Mount Directory/media or/mnt
Other common directories
Absolute and relative paths
Absolute path
Relative path
homework after class

"Content of this section"
1.Linux file system hierarchy (see Linux System Management P40)
1) understand the tree structure of the Linux file system:
In a Linux or Unix operating system, all files and directories are organized into an inverted tree structure that starts with the root node.
2) Master the definition of the directory: The directory is equivalent to a folder in Windows, the directory can be stored in either a file or other subdirectories.
3) Master the presentation of the top-level root directory:
Use "/" to represent the root directory
4) Understand the two special directories in the file system:
. Represents the current directory, which is the working directory where the user resides
.. Represents the parent directory, which is the previous level of the current directory
Some important directories in the 2.Linux system (see Linux System Management P41)
1) Mastering some of the important directories in Linux
A) Bin directory: used to store common executable files
b) Sbin directory: The executable file used to store the system
c) Home directory: Used to store the user's own files or directories, where Superuser root home directory is/root, while the normal user's home directory is stored in the/home directory, and use the user name as the last level directory (family directory) name, such as the cat user's home directory is/home/cat
d) Dev directory: Device files directory
e) Etc Directory: Configuration file directory
f) mount point (directory): Typically removable hardware is mounted under the/media or/mnt directory
3. Absolute and relative paths (see Linux System Management P43)
1) Master the definition of absolute path: Must start with a forward slash (/). An absolute path consists of the name of each directory that must be traversed from the root node of the file system to the object (directory or file) to look for, which is the complete signpost to the file location, so you can use an absolute path to find the desired file in any case.
2) Master the definition of a relative path: instead of starting with a forward slash (/), a relative path can contain the name of each directory that must be traversed from the current target to the object (directory or file) to find.
4. After-school assignments (spents 25 minutes)
1) Open Linux operating system and require root user login to Gnome GUI
2) Right-click on the desktop to open the terminal and use "Useradd Lucy" command to create Lucy user
3) Use the mouse to click on the method to enter the root directory
4. Tap into the root user's home directory
5. Tap into the home directory of the Lucy user
6. Tap into the directory used to store the frequently used executable files.
7. Tap into the directory where the executable file for the system is stored
8) Click to enter the device file directory
9) Click to enter the profile directory

Use the PWD and CD commands to identify and switch directories
features of the PWD command
features of the CD command
CD..
CD ~
cd–
CD
use the LS command to list content in a directory
functions of the LS command
Ls–a
Ls–all
ls–l
copy files and directories using the CP command
functions of the CP command
–i Options
–r Options
–p Options
–f Options
use the MV command to move and modify file and directory names
functions of the MV command
example of use of MV command
To create a directory using the mkdir command
features of the mkdir command
examples of the use of MKDIR commands
Create a file using the Touch command
features of the touch command
example of the use of touch commands
To delete a file using the RM command
Features of the RM command
–i Options
–r Options
–f Options
examples of the use of RM commands
To delete a directory using the rmdir or RM–R command
features of the rmdir command
examples of the use of RMDIR commands
features of the rm–r command
examples of the use of RM–R commands
to browse the contents of a body file using the cat command
features of the cat command
examples of use of CAT commands
use the head command to navigate through the contents of a file
functions of the head command
–n Options
example of use of the head command
to browse the contents of a file using the tail command
features of the tail command
–n Options
examples of the use of tail commands
Browse files using the more command
features of the more command
example of use of the more command
homework after class"Content of this section"
1. Use PWD and CD commands to identify and switch directories (see Linux System Management P43-p46)
1) Mastering the function of the PWD command: Determine the current working directory
2) Mastering the function of the CD command: Switch the current directory
3) Master "CD." Command: Go to the top level directory
4) Mastering the "CD ~" command: Switch to the user's home directory
5) Master "CD" command: With CD ~, can also switch to the user's home directory
6) Master the "cd–" command: Switch to the working directory before the user
7) Master the "CD Directory name" command: Switch to the specified directory.
A) For example: the command to switch to the/home/dog directory is: Cd/home/dog
2. Use the LS command to list the contents of the directory (see Linux System Management P47-p50)
1) The ability to master the LS command: Lists the current directory (the default is the current directory) or the contents of the specified directory
2) Master LS-A command: Lists all files under the directory, including "." The implied file at the beginning
A) For example: List all files in the/home/dog directory, including commands for hiding files: ls-a/home/dog
3) Understanding Ls–all command: With Ls–a
4) Master Ls–l command: Lists the details of each file in a directory
For example, a command that lists the details of all non-hidden files in the/home/dog directory:
A) Ls–l/home/dog
3. Copy files and directories using the CP command (see Linux System Management P50)
1) Master the function of CP command: Copy the file (can be multiple) into a specified destination file or copy it to a specified target directory.
2) Common options for mastering CP commands:
Cp Source File Destination file
A) –r (recursive, recursive): replicates the directory recursively. When copying a directory, copy all of the contents of the directory, including the entire contents of the subdirectory.
i) For example: Copy the contents of the/home/dog directory to all the commands in the directory/home/cat:
Cp–r/home/dog/home/cat
b)-F (Force, mandatory): Do not ask for direct force replication when the target file already exists
4. Use the MV command to move and modify file and directory names (see Linux System Management P54)
1) Mastering the functions of the MV command: You can move files and directories between different directories, or rename files and directories.
2) to master the use of MV command example:
A) Examples of moving files and directories:
Move the lists file in the current directory to the command in its subdirectory Babydog:
MV Lists Babydog
b) Examples of renaming files and directories:
Change the BigDog directory name to Babydog command:
MV BigDog Babydog
5. Create a directory using the mkdir command (see Linux system Administration P55)
1) Mastering the function of the mkdir command: Create a new directory
2) Use examples of mastering mkdir commands:
command to create directory Daddog: mkdir Dadgog
6. Create a file using the Touch command (see Linux System Management P56)
1) The ability to master the Touch command: You can create an empty file, or you can create multiple files at the same time.
2) Examples of how to master touch commands:
A command to create a file named Babydog1 in the current directory:
Touch Babydog1
7. Delete files using RM command (see Linux System Management P57)
1) The ability to master RM commands: Permanently delete files or directories in the file system.
2) Master the common options for RM commands:
A) –r (recursive, recursive): Deletes the directory recursively. When a directory is deleted, all content in that directory is deleted, including all content in the subdirectory.
b) –f (Force, mandatory): The system does not ask but is forced to delete, that is, directly delete the original file.
3) Use an example of the RM command:
command to delete the Babydog1 file in the current directory: RM babydog1
8. Delete the directory using the rmdir or RM–R command (see Linux System Management P59)
1) Master the function of rmdir command: Delete empty directory.
2) Use examples of mastering rmdir commands:
To remove the empty directory Mumdog/girldog/babydog command:
RmDir Mumdog/girldog/babydog
3) Master the function of the rm–r command: Delete the directory containing the files and subdirectories.
4) Use examples of mastering rm–r commands:
To delete a non-empty directory Mumdog command:
Rm–r Mumdog
9. Browse the contents of the body file using the Cat command (see Linux System Management P73)
5) Master the function of the cat command: To display the contents of one or more files on the screen, the command will continue to display the contents of the entire file in a read-only manner.
6) Examples of how to master the use of CAT commands:
A) The command to browse the entire contents of the Game.txt file:
Cat Game.txt
10. Use the Head command to browse the contents of the file (see Linux System Management P75)
1) Master the function of the head command: the first 10 lines of a file are displayed by default.
2) Common options for mastering the head command:
-N Change the number of rows displayed
3) The use of the Master Head Command example:
A) command to view the details of the first 10 lines in the/etc/passwd file:
head/etc/passwd
b) command to view the details of the first 5 lines in the/etc/passwd file:
Head–n 5/etc/passwd
11. Use the tail command to browse the contents of the file (see Linux system Administration P76)
1) Master the function of the tail command: the content of the last 10 lines of the file is displayed by default.
2) Master the common options for tail commands:
-N Displays the nth rows from the end of the file
3) Use examples of mastering tail commands:
A) The command to view the details of the last 10 lines in the/etc/passwd file:
tail/etc/passwd
b) The command to view the details of the last 5 lines in the/etc/passwd file:
Tail–n 5/etc/passwd
12. Browse the file using the more command (see Linux System Management P78)
1) Master the more command function: After using the more command, each time a screen (one page) of the file content is displayed, and at the end of the screen will appear "-more--(n%)" Information, where n% is already showing the content of the file percentage.
2) Flexible application of MORE commands
A) paging through the command of the contents of the Learning.txt file:
More learning.txt

Linux File Modification Management

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: info-contact@alibabacloud.com 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.