Basic use of CentOS

Source: Internet
Author: User
Tags nameserver

Basic use of CentOS
1. view the running status of the process:
Ps [options] [-- help]
This command can be used to view the running status of processes in the instant computer
Parameter description:
-A all: list all processes.
-W width, show widening to show more details
-The au display is called details.
-Aux displays all other processes that use this function. The format is user pid % CPU % mem vsz rss tty stat start time command.

2. view disk usage
Df [options] [-- help]
This command can view the computer disk usage
Parameter description:
-AT: displays the space usage of all storage systems and the file type of the storage system.
-T: displays the space usage of the specified file system, for example, df-t ext3.
-Ah is roughly equivalent to-aT, but information display is more user-friendly.
-AhlT: displays the space usage of all storage systems except the Network File System, and displays the file types of the storage system.
-H: view the disk usage of a file system (such as a disk or USB flash disk)

3. view the directory Space
Du [options] [-- help]
Parameter description:
-Sh: view the current folder size
-Ch: view the size of the current folder and Its subfolders.
-H: view the size of the independent File

4. vi usage
The vi editor is a standard editor for all Unix and Linux systems. For any version of Unix and Linux systems, the vi editor is identical.

Vi has three states: command mode, Insert mode, and last line mode)
Command mode: controls the movement of the screen cursor, the deletion of rows or words (characters), the replication of a specific segment, and the entry of Insert mode or last line mode.
Insert mode: only Insert mode can be used for text input. Press ESC to return to command line mode.
Last line mode: Save the file or exit vi. You can also set the editing environment, such as searching strings and listing row numbers.

Basic operations of vi
A. Go to vi: Enter the vi and file name, and then enter the vi full screen editing screen, such as vi myfile
Note: After Entering vi, it is in command mode by default. You must switch to Insert mode to Enter text.
B. Switch Insert mode to edit the file: click "I" in command mode to enter Insert mode. Then, you can edit the file.
C. Insert switch: In Insert mode, only text can be input all the time. If you find that the word is incorrect and you want to use the mouse button to move it back, you need to press ESC to switch to command mode and then delete the text.
D. Exit vi and save the file: press the ":" (colon) Key in command mode to enter the Last line mode. Then,
W filename -- save the article with the specified file name filename
Wq -- save the disk and exit vi
Q! -- Force exit vi without saving the disk

5. "cocould not retrieve into list" solution appears in CentOS yum
A. Configure resolv. conf: Configure resolv. conf In The/etc directory to add nameserver IP
# Vi/etc/resolv. conf
Nameserver 218.85.157.99
Search localdomain
B. Modify the DNS configuration file
Vi/etc/sysconfig/network-scripts/ifcfg-eth0
ONBOOT = yes
MM_CONTROLLED = no

C. Restart CentOS.

6. view the current path

Pwd [-L |-P]

7. Search for files by file name

Find pathName-name fileName

For example, search for aaa.txt: find/-name aaa.txt

8. Delete

Rm filename: delete an object

Rm-r path: Delete the directory, but each time you delete a project, you are prompted to confirm

Rm-rf path: No need to confirm to delete the Directory

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.