linux--Basic Operation

Source: Internet
Author: User

1.Linux Desktop Environment Introduction

Compared to the current Windows system, Unix/linux itself is not a graphical interface, we usually see on the unix/linux distribution of the graphical interface is actually only run on the Linux system on a set of software, similar to the WINDOWS95 before the Windows graphics The interface is just a set of software that runs in a DOS environment. The software on Linux was previously XFree86, and now is xorg (x.org), and the software is implemented through the X Window System (also known as X11 or X), and x itself is just a toolkit and architecture protocol, and Xorg is the X-frame An implementation of the specification, which means that it is a server that implements the X protocol specification and provides a graphical interface service, just like Apache, which implements the HTTP protocol to provide Web services. If only the server is not able to achieve a full desktop environment, of course, also need a client, we called X client, like the following several well-known and the most popular implementation of the client-side desktop environment Kde,gnome,xfce,lxde.

There are so many, mainly to help you better understand the Linux desktop environment is a kind of concept, and it is different from the Windows operating system desktop, actually there is an essential difference between them, hoping to clear these content can let you ignore those experience differences, focus on the focus on The Linux system itself or one of the technologies you are preparing to learn, the content behind this lab and the other courses in the lab building are designed to help you achieve these two goals.

The terminal essentially corresponds to the Linux/dev/tty device, Linux multi-user login is done by different/dev/tty devices, Linux default provides 6 pure command line Interface "Terminal" (it should be accurate that this is 6 virtual Consoles) to let the user log in. On the physical machine system you can switch by using [Ctrl] + [Alt] + [F1]~[F6]

It is not the various terminal simulators of the different distributions mentioned above that often make a difference in the actual experience in the graphical interface, but rather the shell (shell). The core of the shell is the Unix/linux kernel, the shell refers to the "user Interface" software (command parser), similar to DOS commands (command line) and later Cmd.exe. A shell in the ordinary sense is a program that can accept user input commands. It is called a Shell because it hides the underlying details of the operating system. The graphical user interface under the same Unix/linux GNOME and KDE are sometimes referred to as "virtual shells" or "graphic shells."

The Shell under the Unix/linux operating system is both an interface for user interaction and a scripting language for control systems. This, of course, differs from the command line under Windows, although the command line also provides a very simple control statement. Under the Windows operating system, some users never use the shell directly, but under the UNIX family of operating systems, the shell is still a scripting interpreter that controls system startup, X11 startup, and many other utilities.

The common Shell that is popular in Unix/linux is bash, zsh, Ksh, CSH, and so on, the Ubuntu terminal uses bash by default, the default desktop environment is GNOME or Unity (based on GNOME), but our environment uses ZS H and Xfce.

In Linux, the most important is the command, which contains 2 processes, input and output

Input
The input of course is to open the terminal, and then press ENTER, and then press ENTER, the input format is generally this kind of

/etc/#查看当前所在目录pwd
    • Output
      The output returns the results you want, such as what files you want to see, and returns the contents of the file. If it's just execution, execution failure will tell you what's wrong, and if the execution succeeds then there will be no output, because the philosophy of Linux is: No result is the best result
1) Important shortcut keys:

Before you can really learn the command line, you need to master a few tips that are very useful and must be mastered:

[Tab]

Use the Tab key to complete the command, the Tab key is usually next to the letter Q , this technique brings you the greatest advantage is that when you forget the full name of a command can only enter a portion of its beginning, and then press the Tab key can be prompted or help to complete

[Ctrl + C]

Think you have encountered this situation, when you inadvertently entered an unknown command on the Linux command line, or mistakenly used a command, resulting in the terminal you can not expect, for example, only the cursor on the screen can not continue to enter the command, Or you're going to have to output a whole bunch of results you don't want. What if you want to stop immediately and return to your controllable state? At this point you can use Ctrl+c the key to forcibly terminate the current program (you can rest assured that it does not cause the terminal to exit).

Although this is easy to press, but do not casually press, because sometimes when you see the terminal does not have any reaction or prompt, also can not accept your input, may just run the program needs you to wait patiently, do not rush to press Ctrl+c .

Some other common shortcut keys
Key function
Ctrl+d Keyboard input end or exit terminal
Ctrl+s Pause the current program, pause and press any key to resume running
Ctrl+z Put the current program in the background to run, revert to the foreground commandfg
Ctrl+a Move the cursor to the input wardrobe equivalent to the Home key
Ctrl+e Moves the cursor to the end of the input line, equivalent to the End key
Ctrl+k Remove from cursor position to end of line
Alt+Backspace Delete a word forward
Shift+PgUp Scroll the terminal display up
Shift+PgDn Scroll down the terminal display
2) Learn to use historical input commands

Very simple, you can use the keyboard in the direction of the key to restore the command you have entered previously, you try to know.

3) Learn to use wildcard characters

A wildcard is a special statement that has an asterisk (*) and a question mark (?) to make a fuzzy match to a string (such as a file name, parameter name). When you look for a folder, you can use it instead of one or more real characters, and you often use wildcards instead of one or more real characters when you don't know the real characters or are too lazy to enter the full name.

The wildcard character entered in the terminal is handled by the shell, not by the command statement involved, it only appears in the command's "parameter value" (it cannot appear in the command name, the command does not remember, then use the Tab completion). When the shell encounters a wildcard character in the parameter value, the shell searches for a possible match on disk as a path or file name: If a matching match exists, then the substitution (path extension) is performed, otherwise the wildcard character is passed as a normal characters to "command" and then processed by the command. In short, a wildcard is actually a kind of path extension that the Shell implements. After the wildcard is processed, the shell completes the reorganization of the command, and then continues to process the reorganized command until the command is executed.

Shell Common wildcard characters:

character meaning
* Match 0 or more characters
? Match any one character
[list] Match any single character in the list
[!list] Matches a character other than any single character in the list
[c1-c2] Match any single word in c1-c2 such as: [0-9] [A-z]
{string1,string2,...} Match string1 or string2 (or more) one string
{c1..c2} Match all characters in c1-c2 such as {1..10}

4) Learn to get help from the command line

In a Linux environment, if you encounter difficulties, you can use man the command, which is Manual pages the abbreviation.

Manual pages is a common form of online software documentation in UNIX or UNIX-like operating systems, including computer programs (including library and system calls), formal standards and practices, and even abstract concepts. The user can invoke the manual page by executing a man command.

You can get a detailed description of a command and how to use it in the following ways:

$ man <command_name>

For example, if you want to see how the man command itself is used, you can enter:

man man

Normally, the contents of the Man Handbook are in English, which requires you to have a certain foundation in English. The man manual contains a lot of content, covering all aspects of the Linux use process. In order to facilitate the search, the man manual has been processed in fascicle (sub-section), which is usually divided into 8 sections in the work of the UNIX, BSD, OS X and Linux, and is arranged as follows:

Section Description
1 General Command
2 System calls
3 Library functions, covering the C standard function library
4 Special files (usually devices in/dev) and drivers
5 File formats and conventions
6 Games and Screensavers
7 Miscellaneous
8 System administration Commands and Daemons

To view the contents of the corresponding section, add a number to the corresponding section after the man, as follows:

$ man 1 ls

The Command man page in the first section is displayed ls .

All hand albums follow a common layout that is optimized for simple ASCII text display, which may not have any form of highlighting or font control in this case. The following sections are generally included:

Name (title)

The name of the command or function followed by an introduction to the line.

Synopsis (Summary)

For the command, formally describe how it runs, and what command line parameters are required. For a function, describe the parameters required for the function, and which header file contains the definition of the function.

DESCRIPTION (note)

A textual description of the function of the command or function.

EXAMPLES (example)

Some examples are commonly used.

See ALSO (cf.)

A list of related commands or functions.

There may be other parts of the content, but these parts are not standardized across manual pages. Common examples include options (option), exit status (Exit State), Environment (Environment), BUGS (Program Vulnerability), files (file), AUTHOR (author), REPORTING BUGS (known vulnerability), History and Copyright (copyrights).

There are usually a lot of things in the Man Handbook, you may not be easy to find the results you want, but fortunately you can use the search in Man /<你要搜索的关键字> , you can use the n key to switch to the next keyword where the shift+n last keyword is located. Use Space (SPACEBAR) to page, Enter (enter) scroll down one line, or use j , k (Vim Editor's move key) to scroll backward one line forward. Press the h key to display the use Help (because man uses less as the reader, which is actually less the tool's Help), press q exit.

For more detailed help, you can also use info commands, but man it is often enough to use them. If you know the purpose of a command, just want to quickly see some of its specific parameters of the role, then you can use --help parameters, most of the commands will have this parameter, such as:

$ ls --help

linux--Basic Operation

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.