Linux Command summary, linux Command

Source: Internet
Author: User
Tags install openssl

Linux Command summary, linux Command

  • 1 vi Editor
  • 2 file operations
    • 2.1 Delete an object
    • 2.2 view files
    • 2.3 create a folder
    • 2.4 View File Permissions
    • 2.5 copy a file
    • 2.6 Mobile
    • 2.7 search for files
  • 3. View cpu Information
  • 4. Process Management
  • 5. View logs
  • 6. compression and decompression
  • 7 network
    • 7.1 Network Configuration
    • 7.2 Network Management netstat command
  • 8. view disk io
  • 9 users
  • 10 Service Management
  • 11 Process Management
  • 12 restart and Shutdown
  • 13 CPU and memory usage monitoring
  • 14 install Ubuntu
  • 15 common tools
    • 15.1 Nano Editor
    • 15.2 install OPENSSL Server
    • 15.3 Telnet
    • 15.4 wget
  • 16 languages
1 vi Editor

Operation description

Exit the command and enter:

Press esc to Enter command mode

Exit command q

Exit and do not save q!

Save and exit wq

Input

A. Enter characters after the cursor position

I input characters before the cursor position

Delete

Dd deletes a row.

X Delete selected characters

Line feed

O add a line under the row where the cursor is located and enter the input mode

O add a line above the row where the cursor is located and enter the input mode

Search

Command mode input/content to be searched

Dd deletes a row

Ndd Delete n rows

U undo

Yy copy the current row

P Paste

Reference: http://man.ddvip.com/soft/vieditor/vi.html

2. File Operation 2.1 Delete an object

Delete rm [filename]

Delete the rm-rf [directory] folder

Delete an empty folder rm-d [directory]

2.2 view files

All files in the ls folder

Find-name [filename]: find the file named filename in the current directory.

Find/-name [filename] find all files named filename in the root directory

2.3 create a folder

Mkdir-p xx/xxx/xx

2.4 View File Permissions

Ls-l [file name]

2.5 copy a file

Cp-r [absolute file path src] [absolute file path dest]

Remote replication

Scp./* .tar.gz root@192.168.1.202:/home/mysql/

2.6 Mobile

Mv/home/bruce/tomcat/apache-tomcat-7.0.41/usr/local/webserver/apache-tomcat-7.0.41

2.7 search for files

Whereis xx

Find/-name xx

3. View CPU Information

View the number of physical CPUs

Grep 'physical id'/proc/cpuinfo | sort-u | wc-l

View the number of cores

Grep 'core id'/proc/cpuinfo | sort-u | wc-l

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. View logs

1) dynamically view logs:

Tail-f 1000 xx. log

2) more command:

More xx. log

3) less command:

Less xx. log

4) vi command:

Vi xx. log

6. compression and decompression

Unpack

Tar xvf xx.gz

Package

Tar-cf a.txt.tar a.txt

Zip Compression

Zip-q-r html.zip/home/Blinux/html

7. Network 7.1 Network Configuration

CentOS Configuration

Modify ip Address

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 the network

Service network restart

Ubuntu Configuration

1) set the connection mode of virtual machines to bridging

2) Change the ip address

Vi/etc/network/interfaces

Add the following content to interfaces:

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

In this way, the domain name can be resolved

Then 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 port

Netstat-anp | grep 80

8. view disk io

Reference:

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

Software installation:

Yum install sysstat

Run commands

Iostat-x 1 10

9 users

Ubuntu:

Switch from user to root user

Sudo su

Switch from root user to user

Su user

CentOS:

Switch to the root user

Su-root

Note: there is a space between-root and-root.

10 Service Management

View and disable services

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

Sudo apt-get install sysv-rc-conf

Sudo sysv-rc-conf

Operation:

  • Use the keyboard arrow key to locate
  • Select with Space
  • X indicates that the service is enabled.
  • 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 restarts immediately (used by the root user)
3. shutdown-r restarts automatically after 10 minutes (used by root users)
4. shutdown-r restart at (for root users)
If you use the shutdown command to set the restart, you can use the shutdown-c command to cancel the restart.

Shutdown command:
1. Shut down halt immediately
2. Power off immediately
3. shutdown-h now shut down immediately (used by the root user)
4. shutdown-h: shutdown automatically 10 minutes later

If you use the shutdown command to set shutdown, you can use the shutdown-c command to cancel the restart.

13 CPU and memory usage monitoring

Top: view the running status of the current process

Free: view memory usage

Exit: q

14 install Ubuntu

Install Ubuntu on a VM

Download the server version Ubuntu server 13.04 from the official website

: Http://www.ubuntu.org.cn/download/server

15 common tools: 15.1 Nano Editor

Reference: http://www.linode.im/1277.html

Nano xxx

Ctrl + x: Exit

15.2 install OPENSSL Server

Server:

Sudo apt-get install openssh-server

Configuration File

View port information. The default port is 22.

Sudo nano/etc/ssh/sshd_config

Start command

Start sudo/etc/init. d/ssh start

Sudo/etc/init. d/ssh stop

Restart sudo/etc/init. d/ssh restart

View ssh running status

Netstat-tlp

Client:

15.3 Telnet

Centos, ubuntu

Yum list telnet * view the installation package related to telnet

Yum install telnet-server install telnet Service

Yum install telnet. * install the telnet Client

15.4 wget

Yum-y install wget

16. Language

Export LANG = en_US

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.