Linux Command Summary

Source: Internet
Author: User

    • 1 VI Editor
    • 2 File operations
      • 2.1 Deleting files
      • 2.2 Viewing files
      • 2.3 Creating a Folder
      • 2.4 Viewing file permissions
      • 2.5 Copying files
      • 2.6 Mobile
      • 2.7 Finding files
    • 3 Viewing CPU Information
    • 4 Process Management
    • 5 Viewing logs
    • 6 Compression and decompression
    • 7 Network
      • 7.1 Network Configuration
      • 7.2 Network Management netstat command
    • 8 Viewing disk IO
    • 9 Users
    • 10 Service Management
    • 11 Process Management
    • 12 Restart and shutdown
    • CPU and Memory usage monitoring
    • 14 Installing Ubuntu
    • 15 Common tools
      • 15.1 Nano Editor
      • 15.2 Installing the OpenSSL Server
      • 15.3 Telnet
      • 15.4 wget
    • 16 languages
1 VI Editor

Operation description

Exit command, enter:

Press ESC to enter command mode

Exit Command Q

Exit does not save q!

Save Exit Wq

Input

A enter a character after the cursor position

I enter characters before the cursor position

Delete

DD Delete Row

X Delete the selected characters

Line break

O Add a row below the cursor line and enter the input mode

O Add a row above the cursor line and enter the input mode

Find

Command mode input/what to look for

DD Delete a row

NDD Delete N rows

U undo

YY copy when moving forward

P Paste

Reference Address: http://man.ddvip.com/soft/vieditor/vi.html 2 File Operation 2.1 Deleting a file

Delete file rm [filename]

Delete a folder Rm-rf [directory]

Delete empty folder Rm–d [directory] 2.2 viewing files

All files under the LS folder

find–name [filename] Find file named filename in the current directory

Find/-name [filename] finds all files under the root directory named FileName 2.3 Create folder

Mkdir–p xx/xxx/xx 2.4 Viewing file permissions

ls–l [file name] 2.5 copying files

cp-r [File Absolute path src] [file absolute path dest]

Remote replication

SCP./*.tar.gz [Email protected]:/home/mysql/2.6 Mobile

mv/home/bruce/tomcat/apache-tomcat-7.0.41/usr/local/webserver/apache-tomcat-7.0.41 2.7 Finding files

Whereis XX

Find/-name XX 3 View CPU Information

To view the number of physical CPUs

grep ' physical id '/proc/cpuinfo | Sort-u | Wc-l

View number of cores

grep ' core ID '/proc/cpuinfo | sort-u| Wc-l

To view the number of threads

grep ' Processor '/proc/cpuinfo | Sort-u | Wc-l

View CPU Information

Cat/proc/cpuinfo 4 Process Management

Kill Process

Reference: http://os.51cto.com/art/200910/158639.htm

Kill [PID]

Kill-9 [PID]

Query Process Commands

Ps-ef|grep Java 5 Viewing logs

1) Dynamic View log:

Tail-f Xx.log

2) More commands:

More Xx.log

3) Less command:

Less Xx.log

4) VI command:

VI Xx.log 6 compression and decompression

Unpack

Tar xvf xx.gz

Packaged

TAR-CF A.txt.tar A.txt

Compress zip

Zip–q–r html.zip/home/blinux/html 7 Network 7.1 Network configuration

CentOS Configuration

Modify IP

Nano/etc/sysconfig/network-scripts/ifcfg-eth0

device=eth0bootproto=staticonboot=yesipaddr=192.168.1.200netmask=255.255.255.0gateway=192.168.1.1dns= 202.96.209.133

Restart Network

Service Network restart

Ubuntu configuration

1) Set the virtual machine networking mode to bridge

2) Change IP

Vi/etc/network/interfaces

In interfaces, add the following:

Auto eth0iface eth0 inet staticaddress 192.168.2.205netmask 255.255.255.0gateway 192.168.2.1

Edit/etc/resolv.conf

Add DNS server address:

NameServer 8.8.8.8

This will resolve the domain name

When you are finished, restart the networking service:

sudo/etc/init.d/networking restart

Reference

http://blog.istef.info/2008/10/02/setup-ssh-server-on-ubuntu-server/7.2 Network Management netstat command

View ports

Netstat-anp|grep 808 View Disk IO

Reference Documentation:

http://blog.csdn.net/qiudakun/article/details/4699587

Software Installation:

Yum Install Sysstat

Run command

Iostat-x 1 109 Users

Ubuntu:

Switch from user to root

sudo su

To cut back from the root user to a user

SU user

Centos:

Switch to root user

Su–root

Note-there is a space between and root 10 service management

View and close Services

Http://www.360doc.com/content/11/0111/13/3220382_85706376.shtml

sudo apt-get install sysv-rc-conf

sudo sysv-rc-conf

Operation:

    • Positioning with keyboard keys
    • Use a space to indicate a selection
    • x = Open Service
    • CTRL + N Next page
    • Ctrl+p previous Page
    • Q exit
11 Process Management

Kill process

Reference: http://os.51cto.com/art/200910/158639.htm

Kill [PID]

Kill-9 [pid]12 Restart and shutdown

Restart command:
1, reboot
2. shutdown-r now reboot (root user)
3, Shutdown-r 10 over 10 minutes automatic restart (root user use)
4, Shutdown-r 20:35 restart at 20:35 time (root user use)
If you set the restart through the shutdown command, you can cancel the restart with the Shutdown-c command.

Shutdown command:
1, halt immediately shut down the machine
2, Poweroff immediately shut down the machine
3, Shutdown-h now immediately shut down (root user use)
4, shutdown-h 10 10 minutes after the automatic shutdown

If you set the shutdown through the shutdown command, you can use the Shutdown-c command to cancel the restart CPU and memory usage monitoring

Top: View current process run status

Free: View Memory usage

Exit: q14 Install Ubuntu

Installing Ubuntu on a virtual machine

Download Ubuntu Server 13.04 from the official website

: Http://www.ubuntu.org.cn/download/server15 Common tool 15.1 Nano Editor

Reference Document: Http://www.linode.im/1277.html

Nano xxx

Ctrl+x: Exit 15.2 install OpenSSL Server

Service side:

sudo apt-get install Openssh-server

Configuration file

View port information, etc., default port 22

sudo nano/etc/ssh/sshd_config

Start command

Sudo/etc/init.d/ssh start

Sudo/etc/init.d/ssh Stop Stop

Sudo/etc/init.d/ssh Restart Restart

View SSH Run status

Netstat–tlp

Client: 15.3 Telnet

CentOS, Ubuntu

Yum list telnet* viewing Telnet-related installation packages

Yum Install telnet-server telnet Service

Yum Install telnet.* telnet Client 15.4 wget

Yum-y install wget16. Language

Export Lang=en_us

Original address: http://www.cnblogs.com/tangyanbo/p/4284332.html

Linux Command Summary

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.