Linux Learning Content

Source: Internet
Author: User

One: basic knowledge of the system
1. What is Linux?
Linux is a free-to-use and free-to-propagate Unix-like operating system, a multi-user, multi-tasking, multithreaded and multi-CPU operating system based on Posix,unix. He can run major UNIX tools software, applications and network protocols. He supports 32-bit and 64-bit hardware, Linux inherits the UNIX design idea of network as the core, and is a stable multi-user operating system.
2. What is a shell?
The shell is an excuse between the user and the Linux operating system.
Two: How to run commands in Linux
1. How do I open the shell?
Click the right mouse button and click Open Terminal.
Enter an action at the command prompt
Three: line prompt meaning
[Kiosk @foundation () Desktop]
Kiosk # #用户
@ # #分隔符
Foundation # #主机短名称
Desktop # # Location of your system
$ # #身份提示符 $ indicates a normal user # represents a super User
Four: The composition of the command
Command parameter target
-S # #单词的缩写
--size # #单词的全拼
V: Virtual Machine management Commands

    1. Rht-vmctl Start Desktop | Server # #开启

      2.rht-vmctl View desktop| Server # #显示

      3.rht-voctl Poweroff Desktop | Server

      VI: Linux system architecture
      Linux is an inverted tree structure
      Everything in Linux is a file.
      These files are at the top of the system directory "/"/is the root directory
      /directory Below is a level two directory these directories are automatically created when the system is installed
      The role of the secondary directory
      /bin # #二进制可执行文件也就是系统命令
      /sbin # #系统管理命令存放位置
      /Boot # #启动分区, responsible for system startup
      /Dev # #设备管理文件
      /etc # #大多数系统管理文件
      /Home # #普通用户的家目录
      /lib # #32位系统库文件存放位置
      /LIB64 # #64位系统库文件存放位置
      /media # #系统临时设备挂载点
      /MNT # #系统临时设备挂载点
      /run # #系统临时设备挂载点
      /OPT # #第三方软件安装位置
      /proc # #系统信息
      /root # #超级用户家目录
      /srv,/var # #系统数据
      /sys # #系统管理, mostly about the kernel
      /tmp # #系统临时文件存放位置
      /usr # #系统用户相关信息数据及用户自定义软件存放位置
      VII: Files and management under Linux
      1. Document creation
      Touch File #建立空文件或者修改时间戳


2. Create a Directory
mkdir # #建立单目录

Mkdir-p # #建立多层目录

3. Deletion of files
Rm-f File # #强行删除文件不提示


Rm-fr Dir # #强行删除目录本身和里面的内容不提示

4. Editing of files
Vim file
Enter file browse mode, cannot edit
Enter <I> Enter insert mode, write character
Press <esc> exit Insert mode when writing is complete
Input: Wq Complete file Edit W indicates write Q indicates exit


5.vim Usage Tips
In browse mode
YY # # vice One whole line

YL # #复制一个字母

YW # #复制一个单词

P # #粘贴

DD # #删除一整行

DL # # Delete a letter

DW # #删除一个单词

CC # #剪掉整行

CL # #剪掉一个字母


CW # #剪掉一个单词


Attention:
Vim enters insert mode when cut
Paste if you want to paste after you press <esc> exit insert mode

U # #撤销


Ctrl + V # #恢复

1. How to add characters in bulk
1) Move the cursor to the column where you want to add the character
2) Ctrl + V into visual mode
3) Select the column to which you want to add characters
4) Press <I> to enter insert mode and write the characters to be added
5) Press <esc> batch add end

2. How to Batch Modify
:%s/original character/modified character/g


: 1,5s/original character/modified character/g

3. How to edit multiple files at the same time
Vim file
: SP file1

注意: 光标默认在哪个文件中就是哪个文件    ctrl+w  按完放开再按上或下可以移动光标所在窗口        ![](http://i2.51cto.com/images/blog/201808/02/c5e90b626855fd2bd920cf27d4bc19e3.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)        ![](http://i2.51cto.com/images/blog/201808/02/afbe6460e6bbcbfa7191bd7091049a01.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)4.vim的退出

Normal Exit method
: Q # #当文件没有做任何修改时可用的

: q! # #文件修改但不想保存时可用



: Wq # #退出保存


: wq! # #文件属于自己或用户为root时可用


Exception exit
When Vim exits abnormally, the. filename.swap file is generated
Found a swap file by the name ". File.swp"
Owned By:root dated:wed 1 02:59:25 2018
Me: ~root/desktop/file
Modified:yes
User Name:root host Name:localhost
Process id:2046
H swap file by the name ". File.swp"
Owned By:root dated:wed 1 02:59:25 2018
Ile 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:
Read-only open discard unsaved data recovery Delete. swp file Exit exit
Go to File

5. File View
Cat File # #输出文件的所有内容

Cat-b File # #输出文件所有内容并加入行号

Less # #分页浏览

Up | Down # #向上 | Move down one line

<pgup>|<pgdn> # #向上 | Move down one page

/keyword # #高亮显示关键字, n matches n up

Q # #退出


Tail-n # #显示文件的后多少行


Head-n # #显示文件的前多少行


#6. File replication
CP sourcefile DestFile # #文件复制


CP sourcefile1 Sourcefile2 destdir/# #复制多个文件到目录中



Cp-r SourceDir destdir/# #复制目录


#7. File movement
MV SourceFile DestFile # #重名命

MV SourceFile Destdir # #移动

MV SourceDir Destdir # #移动目录

MV test/*. ##"." Represents the current directory

#8. File path
1. Relative path
A name for the file relative to the current system location shorthand
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. commands on the path
PWD # #显示当前工作目录

CD # #切换当前工作目录

CD/MNT # #切换到 The/mnt directory

CD-# #进入当前目录之前所在目录中

CD ~student # #进入到student用户家目录

Linux Learning Content

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.