Linux_Basic system commands in the initial stage

######What is linux####
1.linux refers to the kernel of linux
2. The operating system we are talking about is the kernel of linux + the software of the GNU organization GNU/linux


######What is shell#### 1. The shell
is an interpreter 2. The shell is a
software that protects the system kernel from being tampered with
3. The default shell started in the system we are using is the bash
directory directory

####### in the shell How to execute a command ####
1. The command must be entered after the line prompt
2. If the line prompt is occupied, then, ctrl+c can end the program occupying the current line prompt and release the line prompt

3. Command + space +Parameter+space+object
  command is the program
  parameter is a function specified by the program -a -b -c =-abc = -bac
  object is the target of the operation

4. The meaning of the line prompt
[kiosk@foundation0 Desktop]$

kiosk # Indicates who is running the shell
foundation0 #shell opens the host name of the host
Desktop #the name of the folder where you are currently
$ #What level of your user identity is, $ indicates a common user,


#superuser####4. File management Command ####
1. New file
touch file

2. Create a new directory
mkdir test

3. Delete the file
rm -f file ## -f is the abbreviation of force, which means that the forced deletion does not prompt

4. Delete the directory
rm -f -r Directory ##-r means recursion, which is the directory itself and everything inside

rm -fr directory


5. View the file content
cat file

6. Write the file
vim file Enter the browse mode
Press the "i" key to enter the insert mode to start writing characters
After writing, press the "ESC" key to exit the insert mode
Press ":wq" to save and exit, the file writing is completed


###5. System structure##
/bin #Common system commands
/sbin #System management commands
/boot #Boot partition
/sys #Kernel parameter adjustment
/dev #Device file
/lib #32-bit library file
/lib64 #64 library file
/media /run /mnt #Mount point of temporary device
/opt #Installation location of third-party software
/proc #System information
/etc #System configuration directory
/home #Ordinary user home directory
/root #Super user home directory
/var,/ srv #System data


##6. Commands about paths##
1. Paths are divided into
absolute paths:
    the real location of the system where the file is located, which can be used anywhere in the system. Usually start with "/"
    
Relative paths
    are relative to the current system location A shorthand for a file name, he usually automatically adds the value of "pwd" before the name

2. Related commands
pwd ##print work directory Display the path of the current system location

touch /mnt/file ##Use an absolute path in the Create a file in /mnt/
rm -fr /mnt/file ##Delete the file file in /mnt/ with an absolute path
mv hello /mnt ##Move the current hello file to the /mnt directory
mv /mnt/hello . ##Use an absolute path Move the hello file in /mnt to the current directory

3. Switch the working directory
cd Directory name
cd .. ##Enter the upper directory of the current directory
cd - ##Enter the directory where the current directory was before

4. Display the file
ls
ls -a ##Display all files including hidden files starting with a dot
ls -R ##Recursively display all contents in a directory
ls ##If there is no target behind, the default target is the current directory
ls direcory|filename ##List files or directories Content
ls -d direcotry ##List the directory itself
ls -l filename|dorectory ##List the properties of the contents of the file or directory
ls -ld directory ##List the properties of the directory itself
ls -a ##Display all the contents in the directory , including hidden files starting with "."
ls -R ##The contents of the first display directory


####8.cp file copy####

cp is the process of creating a new file

cp file file1 file2 ... directory ###copy file file1 file2 to directory
cp file test ###create test file template as file
cp -r directory direcotry1 ###copy directory

### # mv move or rename ####

mv of the same disk is to rename, mv of different disks is to copy and delete the process

mv file file1 direcotry ## move file file1 to directory
mv exists file does not exist file ## rename file

mv westos/linux . ##Move linux in westos to the current directory. Represents the current directory


################################
Regular Expression
############## ##########

* ### matches 0 to any character
? ###Match a single character
[[:alpha:]] ###Match a single letter
[[:lower:]] ###Match a single lowercase letter
[[:upper:]] ###Match a single uppercase letter
[[: digit:]] ###match a single digit
[[:alnum:]] ###match a single digit or letter
[[:punct:]] ###match a single symbol

[[:space:]] ### matches a single space

               

{} means non-existent or existing
{1..9} ###1-9
{a..f} ###af
{1,3,5} ###135
{a,c,e} # ##ace
{1..3}{a..c} ###1a 2a 3a 2a 2b 2c 3a 3b 3c

[] means existing
[aC] ###aA bB cC
[ac] ###aA or bB or c
[1-3] ###1 or 2 or 3
[145] ###1 or 4 or 5
[^abc]|[!abc] ###except a and except b and except c

Usage of the cd command

switch path

~ ###The current user's home directory
~username ###The specified user's home directory
~+ ###The current directory
~- ###The directory where the current directory was before

. ###The current directory

.. ###The previous level of the current directory

man ->>manual ###man is the manual abbreviation man

The usage of the man command is generally unclear about the usage of some commands or the parameters that follow. You can check the manual of the command for a detailed explanation.  

 #####View help for man command man passwd     

  ###View help for passwd command

man level
1 system command
2 system interface
3 function library
4 special file, such as device file
5 file
6 game
7 system software package
8 system management command
9 kernel

man 5 passwd ##View the help of /etc/passwd file
man 1 passwd ##View the help of the passwd command, 1 can omit

the shortcut of the man page Up
and down keys ##Up or down
a line pageup|pagedown ##Next screen or up one screen
d|u ##Down or up half screen
G|gg ##Jump the page to the bottom or top of man
/keyword ##Search for a keyword, the keyword will be highlighted, N matches down, N up

q ##Exit help page

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326023574&siteId=291194637