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

How to implement function currying and decurrying in Javascript

Function currying (black question mark face)? ? ?...

Talk about important subdirectory issues in Linux system

/etc/fstab Automatically mount partitions/disks, ...

The linkage method between menu and tab of vue+iview

Vue+iview menu and tab linkage I am currently dev...

Installation of mysql-community-server. 5.7.18-1.el6 under centos 6.5

Use the following command to check whether MySQL ...

iframe parameters with instructions and examples

<iframe src=”test.jsp” width=”100″ height=”50″...

Detailed explanation of three ways to import CSS files

There are three ways to introduce CSS: inline sty...

Using keras to judge SQL injection attacks (example explanation)

This article uses the deep learning framework ker...

Introduction to cloud native technology kubernetes (K8S)

Table of contents 01 What is Kubernetes? 02 The d...

Getting Started with Front-End Vue Unit Testing

Table of contents 1. Why do we need unit testing?...

Detailed explanation of using MySQL where

Table of contents 1. Introduction 2. Main text 2....