Liunx command! (Command is the most important!)

The article I described command after you can open installed CentOS7 for everyone directly with VMware virtual machine, and then open all the operations Xshell connection on this virtual machine, and then the next can be directly carried out directly in Xshell ( If there is not clear how to connect after CentOS 7 and Xshell friends, you can refer to my previous article installed and connected during this operation, thank you)!
chapter structure:
1.Linux command base
2.Linux command help
3. directory and file basic operation

Shell:
a special program running on the system 1.Linux
2. between user and kernel acts as a "translator"
3. The user login Linux system, automatically load a Shell program
4.Bash Linux system is used by default Shell program
file is located in / bin / bash
Liunx command!  (Command is the most important!)

Linux command classification:
Internal Command:
1. In some special instructions integrated inside the Shell interpreter program, also known as the built-in (Built-in) command
2. Shell part belonging to the
3 not corresponding separate file system
4. Automatic loaded into memory, it may be used as
an external command:
1.Linux system to complete a particular function or binary script file
2. Shell commands belonging to other than the program interpreter
3. each external command corresponds to a file system
4 You must know the file location corresponding to perform after loading from Shell

Environment variables: PATH
position range specification system to recognize the command file is located

General command format:
Liunx command!  (Command is the most important!)
Command word:
1. The entire command is the most critical part
2. uniquely identify a command
Option: Function performed

  1. Short format options: a "-" sign guide (multi-use character options can be combined)
  2. Long format options: a "-" sign guide
    Ls-l ls-a detail view hidden files
    parameters:
    processed 1. The command word
    2 may be a content file name, directory (path) or user name, etc.
    3. the number may be zero or more

Linux command line editing:
Editing auxiliary operations Linux command line:

  1. Tab key: automatically filled
  2. Backslash "\": force a line break
  3. Shortcut Ctrl + U: to empty the beginning of the line
  4. Shortcut Ctrl + K: Clear to end of line
  5. Shortcut Ctrl + L: clear screen
  6. Shortcut Ctrl + C: cancel the edit command

Method of obtaining command help:
internal command Help
1. View Bash internal command help information
"--help" option command
1. applies to most external command
① using the man command to read the manual page
② Use "↑", "↓" the direction of scrolling text
③ using Page up and Page Down keys flip
④ press Q or q to quit reading environment, press "/" key to find content

View the current working directory -pwd
1. Display user's current working directory: pwd
Example: [root @ localhost ~] # pwd / root ( where the current directory is the root)
2. handover working directory -cd
① the user's working directory change to a different location:
switching to a target location: cd destination
without specifying a target position, switch to the current user's home directory: cd ~, cd ..
change to the directory where the last execution before the cd command: cd -
② absolute path : the "/" is the absolute path
③ relative path: there is no "/" is the relative path

Relative manifestations path:
Liunx command!  (Command is the most important!)

List shows the contents of a directory -ls
1. display the contents of the directory, including subdirectories and files related to attribute information
Liunx command!  (Command is the most important!)
2. Common options:
the -l: detailed display
-a: show hidden files
-A:
-d:
-h: friendship with units show
-R: recursively display
--color: color
3. combination wildcards:
"?": match the file name of an unknown character
"*": matches any number of characters in the file name

Common file formats:
1. Black: Data File
2. Green: Executable
3. Red: archive
4. Blue: directory (folder)
5. Sky Blue: soft-linked files (shortcuts)
6. Peach red: pictures

设置别名-alias
通过别名机制简化常用的、比较长的命令:alias命令别名=命令
示例:设置myls为ls-alh的别名:alias myls= ‘ls-alh’

统计目录及文件空间占用情况-du
1.统计指定目录(或文件)所占用磁盘空间的大小
Liunx command!  (Command is the most important!)
2.常用选项:
-a:统计磁盘空间占用时包括所有的文件,而不仅仅只统计目录
-h:以更人性化的方式(默认以KB计数,但不显示单位)显示出统计结果
-s:只统计所占用空间总的(Summary)大小,而不是统计每个子目录,文件的大小

创建新目录-mkdir

  1. 创建新的空目录
    Liunx command!  (Command is the most important!)
  2. 示例:
    在当前目录下创建名为public_html的子目录:mkdir public_html
    创建目录/aa,在/aa目录下创建子目录bb,在/aa/bb目录下创建子目录cc:
    mkdir -p /ss/bb/cc

创建空文件-touch命令:
1.更新文件的时间标记
2.经常用语创建多个新的空文件:
Liunx command!  (Command is the most important!)

创建链接文件-ln
为文件或目录建立链接文件,类似于Windows系统的快捷方式
一般分为软链接和硬链接两种,以下是不同之处:
Liunx command!  (Command is the most important!)

复制文件或目录-cp
1.将需要复制的文件或目录(源)重建一份,并保存微信的文件或目录
Liunx command!  (Command is the most important!)
2.常见选项:
-f:覆盖目标同名文件或目录是不进行提醒,直接强制复制
-i:覆盖目标同名文件或目录时提醒用户确认
-p:复制时保持源文件的权限、属主及时间标记等属性不变
-r:复制目录是必须使用此选项,表示递归复制所有文件及子目录

删除文件或目录-rm
删除指定的文件或目录:rm[选项] 要删除的文件或目录
常用选项:
-f:强制删除
-i:提醒删除
-r:递归(连同子目录一同删除)
示例:
1.rm rf public_html/grub/
2.rm -I public_html/apg.conf

移动文件或目录-mv
将指定的文件或目录转移外置
如果目标位置与源位置相同,则相当于执行重名操作:
Liunx command!  (Command is the most important!)
示例:
1.mv mytouch mkfile
2.mv mkfile public_html/

查找命令/文件存放目录-which
搜索范围由环境变量PATH决定(echo$PATH):which 命令|程序名
或:which-a 命令|程序名
示例:

  1. Which ls
  2. Which cd

Find the file or directory -find2-1
commonly used search criteria Type:
1. Find by name: -name
"?" ① searches in the name of the target file, and allows the use of "*" wildcard and
2. Find based on file size: -size
① according to find the target file size
② general use "+", "-" was set more than or less than the specified size as the search condition, the capacity of the unit comprises a common kB (k note lowercase), MB, GB

  1. By file owner to find: -user:
    ① to find the target users based on whether the files belong
  2. Find by file type: -type:
    ① to find the type of file
    ② file types include regular files (f), the directory (d), a block device file (b), a character device file (c) etc.
    ③ block device refers to block data reading device (e.g., hard disk, memory, etc.), refers to devices character devices (e.g., buttons, a mouse, etc.) to read data by a single character

Using the find command to achieve a plurality of search conditions
using the logical operators between the expressions:
.. 1 "- A" and indicates (and)
2 "- O" represents or (or).
Example:

  1. find/boot-size +1024k-a -name“vmlinuz*”
  2. find/boot-size +1024k-o -name“vmlinuz*”

These are the most basic linux operating command, white can learn together, if you want to recall the great God who can also come and see, thank you!

Guess you like

Origin blog.51cto.com/14464303/2428481