This article mainly introduces Linux Common command tools, such as user creation, deletion, file management, common network commands, etc.
How to create an account:
1. Create a user
USERADD-M username
-M means that the Create user's folder is added under the/home path, username is your username, and the day is changed to your preferred username
2. Create a password
passwd username
After that, an interactive maniac will appear, allowing you to enter your password and confirm your password.
3. Delete Account
Userdel-r username
-R means that the folder in the/home directory is deleted, and if you want to keep the folder, you do not need to add the-R
4. Switching between user UserA and user UserB
In some cases, we need to switch back and forth to work in two usernames, if the current user is UserA, I want to enter UserB
SU users
You will then be prompted to enter your account and password if you want to exit, enter
Exit
Groups of users:
- View the current user's group status
Groups
2. Add users from/to remove
Usermod-g/-g groupName username
Where-G means the user is added to the current group,-G to remove the user from the group, GroupName represents the group name username represents the user name
User's permissions:
Use Ls-l to view the file's attribute fields, the file attribute field has a total of 10 letters, the first letter indicates the file type, if the letter is a minus "-", then the file is a normal file. The letter "D" means that the file is a directory, the letter "D", is an abbreviation for the Dirtectory (directory). The following 9 letters are the permissions of the file, 3 are a group, respectively, the file belongs to the user, the group of users, and other users read and write and execute permissions; for example:
[/home/weber#]ls-l/etc/group
-rwxrw-r--Colin King 725 2013-11-12 15:37/home/colin/a
Indicates that this file is for file owner Colin, a user who can read and write, executable, readable to the group where Colin resides (King), and readable to other users;
- Change Read and Write permissions
chmod 666 Folder
666 is the encoding of file permissions, described as follows
File read and write executable permissions, represented by a number of 3-bit octal values, the first digit represents the permissions of the user of the file owner, the second represents the permissions of the user group, the third represents the rights of others, please refer to the details.
Permission To:owner Group Other
/ˉˉˉ\/ˉˉˉ\/ˉˉˉ\
Octal:6 6 6
Binary:1 1 0 1 1 0 1 1 0
What to Permit:r W x r W x r W x
Where 1 represents the open permission, 0 for the shutdown permission; R means read, w means write x indicates execution
Folder is the name of the folders
Querying network services and ports
1. List all network ports
Netstat-a
2. List all TCP ports
Netstat-at
3. List all the service statuses that have been monitored:
Netstat-l
Example: Querying Port 6370
$netstat-ANTP | grep 6379
TCP 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 25501/redis-server
$ps 25501
PID TTY STAT Time COMMAND
25501? SSL 28:21./redis-server./redis.conf
4. Lsof Query Port
Lsof (list open files) is a tool that lists open files for the current system
lsof-i:7902
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
WSL 30294 Tuapp 4u IPv4 447684086 TCP 10.6.50.37:TNOS-DP (LISTEN)
Network download
1. Download directly from the Internet
Wget-c URL
Where-c means that the URL for the continuation of the breakpoint represents the routing address of the network resource
SSHLogin
SSH [email protected]
SSH login remote server host ID is user name
SCPNetwork copy
1. Local to server:
Sep localpath [email protected]:p at
2. Server to Local
scp-r [email protected]:p ath LocalPath
Where ID is the server's login name, site is the server address, LocalPath is the address of the local folder
View Feature Documentation
At the Linux terminal, we need to turn to the help documentation of the system in the face of commands that do not know how to use or remember the spelling and parameters of the command; The built-in Help documentation for the Linux system is very detailed and usually solves our problems, and we need to know how to use them properly.
We can search by man-k only when we remember some command keywords.
You need to know a brief description of a command, you can use Whatis, and in more detail, the info command is available;
To see where the command is located, we need to use which;
For the specific parameters of the command and the use of the method, we need to use the powerful man;
- Use man to view the document, as we would like to know more features of wget, you can use the following command
Mans Curl
More Resources
- Http://linuxtools-rst.readthedocs.io/zh_CN/latest/base/index.html
- Http://www.cnblogs.com/cocowool/archive/2009/10/27/1590674.html
Introduction to Linux common commands