Linux common commands (learning update)

Files and directories:

# Cd / home enter '/ home' directory

# Cd .. go back one level

# Cd ../ .. return to the two directories

# Cd - return to the previous directory

# Cp file1 file2 copy file1 to file2 will

# Cp -a dir1 dir2 copy a directory

# Cp -a / tmp / dir1. Copy a directory to the current working directory (representative of the current directory)

# Ls view files in a directory

# Ls -a show hidden files

# Ls -l show details

# Ls -lrt time display file (a detailed list L, r represents the reverse ordering, t represents the time ordered)

# Pwd show the path of work

# Mkdir dir1 create 'dir1' directory

# Mkdir dir1 dir2 create two directories simultaneously

# Mkdir -p / tmp / dir1 / dir2 create a directory tree

# Mv dir1 dir2 move / rename a directory

# Rm -f file1 delete 'file1'

# Rm -rf dir1 delete 'dir1' directory and its subdirectories content

User and group CRUD operations

# Less / etc / passwd display information storage for all users

A total of seven field

The first one field (column) record is the user name (root when creating the user from the user).
The first two fields (columns) If x, indicating that the user must use a password to log Linux system; if empty, then the user at login without a password.
The first three fields (columns) of this user is recorded uid.
A fourth field (column) is recorded in the user belongs to the group gid.
The fifth field (column) is recorded information related to the user's annotations (e.g., full name or a communication address).
The sixth field (column) record is the path to the user's home directory.
The first seven fields (columns) is recorded after the user logs in, the first process to be executed.

#less / etc / shadow to store all the user's password, each user occupy his record

      A total of two field

The first one field (column) is the user name.
The first two fields (columns) is the password, which is the result of the MD5 algorithm encrypted password.

#less / etc / group to store the information for all groups of Linux systems

  A total of four field

The first field is the name of the group.
The first two fields x indicates that the group must use a password when logging in Linux systems.
The third field of the record is this group gid.
The first four fields in this group record is what other group members.

# Useradd -u 1009 -G W d / home / wunanya c bigwunan -S / bin / bash wunanya

Add a user named wunanya's, -u user uid designated as 1009, -g specify the main user base is lw, -d to specify the user's home directory / home / wunanya, -s specifies the user's login permissions to / bin / bash (you can log into the system, / sbin / unlogin), - c specifies the information to the user comments bigwunan

 

View the contents of the file:

# Cat file1 view the contents of the file forward from the first byte

# Head -2 file1 view first two lines of a file

# More file1 view the contents of a long document

# Tac file1 view the contents of a file in reverse from the last line

# Tail -3 file1 view last three lines of a file

other:

# Su - to switch to root permissions (su with distinction)

# Shutdown -h now shutdown

# Shutdown -r now reboot

# Top using the most CPU resources linux tasks (Enter q to quit)

# Pstree a tree diagram display program

# Man ping View Reference Manual (such as ping command)

# Passwd Change Password

# Df -h show disk usage

# Cal -3 show the previous month, the calendar of the current month and the following month

# Cal 10 1988 displays the specified month, and year calendar

# Date --date '1970-01-01 UTC 1427888888 seconds' to a phase transition to a time for the number of seconds 1970-01-01 00:00

Guess you like

Origin blog.csdn.net/w819104246/article/details/92712679