Linux most commonly used command summary

Source: Internet
Author: User
Tags create directory unique id

1. file Sharing

1), the method of Sharing folders under Windows system to Linux:

Install FileZillaand set up a Linux server connection. Upload the file.

2), Mremote Machine Connection management

2. File Management commands

2.1. Copy command CP

Cp–r Dir1 Dir2

sudo cp -R/HOME/MAGGIC/20110216/USR/LOCAL/SRC

Description

/home/maggic/20110216 the address of the file to be copied

/USR/LOCAL/SRC address of the destination file

2.2. Delete command RM

1), delete the file named Test.txt,

rm/usr/local/ Test . txt

2), delete files from the entire test directory

Rm-r–f/usr/local/test

or rm–rf/usr/local/test

-F Delete Do not prompt.

-R Delete all files and folders under this directory

-I do an interactive delete.

http://apps.hi.baidu.com/share/detail/22986179

2.3. View the command cat or VI

Vi file name (if the file name does not exist, directly set up files)

View file contents, open file

> Overwrite Write

>> Append Write

Grep–n file name >kkk

2.4. finding files Find

1. Find/-name file name xxx

From the root directory, look for the name XXX exists.

Find the exact path where the file is located,-name means to find it by name

Find file or directory: Find path –name "string"

2.5. Pipeline Command |

Command processing after handing the result of the previous command to the pipeline command

For example, ls–l/etc |more pagination shows the contents of the ETC directory

2.6. Pipeline Redirection >

Ls–l >a.txt The contents of the list are written to the file A.txt (overwrite write)

Ls–al the contents of the >>aa.txt list to a file aa.txt

Enter information from the file Database_program<database_data

2.7. Other commands

View catalog: LS

Create directory: mkdir

Moving files: MV path/File/warp/file movement relative to the path of the file to the absolute path

Modify file name: MV filename New name

To switch directories:

Return to command top level:CD. ; returns the upper level two of the command:CD. /.. /

Show absolute path: pwd

grep find content inside a file

Find file part content: grep character file name

Grep–n "Hello" Hello.java

Parameter-n See now the first few lines

More Show file contents with pagination

More file names

Page display, press the sky grid, go to the next page

Press PG UP+CRL to go to the previous page

Less displays the contents of the file with pagination

2.8. File owners, groups, and other groups

Ls–ahl viewing all groups of files

CHGRP Group name File name: Modify the group in which the file resides

A user-created file that has the owner of the user and the group that the user is in

For example, User1 creates Test.java, where the group is group1

Ls–l Viewing files

Results:-rw-r--r--1 user1 group1 378 2012-05-08 06:05 test1

File permissions:

Three types of permissions: R readable with 4

W can be written in 2 notation

x executable, denoted by 1

-For normal type rw-for User1 to test1 permissions

-RWXRWXRWX All users can modify this file

3. Disk Management

To view disk space usage: DF

View total capacity of this directory: Du–b/folder name

View system partition information: Fdisk-l

4. file Permissions

4.1. Open Permissions Method

Setup file Test.txt

chmod 777 Test.txt When viewing ls–l, the file is-rwxrwxrwx

The first 7 modifies the owner's permissions

The second 7 modifies the permissions of the group for which the owner is a

The third 7 modifies the permissions of other groups

You can also chmod 770 file names

chmodxxx xxx (1, 2, 4 or any add-on)

Modify the folder, is to modify the permissions of this folder, the following file or the original permissions

chmod +x file name

Set the root account password

sudo passwd root

PW: ( Enter root password here)

5. User Management

have root privileges to add

5.1. User

View all user information for the system

VI/ETC/PASSWD or CAT/ETC/PASSWD

Result: User name: x: User id: User group ID:: User group directory: Shell parser used by this user

Useradd

Userdel

passwd (-l–u-s)

Usermod (-L–U–S–U-G)

Id

Create a user and specify which group to assign the user to:

USERADD–G Group name User name

When a group name is not specified, a group name that is the same as the user name is created automatically, and the user is under this group.

Under Ubuntu, useradd–m user name to find the user directory under Home

To modify the group in which the user resides:

USERMOD–G Group name User name

5.2. Group

Viewing groups of systems

Vi/etc/group

or Cat/etc/group (can only see, cannot be modified)

Result: Group name: x: Unique ID number of group

Groupadd

Groupdel

6. Software Management

6.1. command to install SSH

1, first check whether the Linux installation ssh

Rpm–p sshd

2, if not installed

Decompression: Tar xzpf openssh-version.tar.gz

1), Apt-get install Openssh-server

2), Start service services SSH start

3), Stop services service SSH stop

Tar–c–x–v–z

Diff

Make

Make install

6.2. Software Installation Process

Unzip: Tar xzpf file name **.tar.gz

Grant permissions: chmod 777 file name

Execute system self-command: e.g../configure

#make

#make Install

See if the service starts normally

Service Name –p, such as Rpcinfo-p

7. Start Management

Reboot

Init6

Runlevvel init[0123456]

Chkconfig–list

Chkconfig–level

Chkconfig on

8. Process Management

8.1. Process Operations

Show Process:

Ps–ef |grep MySQL

Kill the process:

Kill-9 + (Process number)

Top

Pstree

Crond

Crontab

9. VI exit operation

Switching between edit mode and command mode:

Enter EDIT: VI

Edit Document Mode return Command mode:ESC key +:

q! No saved exits

Wq have saved the exit

virtual machine networking

Configuring IP Manually

Click "Icon" to configure VPN->vpn connection

Editor->ipv4, Wired

Method: Manual, input IP address, mask, Gateway, DNS

Ubuntu ethernet:nat->setting,bridged

Remote connection command: MSTSC

One . Other common commands

To view the native IP configuration: ifconfig

sudo–i Switch to root

The option refers to changing the shell environment parameter to the target user, and you are not naming the target so the default is root, and the environment parameter is changed to root, the same as the root login shell.

Linux most commonly used 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.