Getting Started with Linux bash learning

Source: Internet
Author: User
Tags clear screen time and date

First, understand the computer hardware components:

Von. Neumann architecture defines the computer has the arithmetic, the controller, the memory, the input device, the output device five major parts, also has one principle is: must be the binary program to be able to run in the system, it can only process the binary file. Therefore, the source code of the program needs to be compiled into binary.



Second, the Linux philosophy thought:

1. Everything is a file (including hardware)

2, small, single-use procedures

3, link the program, together to complete the complex task

4. Avoid confusing user interface

5. The configuration data is stored in the text


Third, understand the ABI and API:

ABI: Application Binary interface.

API: An interface for the application to do development.

Windows vs. Linux:

1) The suffix of the Windows binaries is. exe, and Linux is run directly without the suffix name. 2) Windows and Linux binaries do not work with each other.



Command format:

COMMAND [Options] [arguments parameters]

Parameters: The object of the command, such as file name, user name, etc.


Note: 1, multiple options, and multiple arguments and commands are delimited by using white space characters

2, Cancel and end the command execution: CTRL + C; Ctrl+d

3. Multiple commands can be used; separate symbols

4, a command can be divided into multiple lines




Four, Bash command:


  • WHOAMI: See who the current user is.

  • Who: View all logged on users of the current system

  • CHVT #: Command switch terminal operator Interface (#, for 1 o'clock, switch to the graphical interface; 2-6, switch to the character command interface), the graphical interface is not closed.

  • Init #: Command to turn off and on Terminal graphical interface (#, for 3 o'clock, is to completely turn off the graphical interface; for 5 o'clock, the graphical interface is turned on; for 0 o'clock, the machine terminal is turned off; for 6 o'clock, the machine restarts, equivalent to reboot)

  • DF: View partition Mount relationship

  • Tar xvf: Decompression command for compressed files

  • CTRL + C: Cancel command execution

  • Ctrl+l: Clear Screen

  • Free: View memory status

  • LSCPU: Viewing the CPU situation

  • LSBLK: Viewing partitions and mount points

  • #cat/etc/proc/meinfo: View memory usage.

  • #logout/#exit/ctrl+d: User exits the current login

  • File: View files Type

  • Clear: Clears the screen

  • id-u; View the system number of the current user

  • Id-u name; View the number of the specified user in the system

  • TTY: View current terminal equipment

  • W; View details of all currently logged on system users (with their actions being performed)

  • Ll/bin/sh: View the shell of SH

  • echo $SHELL: View the default SHELL used by the system

  • Cat/etc/shell: Viewing the system-supported shell

  • PS1: Defining a prompt

  • echo $PS 1: Display the format of the prompt

  • Ll-h FileName: View information such as the size of the specified file

  • Type command: Determines whether the command belongs to an internal command or an external command

  • echo $PATH: View external Command store location information

  • Which command: View the path of the external command

  • Hash: View external command usage records in the cache (list)

  • hash-d command: Delete the records in the cache

  • Hash-r command: Delete records from all commands in the cache

  • Enable-n command: Disable the use of internal commands

  • Enable command: Enabling the use of internal commands

  • Whereis command: Not only outputs the location of commands, but also outputs the location of the Help file where the command is stored.

  • Date, display time and date, or command correction time, in the form of # Date month, hour and year. seconds

  • Date-u: Show Green Time

  • Hwclock; display hardware clock

  • Clock: Display hardware clock

  • Clock-w: Calibration of the system clock, whichever is the hardware clock

  • Clock-s: Calibrate the hardware clock, whichever is the system clock

  • Cal; Show Calendar

  • Nano: Text Editing

  • Screen-s Help: The user makes a request, helps can be any name

  • Screen-x Help: The user is asked to accept help (exit and close screen, execute exit; Peel the current screens, execute CTRL + A and then press D, let the execution of the program in the background, you can free up the interface Perform other actions)

  • Screen-ls: Displays all screens that are already open

  • Screen-r: Restore a screen

  • PS aux: View the process program of the system

  • Screen: Executes the command, which can be performed over a long period of time (in order to avoid a network outage causing the task to fail), allowing the required tasks to be performed in the system background




Specific use of Echo:

  • echo; what's behind the command is output directly

  • Echo-n: The command does not wrap after the content output is executed

  • echo $PATH: The value of the output display (the store path of the external command) variable

  • $PATH: is a variable in which the $ symbol has a special meaning; if echo \ $PATH or echo ' $PATH ', then \ and ' translate the variable into a string for output display

  • "" (double quotation marks) if referenced; ' (single quotation mark) strong reference; ' (inverted single quote) command reference, as in the usage of $ ()

  • Echo-e "String \c" is the output string compression does not wrap, its use effect is the same as the Echo-n "string"

  • Echo-e "String \a" the string (can be empty) when the output is complete, the computer emits a warning sound

  • Echo-e "string \b String" when the string output is complete, the string preceding the \b is replaced by one character (\b Backspace key function) by the following string

  • Echo-e "string \ R string" The string (which can be empty) after the output is complete, the string after \ r replaces the preceding character with the character from the beginning of the line

  • Echo-e "string \ t string" Insert tab function directly in two strings, two string spacing becomes larger

  • Echo-e "string \ \ String" Between two strings, the function is replaced from the beginning of the previous string, and the same as the effect of \ r

  • Echo-e "\0###": # # #表示八进制的ASCII字符

  • Echo-e "\033[43;31m ABCD \033[0m": Starts with \033[and ends with \033[, with the effect of outputting the character ABCD with the background and foreground color




Five, the use of system terminal and simple modification configuration:


Terminal:

1, the server non-essential parts

2, the user and the host to interact with the necessary equipment

3, Graphics Terminal: belongs to the virtual terminal, attached to the physical terminal on the virtual implementation of the software way of the terminal, but additional will provide desktop environment

4, Analog terminal: graphical interface open command line and based on the SSH protocol or Telnet protocol, such as remote Open Interface, device files (/dev/pts[0-infinite])

5, Virtual Terminal: attached to the physical terminal on the virtual implementation of the terminal, the device file path (/dev/tty#); CentOS6 default boot 6 virtual terminal, switch mode is ctrl+alt+f#[1-6]



The CentOS Terminal interface Toggle Shortcut:

ctrl+alt+ (F2-F6), switch to the character command line operator interface (this operation needs to be done on the system terminal).

CTRL+ALT+F1, switch to the graphical desktop operator interface (this operation needs to be done on the system terminal).


If a machine-installed Linux system is desktop-free, there are 5 virtual terminals, all of which are character virtual terminals.


CentOS6 's Desktop tips:

ALT+F2, open a Windows-like Run window (enter #free the fish on the command line, and a small fish appears on the screen).



CentOS6 and Windows File transfer:

If you need to drag files under Windows directly to the Linux (interface) on your virtual machine, you will need to install VMware Tools to have vmware worksation download, wait for the download to complete, choose to cancel its installation option, and mount the file directly on the LI Nux system on the optical drive. Execute the DF command to view the Mount relationship, and its ISO file is mounted directly on the/DEV/SRO.


#cd/media/vmware\ tools/into the folder location where you need to install the program.

#cp the compressed file in the directory to the specified location for decompression.


When performing the installation, use full path + (-D), where-D is the default option when executing a program installation, avoiding excessive manual selection of Yes or no

After the installation is complete, the init 3 or init 5 can be executed to close and open the graphical interface (otherwise reboot machine required)



Modify the user's full name (to log in with a shortened user name): # vi/etc/passwd; # Vi/etc/shadow Save the name you want to modify in these two configuration files.



Single-user, the use of physical terminals, the machine is in a network-Free State, also can not switch the virtual Terminal interface, view physical terminal: #ls/dev/console



Attention:

The system login prompt information is added; Vi/etc/issue adds the required information under its file, but it is strictly forbidden to use the welcome word information.


This article from "11878240" blog, declined reprint!

Getting Started with Linux bash learning

Related Article

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.