Basic linux commands and basic linux commands

Source: Internet
Author: User
Tags disk usage

Basic linux commands and basic linux commands

Shutdown-h now shut down immediately

Shutdown-r now restart the computer

Reboot now restarts the computer

Logout user logout

Vi editor usage:

1) vi file name

2) Enter I to enter the command mode]

3) Enter esc to Enter command mode]

4) input: [wq indicates exit and keep q! Exit and do not save]

Pwd displays the current path

Groupadd polic add polic User Group

View information about all groups in linux:

Vi/etc/group

Cat/etc/group

View all user information in linux

Vi/etc/passwd

Cat/etc/passwd

Useradd xiaoming add xiaoming user [only users with root permissions can be added]

Useradd-g group name user name specify user group when adding user

Passwd: Add a password to the current user

Passwd xiaoming

Userdel xiaoming delete user xiaoming

Userdel-r xiaoming: Delete the user xiaoming and the user's home directory

Command: init [012356]

Running level

0: Shutdown

1: single-user mode

2: No network service in multi-user status

3: Multi-User Network Services

4: The system is not used and retained to the user.

5: Image Interface

6. system restart

The common running levels are 3 and 5. to modify the default running level, you can modify the id of the file/etc/inittab: 5: initdefault: number in this line.

Ls to list files and directories

-A: Show Hidden Files

-L display long list format

Create a directory using mkdir

Rmdir Delete empty directory

Touch creates an empty file

Cp Replication

Cp-r dir1 dir2 recursive Copy command

Move the music video file and change the file name

Rm delete files and directories

Rm-rf deletes all contents (including directories and files)

R recursion f forced

More display file content with pagination

Less display file content with pagination

Grep queries a keyword in the text.

For example, search for xiaohong keyword in the file.txt file: grep "xiaohong" file.txt

If you want to display the number of rows that appear in the xiaohong Keyword: grep-n "xiaohong" file.txt

| Pipeline Command [hand over the result of the previous command | subsequent command for processing]

Find search files and directories

Find/home-name aaa search for files and directories named man from/home

Search for files or directories that have been accessed or changed for a period of time

Find/home-amin-10 minutes memory directory or file

Find/home-atime-directory or file in memory for 10 hours

Find/home-cmin-the directory or file that has been changed within 10 minutes

Find/home-amin-directory or file accessed 10 minutes ago

Search for objects of the specified size

Find/home-size + 10 k search for files 10 k in the/home Directory

>,>> Redirect command:

Ls-l> a.txt internal content is written to the.txt file (overwrite)

Ls-al> Add the content in the aa.txt folder to the end of the aa.txt file.

Databse <database_data input information from the file

Chown user name file name modification file owner

Chgrp group name file name modification File Group

Mount command:

Mount [-parameter] [device name] [mount point]

Uninstall command:

Umount [device name]

View disk usage:

Df [-parameter]

View the partition where a directory is located:

Df [full directory]

View linux system partition details:

Fdisk-l

Rpm package installation:

Rpm-I prm package full path name: installation package to the current system

Rpm-ivh rpm package full path name: a prompt is displayed when the installation package is sent to the current system.

I: install

V: verbose prompt

H: hash progress bar

Delete rpm:

Rpm-e rpm package name

If other software depends on the software package you want to uninstall, an error message is generated when you detach the software package.

If you want rpm to ignore this error and continue uninstallation (programs dependent on this software package may not be able to run), use the -- nodeps command line option.

 

 

 

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.