Summary of basic Linux commands

Source: Internet
Author: User
Tags diff time and date

Summary of common Basic Linux commands

At the beginning of learning Linux/unix, you may be confused by hundreds of commands, although there are many commands available, but the daily use of a few, if only a DBA role and not a system administrator, then come together to learn my summary of the Daily orders, summary of the relatively hasty, But there is still some, to learn together!

Command

Description

Example

Basic commands

Date

Show Time and date

Echo

Print out text on the screen

Grep

is a Find command

grep AA Test.txt

History

Give the commands you or other users have entered earlier

History-3 show the last three commands

Password

Change Password

Uname

Machine Name and machine information

Whereis

Ask where the executable file of the application is located

Whereis who

which

Help check if the version of the command is used correctly

W.H.O.

List all online users

WhoAmI

Who is the current user

Env

Show all environment variables

Mans

Help commands

Man Date

Directory Management

Cd

Switch directories

Ls

List Directory

Pwd

Show current directory

Mkdir

New Catalog

RmDir

Delete Directory

Important Linux Directories

/etc

directory where system configuration files are saved

/dev

Device information file

/tmp

Temporary files, logs, etc.

Home

When you create a user, you automatically assign the directory, and you have all the permissions for this directory

Root

All system administrators, at the top of the tree

Read the text

More

command display, press the screen, press ENTER to display the next screen

For larger text

Cat

Show all contents of current text

Small text

Head

The first 10 rows are displayed by default

Head-5/etc/group.txt

Tail

Display the following 10 rows by default

Tail-5/etc/group.txt

Managing Files

Diff

Compare Text

Diff T1.txt T2.txt

Touch

Create an empty file

Touch test.sh

Mv

Move the file, or change the file name

MV A.txt B.txt

Cp

Copy files

Cp A.txt/home

Rm

deleting files

chmod

Change file permissions

CHMOD–G–RW Test.txt

Chgrp

Change the group to which a file belongs

CHGRP groupname filename

Umask

Default file and directory permissions on the current server

It is an environment variable

Edit Text

Vi

Edit Document

Cursor navigation

H

Move one character to the left

L

Move one character to the right

J

Move down one line

K

Move up one line

W

To the beginning of the next word

B

To the beginning of a previous word

$

To the end of the current line

^

To the beginning of the current line

: G

To the end of the file

: l

to the file header

Gg

Move cursor to First line

G

Cursor moves to tail line

NG

Move cursor to nth row

Processing commands

I

Insert starting from current character

A

Start inserting from the next character

O

Insert from a new line below

O

Start inserting from a new line on top

X

Delete the character at the cursor location

Dd

Delete the downward line where the cursor is located

Ndd

Delete the next n rows where the cursor is located

R

Replace the character at which the cursor is located

(n) yy

Copy the (n) row where you are visiting

P

Pastes the copied rows after the current cursor

P (uppercase)

Paste the copied line on the current cursor

: Q

Exit and discard Changes

: wq!

Save and exit

Summary of basic Linux commands

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.