Home  >  Article  >  System Tutorial  >  Learning summary (1): ssh usage, Linux directory structure and password-free login

Learning summary (1): ssh usage, Linux directory structure and password-free login

王林
王林Original
2024-07-17 07:51:51568browse

学习总结(1):ssh 使用、Linux 目录结构与免密登录

Learning summary

(1).: Represents the current directory, and can also be represented by ./; ..: Represents the upper-level directory, and can also be represented by ../.

Article Directory

Step 0: ssh usage

After opening the ssh tool putty (free!), I found an error Couldn't tagreakekeyexchangealgorithm when I logged in. I checked and said that the putty version might be too old, so I went to the official website and downloaded another one - and it was miraculously fine (but at first) I thought the account was the kind of account in ubuntu Linux file related commands, but I never logged into hhh, and then I tried it and found out it was

The @ front thing of this thing hahahaha).

In addition, you can also set up password-free login, please refer to the blog.

Step 1: Learn the directory structure of Linux

Use the ls/ command to list all directories under the root directory ():

The above tree directory structure:

在这里插入图片描述

1.1 Several important directories:

/etc: As mentioned above, this is the configuration file in the system. If you modify a file in this directory, the system may not start.

/bin,/sbin,/usr/bin,/usr/sbin: This is the system’s default directory for placing executable files. For example, ls is in the /bin/ls directory.

linux文件相关命令_linux文件相关操作_linux常用命令文件

It is worth mentioning that /bin and /usr/bin are commands for system users (normal users except root), while /sbin and /usr/sbin are commands for root.

/var: This is a very important directory. There are many programs running on the system, so each program will have a corresponding log, and this log is recorded in this directory, specifically in the /var/log directory. Next, the default placement of mail is also here.

1.2 The remaining directories: System startup must:

/boot: Stores the kernel files used when starting Linux, including connection files and image files.

/etc: Stores all configuration files and subdirectory lists required by the system. Modifying files in the directory may cause the system to fail to start.

/lib: Stores basic code libraries (such as c++ libraries), which function is similar to DLL files in Windows. Almost all applications need to use this shared library.

/sys: This is a big change in the linux2.6 kernel. A new file system sysfs that appeared in the 2.6 kernel is installed in this directory. The sysfs file system integrates information from the following three file systems: the proc file system for process information, the devfs file system for devices, and the devpts file system for pseudo terminals. The file system is a visual reflection of the kernel device tree. When a kernel object is created, the corresponding files and directories are also in the kernel object subsystem

Instruction set:

/bin: stores the most commonly used programs and commands

/sbin: Programs and commands that only system administrators can use.

External file management:

/dev: Abbreviation for Device, which stores Linux external devices. Note: The form of accessing devices and files in Linux is the same.

/media: Other Windows-like devices, such as USB drives, CD-ROM drives, etc. After identification, Linux will place the devices in this directory.

/mnt: To temporarily mount other file systems, we can mount the hard disk on /mnt/, and then enter the directory to view the contents of the hard disk.

Temporary files:

/run: It is a temporary file system that stores information since the system started. When the system restarts, files in this directory should be deleted or removed. If you have a /var/run directory on your system, you should point it to run.

/lost+found: Usually empty, after the system crashes illegally, some files are stored here.

/tmp: This directory is used to store some temporary files.

Account:

/root: The user home directory of the system administrator.

/home: The user’s home directory, named after the user’s account.

/usr: Many user applications and files are placed in this directory, similar to the programfiles directory under Windows.

/usr/bin: Applications and commands used by system users.

/usr/sbin: A relatively intermediate management program and system daemon used by super users.

/usr/src: The default placement directory for kernel source code.

Use during operation:

/var: Stores data that changes frequently, such as log files for program running (under the /var/log directory).

/proc: Manage video memory space! The virtual directory is a mapping of the system's video memory. We can directly access this directory to obtain system information. The contents of this directory are not on the hard disk but in the video memory. We can also directly change the individual files above to make changes.

For expansion:

/opt: It is empty by default. We can install additional software and put it on this.

/srv: The data that needs to be extracted after the storage service is started (it will be empty if the server is not used)

Step 2: Learn Linux file and directory management

linux文件相关操作_linux文件相关命令_linux常用命令文件

The top directory is the root directory/

Absolute path: The path is written starting from the root directory /, for example: /usr/share/doc directory.

Relative path: The way to write a path is not to start with /. For example, when going from /usr/share/doc to /usr/share/man, it can be written as: cd.../man. This is how to write a relative path.

(1) ls: List directories and file names

(English abbreviated spelling: listfiles)

-a: List all files, including hidden files (files starting with .) (commonly used)

-d: Only list the directory itself, not the file data in the directory (commonly used)

-l: Long data string enumeration, including file attributes and permissions, etc.; (commonly used)

ls-al~List all files in the home directory (including attributes and hidden files)

在这里插入图片描述

(2)cd: switch directory

(English abbreviated spelling: changedirectory)

(3)pwd: Display the current directory

(English abbreviated spelling: printworkdirectory)

-P: Show the current path.

(4)mkdir: Create a new directory

linux文件相关操作_linux文件相关命令_linux常用命令文件

(English abbreviated spelling: makedirectory)

-m: Configuration file permissionsLinux file related commands, direct configuration, no need to look at the default permissions (umask)

-p: Helps you directly create the required directory (including the upper-level directory) recursively

(5)rmdir: delete an empty directory

(English abbreviated spelling: removedirectory)

-p: Starting from this directory, delete multiple levels of empty directories at once

(6)cp: Copy files or directories

(English abbreviated spelling: copyfile)

-a: equivalent to -pdr. As for pdr, please refer to the following instructions; (commonly used)

-d: If the source file is an attribute of a link file (linkfile), copy the link file attributes instead of the file itself;

-f: means force. If the target file already exists and is difficult to open, remove it and try again;

-i: If the target file (destination) already exists, the progress of the action will be asked first when overwriting (commonly used)

-l: Create a hardlink link file in Red Hat Linux instead of copying the file itself;

-p: Copy the file together with its attributes instead of using the default attributes (commonly used for backup);

-r: 再帰的連続コピー。ディレクトリのコピー動作に使用されます (一般的に使用されます)。

-s: 「ショートカット」ファイルとも呼ばれるシンボリック リンク ファイル (symboliclink) にコピーします。

linux文件相关操作_linux文件相关命令_linux常用命令文件-u: 宛先がソースよりも古い場合にのみ、宛先をアップグレードしてください。

(7)rm: ファイルまたはディレクトリを削除します

(英語の省略表記:remove)

-f: 強制的に存在しないファイルを無視し、警告メッセージは表示されません。

-i: インタラクティブ モード、ユーザーは削除する前にアクションを実行するかどうかを尋ねられます

-r: 再帰的削除!ディレクトリで最もよく使用されるものが削除されました。これは非常に危険なオプションです。 ! !

(8)mv: ファイルとディレクトリを接続、またはファイルとディレクトリの名前を変更します

(英語略称: movefile)

-f: 強制とは、ターゲット ファイルが既に存在する場合、確認せずに直接上書きされることを意味します。

-i: 宛先ファイルが既に存在する場合は、上書きするかどうかを尋ねられます。

-u: ターゲット ファイルが既に存在し、ソースが比較的新しい場合は、アップグレード (更新) できます

(9)タッチ: 新しいtxtファイルを作成します

たとえば、touchfile1.txt は Honqi Linux オペレーティング システムです。torch ではないことに注意してください。スペルを間違えないでください。

参考

(1) Putty パスワード不要のログイン:

(2)

The above is the detailed content of Learning summary (1): ssh usage, Linux directory structure and password-free login. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn