Linux Getting Started basics (i) command line bash basic operations

Source: Internet
Author: User
Tags command line sigint signal linux

Shell (shell) is the user and the bottom of the operating system (usually the kernel) interaction between the intermediary program, responsible for the user instructions, operations to the operating system at the bottom

Shell is generally divided into: graphical shell (GUI), command line shell (CLI)

Cli:command Line Interface

Gui:graphical User Interface

The general default GUI for Linux is: GNOME, default CLI: BASH

Bash prompt starts with # or $, #代表当前用户为root用户, $ represents the current user as a normal user we can automatically complete the command or file name with the TAB key on the keyboard

Su-Enter root user mode.

SU does not switch terminals, but also in the current directory, Su-switching new terminals.

If you don't know or forget your password, sudo passwd root can reset the root password directly. Direct passwd is to modify the password

Enter exit Exit root mode

sudo for ordinary users, can run as Administrator

Hostname View Host Name

UNAME Displays system information, uname-a all information

The command ID can display information for the current user

~ Represents the Home directory

Ctrl + C terminates the current command

CTRL + C: Send the SIGINT signal, the default process will end, but the process itself can redefine the behavior of receiving this signal.

Ctrl+z: Send sigstop signal, process is just stopped, send Sigcont signal again, process continues to run.

Instead of sending a signal, ctrl-d represents a special binary value that indicates EOF

1, CTRL + C more violent, is to send terminal to the current program, such as you are running a lookup function, files are looking, CTRL + C will force the end of the current process.

2, Ctrl+z is the current program hangs, suspend the implementation of this program, such as you are in the MySQL terminal, need to come out to do some other file operations, and do not want to quit the MySQL terminal (because the next time you have to enter the username password, very troublesome), so you can ctrl+z MySQL hangs, Then do other operations, and then enter FG return can return, of course, can hang a lot of process to the background, and then FG Plus number will be able to suspend the process back to the foreground. Of course, it is very convenient to switch front and rear with BG and FG commands.

3, Ctrl+d is to send an exit signal, not so strong, like Ctrl + C operation, such as you from administrator root back to your ordinary users can be used.

Clear: Clears the terminal screen

Commands are made up of: commands, options, parameters

The TAB key is used to complement the full file (folder) name, command

Press the arrow key "up" or ctrl+p to repeat the last command

Bash records our previous commands and can view all history commands through the history command

Bash can invoke history to simplify operations in the following ways:

!! Repeat previous command

! character repeats the previous command preceded by a specified character

!num execute command by history ordinal

!? ABC repeat the order that contains ABC

!-n Repeat n command before the command

We can search the history command record by CTRL + R.

Esc. (esc+ dot) parameters of the previous command

Command SU can switch users

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.