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 Liunx Common commands: theoretical explanation

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

Share

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

[TOC]

Introduction: Liunx common command essence: theory explanation

Structure of this chapter:

Linux command base

Linux Command Help

Directory and File Basic Operations

1: Linux Command Basics 1.1: Shell

The kernel is the heart of the system, the nascent model,

The kernel of liunx is developed by C language, among which the program is C++; all systems are C language, C language is process-oriented, C++ is object-oriented, the two complement each other

C language program, kernel can run directly, need compiler to convert human language into machine recognition language, GCC, GCC- C++

Java is compiled by JDK.

Python compiler is Python2/3

Compile files are also called binary files

Source code files through the compiler, into the execution file

Kernel is the hub, for a user to perform operations, is equivalent to a privilege to perform operations

1.2 Classification of Liunx commands

1.3 Linux Command Line Format

command word, meaning what you want to do, such as view

Options, which features are provided, such as viewing profile information or detailed information; a character represents a feature and can be combined

ls -a, View all files in folder, including hidden files

ls -l, see details in file

ls - al merge together, near View all, also View details

Advantages of short format: minimum time to achieve the most commands, short format with the most

Long format followed by words

ls -- color

Parameter, is the object of specific operation, need to specify the location of the parameter, or file name, user name; the number of objects can be 0, or more

2: Linux Command Help 1) Edit Command Line

Command can be completed, path can be completed, need a uniqueness

Backslashes are especially useful in scripting

Here is an example of a script file

hostname View hostname

hostnamectl set-hostname kgc rename host name to KGC need to restart to trigger, this modification is permanent modification

su reload

tab key is also called tab, autocomplete command

vim /etc/sysconfig/network-scripts/ifcfg-ens33 Edit the network card at the following location

cd /etc/sysconfig/network-scripts/to this NIC folder location

The up arrow allows you to view the history of commands previously entered

history can view all commands in history, there are security risks

history -c direct clear command

Experiment auxiliary command, clear screen, clear line head, clear line tail

ping baidu, test CTRL+C command, cancel editing this command

2) Ways to get help with commands

--help is written by sinicized people, only most of them carry out commonly used commands

MAN can read all, is written by developers, enter MAN will enter a reading environment

experimental

ls View

ls --help

man ls

You can flip up and down, q comes out.

3) Summary

Shell acts as "translator" between user and kernel

Linux commands are divided into internal commands and external commands

PATH environment variable

External commands are in these environment variables

cd /bin

3: Basic operations of directories and files 1) View the current working directory-pwd

pwd View current location, show absolute path

All paths start at root (/)

cd /etc/sysconfig//network-scripts/

Relative paths and absolute paths are root referenced, root is absolute path

2) switch working directory-cd

d ~ Switch to user's home directory

d -Switch to previous location

Host is home directory, home directory is host directory

Administrator home directory at root, normal user home directory at HOME

cd ~ Go back to the home directory, pwd, check its absolute path, and find it in/root. Because the user is root, the administrator's home directory is in root.

Try again with a third. Try again with a fourth.

cd .. Return to the previous directory, i.e. parent directory

cd. current directory

cd ../../ Back to top

cd -Returns the location of the last path

cd ~ plus user goes directly to the user's home directory

CD adds nothing to its own home directory

3) List display directory contents-ls

ls

-l Display file details

-a View hidden files

-A View hidden files, except. .. (. refers to its own catalogue,.. parent directory)

-d Display information about this directory

-h Friendly form displays information with units

-R Recursive display (if there are subdirectories, the files in the subdirectories will be displayed in turn)

--color Distinguish file types by color

Black (data file) txt

Blue (Directory/Folder) Directory

Red (compressed package) rar

GREEN (EXECUTIVE FILE/COMMAND FILE/Script) EXE

Sky Blue (link files/shortcuts) Shortcuts

(device file/disk file)

ls -d Display this directory information

ls -ld Show details of this catalog

ls -ldh Displays this directory with unit details

ls -R Recursively display this directory information

in -s create shortcut original file name shortcut name in -s class.txt abd.txt

rm-rf delete rm-rf class.txt delete class.txt file

Red is the compressed package file, green is the script file (script files are basically in bin)

It's a disk file.

Pink is a picture format

wild symbol

"?"One represents an unknown character in the file name

A "*" represents any number of characters in a file hit

Create a few files and test them.

4) Set alias-alias

It is equivalent to reconfiguring the shortcut keys for commands. Boys all understand it. Change the keys.

4) Statistics on directory and file space occupation-du

Only sum statistics

6) Create a new directory-mkdir

Create a subdirectory within the Create directory called Recursive Nested Creation

7) Create Empty File-Touch Command

Use braces instead of brackets.

Create a file with content

One is a statement echo, cat new.txt View file contents

The second one uses vim editor. After entering, it exits directly. It is not a file created. Press i to change it to insert inside. You can write information. This is new.

, and then press esc input mode cancel, and then press colon, the cursor will bottom down, at this time wq save exit;w save, q exit

percent substitution

set nu

10,20 s/03/02

8) Create Connectivity File-ln

Soft Connections: Shortcuts

Hard link: alias of file

File nodes (the unique sequence of identifiers stored on disk) are the biggest difference between soft and hard connections

ls -i View node

9) Copy files or directories-cp

P copy time

You can't jump the line.

10) Delete files or directories-rm

11) Move files or directories-mv

12) Find command/file storage directory-which

It is used to find commands and determine whether commands are internal and external commands.

echo $path Output environment variables

Internal commands are getting fewer and fewer, cd is internal in version 6 and external in version 7

13) Find files or directories-find

ordinary file, data file; directory; block device file, disk file; character device file, DV device file;

IV: Summary of this chapter

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