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

WeChat applet implements form verification

WeChat applet form validation, for your reference...

Understand CSS3 Grid layout in 10 minutes

Basic Introduction In the previous article, we in...

CSS3 Bezier Curve Example: Creating Link Hover Animation Effects

We will use CSS3 animated transitions to create a...

CSS tips for controlling animation playback and pause (very practical)

Today I will introduce a very simple trick to con...

How to manually scroll logs in Linux system

Log rotation is a very common function on Linux s...

MySQL query optimization: causes and solutions for slow queries

Friends who are doing development, especially tho...

Mysql sorting and paging (order by & limit) and existing pitfalls

Sorting query (order by) In e-commerce: We want t...

js implements the algorithm for specifying the order and amount of red envelopes

This article shares the specific code of js to im...

CSS draw a lollipop example code

Background: Make a little progress every day, acc...

Detailed explanation of custom swiper component in JavaScript

Table of contents Effect display Component Settin...