Linux Basics (Linux commands)

Source: Internet
Author: User
Tags file copy

Before introducing the Linux system, let us introduce the 5 major components of the computer: Calculator, register, CONTROLLER, IO output/input device.
First, Linux
Linux is the kernel of a system, and it is the core condition that the system can run.

Shell: It is a protective layer of the system, you can understand it is a shell, it protects the kernel, any command must first communicate with it, in order to communicate with the kernel, it ensures the security of the core system and the normal exchange of the outside world.
Second, run the command in Liunx
1, in the root directory (that is, we start to see the interface, can also be called desktop) right mouse button, open in Terminal, pop-up command input box, that is, Shell.

2, enter the user name and password to log in (the password default is empty), the successful landing can be used

What the line prompt means: [[email protected] ~]$ ^c
Kiosk Users
@ delimiter
Foundation22 Main segment Name
~ The location of your system
$ $ for normal user #代表超级用户 (with highest privileges)
3, the composition of the order
Command parameter target
-S represents the abbreviation for a word
--size represents the whole word
Three, virtual machine management commands

通常使用虚拟机进行操作,防止不小心删除linux的重要文件,在虚拟机里面可以随便操作,如果出现问题只需重置虚拟机即可,非常方便。 1、rht-vmctl    start       desktop \server   开启

2、rht-vmctl poweroff    desktop\server   关闭 3、rht-vmctl    view        desktop \ server      显示


Mouse click Not listed? Use Superuser login account default is root, password default is Redhat

4. Rht-vmctl reset desktop \ Server Reset
IV. structure of the Linux system
1, Linux system is a inverted tree structure

2, 2 levels of the role of the directory
/bin--------------------------binary files, System general commands
/boot--------------------------system boot partition, file read at system startup
/dev--------------------------device files
/etc---------------------------Most configuration files
Home directory------------------------a normal user
/lib----------------------------32-bit function library
/LIB64--------------------------64-bit Library
/media-----------------------Manual Temporary mount point
/mnt---------------------------Manual Temporary mount point
/OPT---------------------------third-party software installation location
/proc--------------------------Process information and hardware information
/root--------------------------Super User home Directory
/run----------------------------The default mount point for temporary devices
/sbin--------------------------System Administration commands
/srv---------------------------Data
/var-----------------------------data
/sys----------------------------kernel-related information
/tmp-----------------------------temp file
/usr------------------------------user-related settings
Five, the file management under Linux
1. Document creation
Touch file to create an empty file, or to modify a file's timestamp
Touch File1 File2

2. Create a Directory
mkdir Creating a single directory


Mkdir-p building a multi-level catalog

3. Deletion of files
Rm-f file forcibly deleting files without prompting


Rm-fr dir forcibly deletes the directory itself and the contents of the content

4. Editing of files
Vim file
After entering the file is browse mode, cannot edit
Enter <I> Enter insert mode, write character
Press <ESC> exit Insert mode when writing is complete
Input: Wq complete file editing. W indicates write, q exits
Vi. using the VIM technique
In browse mode
1. Large character Management
(1), copy operation
YY Copy a whole line
YL Copy a letter
YW copy a word
P Paste
(2), delete operation
DD Delete a whole row
DL Deletes a letter
DW Delete a Word
(3), cutting operation
CC cut off the whole line
Cl
cw
Attention:
When the cutter is cut, vim goes into insert mode,
If you want to paste you need to press <esc> exit Insert mode and then paste

U undo
Ctrl+r Recovery

2. batch processing of characters

Ctrl + V # #进入可视化模式, you can select characters in bulk and manipulate them in visual mode

How to bulk Add characters
(1) Move the cursor to the column where you want to add the character
(2) Ctrl + V Enter visualization mode
(3) Select the column where you want the home character
(4) Press <I> to enter insert mode and write the characters to be added
(5) Press <ESC> batch add end


After operation

How to Batch Modify
:%s/original character/modified character/g
: 1,5s/original character/modified character/g
3. How to edit multiple files simultaneously
Vim file
: SP file1

After editing:

Attention:
The cursor is the file that is operated by default in that file.
Ctrl+w Press to move the cursor in the window
4. Vim's exit

Normal Exit method
: Q # #当文件没有做任何修改是可用
: q! # #当文件修改但不行保存修改时可用
: Wq # #退出保存
: wq! # #当文件属于自己或用户为root时可用
Exception exit
When Vim exits abnormally, the. filename.swap file is generated
When this file appears, VIM works abnormally

Found a swap file by the name ".file.swp"  <<<异常退出未保存的数据      owned by: root   dated: Wed Aug  1 02:59:25 2018me: ~root/Desktop/file      modified: YES     user name: root   host name: localhost    process ID: 2046h swap file by the name ".file.swp"      owned by: root   dated: Wed Aug  1 02:59:25 2018ile opening file "file"Swap file ".file.swp" already exists![O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:只读打开      放弃未保存数据  恢复      删除.swp文件  退出    退出                 进入文件

Enter Yes to enter data before operation

5. File View
All contents of the Cat file output file
Cat-b file output All contents and add line number

less        分页浏览

Top | down | Move one line down

<pgup>|<pgdn> up | Move one PAGE DOWN

/keyword highlighting keyword, n matching n up match

Q exit

Tail-n display the number of lines after the file

Head-n shows the number of lines before a file
6. File copy
CP sourcefile DestFile # #文件复制
CP sourcefile1 Sourcefile2 destdir/# #复制多个文件到目录中
Cp-r SourceDir destdir/# #复制目录
7. Movement of files
MV sourcefile (source file name) destfile (modified file name)----names
MV sourcefile (source file) Destdir (target directory)-----Mobile
MV SourceDir (source directory) Destdir (destination directory)-----Move Directory
MV test/ . "." Represents the current directory
Note:
there is a space between and.
8. File path
(1), relative path
A name for the file relative to the current system location (you can also understand the location of the file you are manipulating relative to your current directory, that is, starting at your location and looking for the target file)
The file name omits the value of the current path
Available only when you are currently in this directory
File name does not start with/
The file name will automatically be added to the ' PWD ' Display path in the word match either

(2), Absolute path
is the real location of the file in the system
The name of a file can be accurately represented at any time
File name starts with/
9, 9. commands on the path
PWD-----------------Show Current working directory
CD-------------------switch Current working directory
CD/MNT------------Switch to the/MNT directory
cd------------------into the directory before the current directory

    1. CD ~student------into the student user home directory

Linux Basics (Linux commands)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.