Location>code7788 >text

linux operating system and file system, commands (top)

Popularity:121 ℃/2024-09-24 21:05:21

Linux is an operating system similar to windows

One of the main ways to use the Linux operating system is through the terminal software; in the terminal software, you can only use the keyboard and not the mouse, and you can accomplish various tasks by typing commands in the terminal software.

The clear command removes all text messages from the terminal window.

The part of the operating system used to manage files is called the file system

All file systems use grouping to manage files

A group can contain as many files as you want; files in each group can be regrouped.

Each file grouping is called a folder (directory)

The Linux file system has a large grouping that contains all the files on the computer; this grouping is called the root directory and is denoted by /.

If directory A directly contains directory B then there is a parent-child relationship between them, where directory A is called the parent directory; directory B is called the child directory.

A path is used to represent the location of a file or directory on a file system; a path represents a route from a directory to a directory or file.

Depending on the starting point, paths can be categorized into absolute and relative paths

Absolute paths are fixed with the root directory as the starting point

eg:/home/abc/vbn

Absolute paths must start with a / (and anything that starts with a / must also be an absolute path)

Relative paths can take any directory as a starting point

Relative paths are represented by... means one step up from the bottom.

The relative path is indicated by . to indicate that you are standing still.

Relative paths must not contain a starting position.

Relative path walk from tuv to vbn

eg: ../../abc/vbn

A directory can be set as the current directory in the terminal window, and this current directory is the starting point for all relative paths.

The location of the current directory can be changed at any time

The pwd command can be used to view the current directory location.

The cd command can be used to set the location of the current directory.

The command is used as follows cd directory path

The ls command can be used to view the contents of a directory, if you omit the directory path you can view the contents of the current directory.



Use the -a option to view the entire contents of a directory.

Use the -l option to see the details of each item

These two options can be combined into -al

The touch command can be used to create files

The method of use is as follows

touch File path

If the file already exists, change the last modification time to the time the touch command was executed.

The rm command can be used to delete files

The method of use is as follows

rm file path

The mkdir command can be used to create directories

It is used as follows

mkdir directory path

Requirement: The directory itself must not exist yet, but its parent directory must exist

Use the -p option to create any directories that don't already exist in the path.

The rm command can also be used to delete directories, using the -r option.

vi is a tool used in Linux to record text messages.

vi can only be used in the terminal serial port (no mouse)

The functions of vi are divided into three groups, only one of which can be used at any one time

There are three modes of operation available in vi, each of which corresponds to a set of functions.

Only one operating mode can be in operation at any one time

The three function modes are normal mode, insert mode, and command mode.

Some simple commands can be executed in normal mode

Text content can be modified in insert mode

Complex commands can be executed in command mode

Whenever you first enter vi, you must be in normal mode.

Interchangeable between different operating modes

Normal mode can be converted to insert mode by typing i

Input in normal mode: can be converted to command mode

Enter esc at any time to switch to normal mode.

You can start vi with the following command

vi file path

There are two ways to exit vi

1. In command mode, type q! (to lose any unsaved changes)

2. Type wq or x in command mode (first save all changes then exit)

Type w in command mode to save all changes without exiting vi.

In normal mode, type nyy (n is an integer, if it is 1, you can omit it), this command can copy the contents of n consecutive lines starting from the line where the current cursor is located to the clipboard.

In normal mode, enter the np command (n is an integer; if it is 1, you can omit it), this command can paste the contents of the clipboard n times below the line where the current cursor is.

In normal mode, enter the ndd command (n is an integer; if it is 1, it can be omitted), which cuts the contents of the n consecutive lines starting from the line where the cursor is located to the clipboard.

In command mode, enter set nu to make vi display the line number of each line.

Assignment: Suppose a software called BankATM is to be developed and this software is divided into two parts (client and server)

It is required to make a set of directories to isolate all the files of this software from the other files, and to isolate the files of the other two parts from each other.