linux--Basic Concepts and operation

Source: Internet
Author: User
Tags touch command

Introduction to basic concepts and operating experiments

The main experiments in this section are:

1, experimental building environment Introduction 2, Common shell commands and shortcut keys 3, Linux use tips

I. Introduction to LINUX Desktop environment

Compared to the current Windows system, Unix/linux itself is no graphical interface, we usually see on the unix/linux distribution of the graphical interface is actually just run on the Linux system on top of a set of software, similar to the Windows95 before the Windows Graphical 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 architecture specification An implementation body, which means that it is a server that implements the X protocol specification to provide a graphical user interface service, just like Apache, which implements the HTTP protocol to provide Web services. If only the server is not able to implement a full desktop environment, of course, we also need a client, we call it the X client, like the following several well-known also the most popular implementation of the client-side desktop environment KDE,GNOME,XFCE ,LXDE, which you see, the lab building is currently used in the XFCE desktop environment, some old users may recall that the experimental building used before the environment is LXDE. This also means that on Linux you can choose to install different desktop environments and even customize your own desktop.

So much here, 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.

Second, the use of Linux desktop environment

If you have any difficulty with the use of the current experimental desktop environment (XFCE), it is recommended that you first learn about the lab building introductory course, and that the use of other desktop environments is beyond the scope of this course, and that interested users can install a full Linux distribution or their Live CD experience on their computers.

For instructions on login password, all default system usernames in lab building are Shiyanlou, password is Shiyanlou

Third, Linux terminal 1.Terminal (terminal)

Usually when we use Linux, we do not deal directly with the system, but through a middle program called Shell, in order to achieve in the graphical interface let us in a window to accept user input and display output, Linux The system also provides a program called Terminal Emulator (Terminal), the following several more common terminal simulators, such as Gnome-terminal,kconsole,xterm,rxvt,kvt,nxterm and Eterm, At present, the terminal program in our experiment is the xfce-terminal that comes with XFCE desktop environment. It is important to note, however, that there is a difference between the terminal (Terminal) and the console (consoles).

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 on, on the physical machine system you can use [Ctrl] + [Alt] + [F1]~[F6] to switch, but in our online experiment environment may not be able to switch, because the Special function button will be hijacked by your host system. When you switch to one of the terminals and want to switch back to the GUI, you can press [Ctrl] + [Alt] + [F7] to complete.

2.Shell

Usually in the graphical interface to the actual experience is not the difference between the different versions of the terminal emulator, and most of the shell (shell), there is the core of the shell, where the kernel refers to the unix/linux core, the shell refers to "provide users with the 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 it also provides a very simple control statement. Under the Windows operating system, some users may never use the shell directly, but under the UNIX family operating system, the shell is still a scripting interpreter that controls system startup, X11 startup, and many other utilities.

In the unix/linux of the popular common Shell has bash,zsh,ksh,csh and so on, Ubuntu terminal default is to use bash, the default desktop environment is GNOME or Unity (based on GNOME), but our environment is used in the zsh and Xfce.

3. Command-line Operation experience

, double-click the icon on the desktop, Xface终端 open the terminal, open the terminal will automatically run the shell program, and then we can enter the command to let the system to execute:

1). Important Shortcut keys:

Before you can really learn the command line, you need to master a few very useful and necessary tips:

[Tab]

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

Of course, not only complete the command, complete the directory, complete the command parameters are no problem:

[Ctrl + C]

Think you have not encountered this situation, when you inadvertently entered a command in the Linux command, or the wrong use of a command, resulting in the terminal you can not expect, for example, only the cursor in the blink can not continue to enter the command, or constantly in the output of a lot of you do not want results. What should you do 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).

Try entering the following command:

$ tail

Then you'll see that your next input doesn't have any reaction, just show what you've entered, and now you can use it Ctrl+c to break the program that you might not know yet. (In the course of the follow-up we will explain exactly tail what this command is)

or enter:

$ find /

Obviously this is not the result you want, you can use the Ctrl+c end.

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, you do not hurry Ctrl+c .

Some other common shortcut keys
Key function
Ctrl+d Keyboard input end or exit terminal
Ctrl+s Tentative current program, pause and press any key to resume operation
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

It's easy to use the arrow keys on your keyboard to restore the commands you've entered before, and you'll know when you try.

3). Learn to use wildcard characters

A wildcard is a special statement that has an asterisk (*) and a question mark (?), which is used 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 will only appear in the command "parameter value" (it does not have 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 treats it as a path or file name to search for a possible match on disk: If a matching match exists, the substitution (path extension) is performed, otherwise the wildcard character is passed as a normal 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 before continuing with the reorganized command until the command is executed.

Use the Touch command first to create 2 files with the suffix txt:

$ touch adsfasd.txt wergjlkas.txt

You can give the file a random name, if after a long time, you have forgotten the file name of the two files, and now you want to find the two text files in your large heap of other files, you can use wildcard characters:

$ ls *.txt

When creating a file, if you need to create multiple files at once, for example:"Love_1_linux.txt,love_2_linux.txt, ... love_10_linux.txt". Very handy in Linux:

$ touch love_{1..10}_linux.txt

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 sring1 or string2 (or more) one string
{c2..c2} Match all characters in c1-c2 such as {1..10}
4). Learn to get help in the command line

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

Manual pages is a common form of online software documentation on UNIX or UNIX-like operating systems. The content includes computer programs (including libraries and system calls), formal standards and conventions, and even abstract concepts. The user can invoke the man page by executing the 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 is a lot of content, involving all aspects of the Linux use process, in order to facilitate the search, is to do a fascicle (sub-section) processing, in the UNIX, BSD, OS X and Linux, the manual is usually divided into 8 sections, 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:

3 printf

All hand albums follow a common layout, which 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 also 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, /<你要搜索的关键字> and after finding you can use the key to switch to the next keyword where the n last keyword is located shift+n . 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 Concepts and 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.