Some common commands for Linux beginners (3)

Source: Internet
Author: User
Tags clear screen

pipeline | 
  An important concept that uses the output of one command as input to another command
  For example:
   find 192.168 strings in ifconfig results
   Ifconfig | grep 192.168

   find Java-related processes
  ps-ef | grep java
   Find and 3306 related information
  ps-ef | grep 3306
 
   
system administration Command
 date Display or set the system time
  date  display the current system time
  date-s "2014-01-01 10:10:10"   Set the system time
    
 clear Clear Screen
  ctrl+l
  
 ps Status of a process that is running
  ps–ef  view all processes
  ★ps–ef | grep ssh finds a process
 
 kill Kill a process
  kill 2868  kill 2868 numbered process
  ★kill-9 2868  Force kill process

Network management
Ifconfig: View all network settings
Ifconfig nic name down: Disable NIC
Ifconfig nic name up: Enable NIC

Ping: Same as in window
Cancel with Ctrl + C

Netstat view the network ports.
Netstat-an | grep 3306 Query 3306 port occupancy

User Management
Add to
Useradd Username: The default is to create a directory for a user in the home directory
passwd User name: Enter password

Useradd User name-d/home/directory: Create a user and then specify the user's home directory

Delete
Userdel User name: Just delete the user but do not delete the home directory
Userdel-r User name: Delete user with home directory delete

To switch users:
Ssh-l User name-P 22 Host
Example: Ssh-l tom-p 22 192.168.17.131
Su-user name

Group Management
Add to
Groupadd Group Name
Useradd User name-G group name
Delete
Groupdel Group Name
Attention:
If there are users under the group, can not delete

permissions for the file:
Normal files: Include text files, data files, executable binaries, and so on.
Catalog files: The Linux system sees the directory as a special kind of file, which makes up the tree structure of the file system.
Device files: The Linux system sees every device as a file

List by LL show
Starting with D is the catalog file
To-start with a normal file

Permissions for a file 9 letters three three a group
The first group represents the permissions of the current user
The second group represents the permissions of the group
The third group represents the rights of other users

R: Read 4
W: Write 2
X: Perform 1

chmod Change the permissions of a file or directory.
chmod 755 A.txt
chmod U=rwx,g=rx,o=rx A.txt
chmod a.txt/
★chmod 777 A.txt

Chown changing a file or directory to the user and group to which the file belongs
Chown u1:public a.txt: Change the owning user and group of the current directory or file
Chown-r u1:public dir: Change the user and group of all subdirectories and files in the directory
Format:
Chown User: Group file

Some common commands for Linux beginners (3)

Related Article

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.