Linux Operations 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
    • 3 Viewing CPU Information
    • 4 Query Process commands
    • 5 Viewing logs
    • 6 Compression and decompression

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 Operations 2.1 deleting files

Delete file rm [filename]

Delete a folder Rm-rf [directory]

Delete empty folders 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 Creating a 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

3 Viewing 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 Query Process commands

Ps-ef|grep Java

5 Viewing logs

Tail-f Xx.log

More Xx.log

Less Xx.log

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 Viewing port occupancy

Netstat-anp|grep 80

8 wget Tool Installation

Yum-y Install wget

9 Finding files

Whereis XX

Find/-name XX

10 Network configuration

CentOS Configuration

Modify IP

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

device=Eth0bootproto=staticonboot=yesipaddr=192.168. 1.200 NETMASK=255.255. 255.0 GATEWAY=192.168. 1.1 DNS=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:

192.168. 2.205  255.255. 255.0  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/

Linux Operations 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.