Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Detailed instruction of Common commands in Linux

2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Linux commonly used commands elaborate on the basis of Linux commands in the Linux system, any string entered in the character operation interface that can complete a specific operation and task can be called a "command". Strictly speaking, "command" usually only represents the name of an instruction or program that implements a certain type of function. Linux is a special program running in the system that acts as a "translator" between the user and the kernel. When a user logs in to the Linux system, a Shell program is automatically loaded.

Bash is the default Shell program used in Linux systems.

Classification of Linux commands

Internal commands: it comes with the kernel and does not need to re-read the file from the hard disk, so it is more efficient to execute. As long as the Shell interpreter is run, the internal instructions are automatically loaded into memory and can be used directly by the user. External command: refers to the script file or binary program in the Linux system that can perform specific functions. Each external command corresponds to a file in the system. The Linux system must know the corresponding file location and can only be executed after it is loaded by Shell.

External commands require external builds to be installed independently.

Format command word for the Linux command line

The command word, which is the name of the command, is the most critical part of the whole command. In Linux's character interface, command words are used to uniquely identify a command, so be sure to enter the correct command word when entering a command. General command line format

Command word [option] [parameter]

Option

The function of the option is to adjust the specific function of the command and determine how the command is executed. Similar but slightly different functions can be obtained when the same command word is used with different options. The options used by the command have some of the following features.

Parameters.

The command parameter is the processing object of the command word, and usually the command parameter can make the file name, directory (path) name or user name and so on. Depending on the command word used, the number of command parameters can be zero to multiple. When entering a Linux command, the corresponding command parameters should be provided according to the specific format of the command word to ensure the normal operation of the command. Edit auxiliary operations on the Linux command line

The method of getting command help use help commands to view help information for Bash internal commands-- the help option is used for help information such as the format and options of the corresponding commands. Most external commands use the man manual page to use the direction keys to scroll the text, use the Page Up and Page Down keys to turn the page, press Q or Q key to exit the reading environment, press the "/" key to find the content.

View the current working directory-pwd

Displays the absolute path. Following is the absolute path.

No, just relative to the current location.

Switch working directory-cd changes the user's working directory to a different location

Host directory = add directory cd.. Return to the previous directory

The form of expression of relative path

List of basic operations for directories and files shows the contents of the directory-ls

The ls command is mainly used to display the contents of the directory, including the relevant attribute information of subdirectories and files, etc. The parameters used can be either a directory name or a file name, allowing multiple parameters to be used simultaneously in the same command.

-l: displays a list of files and directories in a long format, including permissions, size, last updated time, and other details. -d: display its own properties-h: friendly display-R: recursively display everything in the directory and subdirectories-color: color extension:

Black: data files such as word notepad, etc.

Green: executable files such as script files

Red: compressed package

Blue: directories (folders)

Sky blue: soft link files (shortcuts)

Pink: picture

Set alias-alias

Statistics on the space consumption of directories and files-the dudu command can be used to count the amount of disk space occupied by a specified directory. Use the name of the directory or file as the parameter.

Create directories and Files touch-- create empty files

Mkdir-- creates a new directory

Ln-- creates a linked file

Hard links are equivalent to aliases, while soft links are equivalent to creating shortcuts to create, delete, move directories and files cp-- copy files or directories

Rm command-delete a file or directory

-f: delete files or directories without warning, but force deletion directly-I: remind users to confirm when deleting files or directories-r: delete directories must use this option, indicating recursive deletion of the entire directory tree operation and maintenance experience: be careful when using the rm command to delete important files, especially if you use this command directly may lead to misoperation. Mv-- moves a file or directory

Find directories and Files which-- find the directory where the command files executed by the user are stored

Find-- looks for a file or directory

This chapter summarizes that the general format of the Linux command line includes command words, options, and parameters. Through the help, man,-- help command options, you can get commands to help execute ls, du commands can view directory-related attributes, execute mkdir, touch commands can create directories and files, execute cp, rm, mv commands can copy, delete, move directories and files execute which, find commands can find directories and files

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report