First, the basic knowledge of Linux

Source: Internet
Author: User
Tags builtin

Linux the philosophical Thought

1 , all documents;
Organize almost all resources, including hardware devices, into file formats;
2 , consisting of numerous single-purpose small programs;

A program to implement only one function, and to do a good job, the combination of small programs to complete complex tasks;

3 , try to avoid interacting with the user;
Objective: To implement script programming to automate certain functions;
4 , using plain text files to save configuration information;
Target: A text programmer used to complete the system configuration work;
5 , provide a mechanism, rather than a policy
The strategy is relatively lived and only the mechanism endures. Most programming problems can be cut into two parts: what functionality is required (mechanism) and how to implement these functions (strategy).

First, the terminal type of Linux

The so-called terminal, is the user interaction with the host, it is necessary to use the device. There are a number of terminal types in Linux, mainly in the following categories:
Physical Terminal(pty): Direct access to the computer's display and keyboard equipment;/dev/console
Virtual Terminal(tty#): A terminal that is attached to a physical terminal and is implemented in a virtual software way .CentOS6default startup6a virtual terminal. Use the command:Ctrl+alt+f[1-6] can be switched between the various terminals.
Graphical Terminal: A terminal that is attached to the physical terminal in a virtual implementation of the software, but provides an additional desktop environment; Device file path:/dev/tty#Toggle Command:Ctrl+alt+f7
Analog Terminals(pts): Also known as perjury terminal, open command line interface under graphical interface, based onSSHAgreement ortelnetprotocols such as remote open interfaces, device files:/dev/pts/# [0,oo]
to view the current Terminal Equipment command:TTY

[Email protected] ~]# tty/dev/pts/0 #模拟终端

View all users who are logged on on the current system and their information: W.H.O.

[[email protected] ~]# whoroot tty1 2017-03-04 00:03root pts/0 2017-03-04 00:19 (192.168.191.2)

second, interactive interface (Shell)
The so-called interactive interface, refers to the terminal after the start, attach an interactive application on the end device. Interfaces have graphical interfaces and command-line modes. The representative application software for both interfaces is:

GUI (graphical user Interface)

Graphical user interface

x Protocol, window manager, desktop

desktop:gnome (C, GTK) kde (c+ +, QT)

xfce ( Lightweight desktop )

CLI (Command-Line interface)

Command line interface

sh (bourn) , CSH , tcsh , Ksh (Korn) , Bash (Bourn again shell) follows the GPL protocol , zsh

To view the shell's commands:

[Email protected] ~]# echo ${shell} #查看当前使用的shell/bin/bash [[email protected] ~]# Cat/etc/shells #查看当前系统所 Some shell/bin/sh/bin/bash/sbin/nologin/bin/dash/bin/tcsh/bin/csh

Third, the use of command help
in Bash , the commands are divided into two types, the built-in command and the external command:
Built-in commands: commands implemented in shell programs are built-in commands;
External command: There is an executable file corresponding to the command name in a location on the file system;
The command type can be judged using the type command.

[[Email protected] ~]# type -a cdcd is a shell builtin[[email  protected] ~]# type catcat is hashed  (/bin/cat) [[email protected]  ~]# man builtin     #查看所有内置命令BASH_BUILTINS (1)                                                  bash_builtins (1) name       bash, :,  ., [, alias, bg, bind, break, builtin, caller, cd, command,  compgen, com-       plete, compopt, continue,  declare, dirs, disown, echo, enable, eval, exec, exit,        export,faLse, fc,fg, getopts, hash, help, history, jobs, kill, let, local,  logout,       mapfile, popd, printf, pushd,   pwd,  read,  readonly,  return, set, shift, shopt,        source, suspend, test, times, trap, true,type,  typeset, ulimit, umask, unalias,       unset,  Wait - bash built-in commands, see bash (1) ...

to view the path to an executable file : Which, Whereis. where the which command is to find out whether a command exists, and where the command is stored. The Whereis command can only be used to search for program names, and only binary files, man description files, and source code files are searched.

[email protected] ~]# which vim/usr/bin/vim[[email protected] ~]# which cat/bin/cat[[email protected] ~]# Whereis Vimvim: /usr/bin/vim/usr/share/vim/usr/share/man/man1/vim.1.gz

in the shell, the methods for getting internal command help are: #help COMMAND

[[email protected] ~]# type cdcd is a shell builtin          #cd为内置命令 [[email protected] ~]# help cd      #可使用此方法获取cd: cd [-l|-p] [dir]    change the shell  working directory.        change the current  Directory to dir.  the default dir is the value of the     home shell variable.        the  variable CDPATH defines the search path for the directory  Containing    dir.  alternative directory names in cdpath  are separated by a colon  (:).     a null directory  name is the same as the current directory.  if dir begins     with a slash  (/), then cdpath is not used.         if the directory is not found, and the shell  option  ' Cdable_vars '  is set,    the word is assumed  to be  a variable name.  if that variable has a  value,    its value is used for DIR.         Options:        -L       force symbolic links to be followed         -P      use the physical directory  Structure without following symbolic        links         The default is to follow symbolic links, as if  '-l '   were specified.        exit status:     Returns 0 if the directory is changed; non-zero otherwise. [[email protected] ~]# type vimvim is /usr/bin/vim              #vim不是内置命令 [[email protected] ~]# [[email  protected] ~]# help vim      #使用此方法获取帮助时报错-bash: help: no  help topics match  ' vim ' .  try  ' help help '  or  ' man -k  vim '  or  ' Info vim '.

There are many ways to get help for external commands, which are commonly used in the following ways:
(1) # COMMAND--help

(2) user manual (manual) # Man COMMAND
(3) Information page # info COMMAND

(4) The program's own Help document README, INSTALL,
(5) procedure Official document: Documentation
(6) Official documents of the release version

Iv. Help Manual Manual

The built-in Help manuals in Linux feature a very rich function which can be divided into eight chapters. The main functions of each chapter are:

1 User Commands

User commands (/bin,/usr/bin,/usr/local/bin)
2 System Calls System calls
3 C Library Functions Library users
4 Devices and Special Files Special files (device files)
5 File Formats and conventions File format (configuration file syntax)
6 games et. Al. Game
7 Miscellanea Miscellaneous
8 System Administration Tools and Deamons Management commands (/sbin,/usr/sbin,/usr/local/sbin)

When using the man command, the command options are likely to have different characters such as <>, [] and so on, the meaning of which is:
<>: Required []: Optional ... : can appear multiple times |: Multiple selection One {}: Grouping

IP (8)                                  Linux                                 ip (8) name        ip - show / manipulate routing, devices, policy routing  and tunnelsSYNOPSIS       ip [ OPTIONS ]  object { command | help }       object :=  { link | addr | addrlabel | route | rule | neigh  | tunnel | maddr | mroute                | monitor }       options := { -v[ersion] |  -s[tatistics] | -r[esolve] | -f[amily] { inet | inet6 |                ipx | dnet  | link } | -o[neline] }       ip link  set device { up | down | arp { on | off }  |               promisc  { on | off } |                allmulticast { on | off } |                dynamic { on | off  } |   &nbSp;           multicast { on | off  } |                txqueuelen packets |                name NEWNAME |                address LLADDR | broadcast LLADDR |                mtu MTU |                netns PID |                alias NAME |                vf NUM [ mac  Lladdr ] [ vlan vlanid [ qos vlan-qos ] ] [ rate txrate ] [                spoofchk { on |  off } ] |  }

The meaning that the man command represents at the beginning of each paragraph:

Name: command names and features brief description

Synopsis: Usage notes, including available options
DESCRIPTION: A detailed description of the command function, which may include the meaning of each option
Options: Explaining the meaning of each option

Files: The configuration file associated with this command

EXAMPLES: Using the example

See ALSO: Another reference

The man command gets help after the flip screen method:

Turn back one screen: SPACE forward one screen: b
To turn one line backwards: ENTER One line forward: K
Find:/keyword: Backward N: Next N: Previous
? KEYWORD: Forward N: Next N: Previous
Configuration file for man command:/etc/man.config
Manpath/path/to/somewhere: Indicates the new manual file search location
Man-m/path/to/somewhere Command: Searches the command command's hand pages to the specified location and displays

V. Document System Standard FHS
When logging in to Linux, look at the files under its root directory designed to follow certain design criteria FHS (FileSystem Heirache Standard), the main functions of each directory are:

/bin: Executable file, user command, single user can also operate/sbin: Manage commands, set system environment, boot process required/usr/bin/usr/sbin General system commands/usr/local/bin/usr/local/sbin General Third party installation/ Boot: System boot related files, such as kernel, INITRD, and Grub (bootloader)/dev: Device files:/etc: Configuration file directory/ect/sysconfig: System level application Configuration/ETC/INIT.D: System service Script/ Home: The user's home directory, each user's home directory is usually default to/home/username/root: The administrator's home directory;/lib: library file Static Library:. A dynamic library:. dll,. So (Shared object)/lib/modules: Kernel Module file/media: Mount point directory, typically used to mount a mobile device/mnt: mount point directory, mount additional storage devices/OPT: Optional directory, installation directory for third-party programs/proc: Pseudo file system, kernel map file/sys: Pseudo file system, property mapping file related to hardware device /SRV: Provide data storage location for service/usr:shareable, read-only data/tmp: Temp file,/var/tmp/var: Changeable file

Vi. file attributes and types

When you use the command ' ls-l ' to view a directory or file, you can display details about that directory or file. The information that each field represents is:

[[email protected] home]# Ls-ld sambadrw-r--r-x 2 500 500 4096 April Samba[[email protected] day01]# ls-l info.txt -rw-r--r--1 root root 48 February 18:54 Info.txt

The first character represents the metadata information that represents the type of file, and the main types of files are: (-)

-: Normal file (f)

D: Catalog file
L: Symbolic Link files (symbolic link file)

P: Command pipe file (pipe)
C: Character device file (character)

B: Block device files (blocks)
S: Socket file (socket)

The second character to the tenth character, these nine characters represent the permission information for the file (rw-r--r--)

Each 3-bit group, each group: rwx (Read, write, execute)-Delegate no permissions

Number represents the number of hard links to a file (1)

Owner (root) of the file
The genus Group (root) of the file
File size (size), in bytes (24)
Timestamp (timestamp): The last modified time is displayed by default

Access: Access

Modified: Modify, the file content has changed
Changes: change, metadata changes

This article is from the "Wind and Drift" blog, please be sure to keep this source http://yinsuifeng.blog.51cto.com/10173491/1903050

First, the basic knowledge of Linux

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.