Introduction to common commands and shortcut keys in Linux

Introduction to common commands and shortcut keys in Linux

1 System Introduction

1. Ping
	Format:
    	ping [URL]
 # Determine whether the system can connect to the network normally 2. Host login user information [root@localhost ~]# 
    root: User name for logging into the current system @: separator, no special meaning localhost: Host name of the current system ~: Current directory (~ represents the current home directory, /root)
    #: No actual meaning 3. Customize system login user information PS1 environment variable	
	[root@localhost ~]# echo $PS1
    [\u@\h \W]\$
    [root@localhost ~]# PS1='[\u@\h --- \W]\$'

insert image description here

1.1 System command syntax format

The usual system command syntax format is:
	command [arguments] [options] [path]

1.2 System Directory Structure

Everything in Linux starts from root (/).

Knowledge reserve:
	cd : change directory

1.3 Types of system paths

Absolute path: the reference is the root (/) path Relative path: the reference is the current path

1.4 System operation commands

1. Shutdown shutdown: Shutdown or restart Parameters: -h: Specify shutdown delay time -c: Cancel shutdown halt: Disable CPU resources poweroff: Turn off the power init: Set system startup mode 0: Shutdown 1: Single user mode 2: Multi-user no network mode 3: Multi-user mode 4: To be determined 5: Desktop mode 6: Restart reboot
		

2. Restart reboot
	init
	shutdown
		parameter:
			-r: Specify the delay time for restart 

insert image description here

1.5 View system command help

Format:
	man [command to view help]
	
		Command explanation information: NAME
		Command syntax description: SYNOPSIS
		Command Description: DESCRIPTION
		Detailed description of command parameters: OPTIONS

	q : Exit /[Search content] : Search content

2 System shortcuts

1. Historical command information: up and down keys 2. Clear screen command: ctrl + l | clear
3. Interrupt and cancel the command execution process: ctrl + c
4. Quickly move the cursor to the beginning and end of the line: ctrl + a/e
5. Cut the information from the cursor to the beginning of the line: ctrl + u
6. Paste the cut content: ctrl + y
7. Cut the information from the cursor to the end of the line: ctrl + k
8. Lock the system window information status: ctrl + s
9. Unlock system window information status: ctrl + q
10. Quickly move the cursor in the command line: ctrl + arrow keys 11. System command information completion function: tab

insert image description here

3 Common system commands

3.1 Directory path related commands

	1. Display current path information pwd 
	2. Switch directory path information cd 
		Special paths:
			1. -: the path last visited 2. .: represents the current path 3. ..: the previous path 4. ~: home directory Absolute path and relative path 3. Create a directory mkdir
		
		parameter:
			-p: Automatically create parent directories -v: Display the process of creating folders		
		Example: Create a v1 directory in the test directory under the data directory in the previous directory [root@localhost ~]# mkdir -p ../data/test/v1
		
		Note: When mkdir creates a folder, the parent directory of the folder must exist 

insert image description here

3.2 File directory related commands

	1. Create file information command touch
		[root@localhost ~]# touch 1.txt
	
	2. View data information command ls
		View the file information in the specified directory. By default, the file information in the current directory is viewed.
		parameter:
			-l: Display detailed information of the file -a: Display hidden folders (files or folders starting with . are called hidden folders)
			-h: format file size (must be used with the -l parameter)
			
		[root@localhost ~]# ls -l
        total 4
        -rw-r--r--. 1 root root 0 Dec 9 12:15 1.txt
         -rw-r--r--. : File permissions 1: Number of file hard links root: User root: Group 0: Size (bytes)
         Dec 9 12:15 : created time 1.txt : file name 1B => 8 bytes 1024 bytes = 1kB
         1024kb = 1MB
     
    3. Output print character information echo	
    	Overwrite redirection (>): delete all the contents in the file and then write it Append redirection (>>): write information at the end of the file 4. View file data information cat [path to view the file]

This is the end of this article about common commands and shortcut keys in Linux. For more relevant content about common Linux commands and shortcut keys, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Detailed explanation of Linux command line shortcut keys
  • Detailed explanation of commonly used shortcut keys for Linux terminal command line
  • Common shortcut keys for linux shell commands

<<:  How to use CSS counters to beautify ordered lists of numbers

>>:  How to operate the check box in HTML page

Recommend

Summary of the top ten problems of MySQL index failure

Table of contents background 1. The query conditi...

How to install docker using YUM

As shown in the following figure: If the version ...

Tutorial on installing jdk1.8 on ubuntu14.04

1. Download jdk download address我下載的是jdk-8u221-li...

Vue implements irregular screenshots

Table of contents Image capture through svg CSS p...

CSS3 realizes the graphic falling animation effect

See the effect first Implementation Code <div ...

Vue component library ElementUI implements table loading tree data tutorial

ElementUI implements a table tree list loading tu...

Linux kernel device driver memory management notes

/********************** * Linux memory management...

Share a Markdown editor based on Ace

I think editors are divided into two categories, ...

Example code of html formatting json

Without further ado, I will post the code for you...

The process of installing MySQL 8.0.26 on CentOS7

1. First, download the corresponding database fro...

How to create your own Docker image and upload it to Dockerhub

1. First register your own dockerhub account, reg...

Sample code for realizing book page turning effect using css3

Key Takeaways: 1. Mastering CSS3 3D animation 2. ...

Example code for implementing auto-increment sequence in mysql

1. Create a sequence table CREATE TABLE `sequence...