Change the permission to read, write, and execute files or directories
Execution format: chmod [-R] mode name (name can be a file name or directory name; mode can be 3 8-digit numbers, or use the ls-l command, abbreviation of the permission to read, write, and execute a file or directory .)
Mode: rwx r: read w: write x: execute (user group other Abbreviation: u g o)
Example:
% Chmod 755 dir1 sets the directory dir1 to any user, which has the right to read and execute, but only the owner can modify it.
% Chmod 700 file1 sets the file file1 to be read, written, and executed only by the owner.
% Chmod o + x file2 adds file2 to the file and the owner's right to execute it.
% Chmod g + x file3 adds the group user's right to execute the file file3.
% Chmod o-r file4: remove the file file4 from the permission that other users can read.
Change the ownership of a file or directory
======================================
Execution format: chown [-R] username (name can be a file name or directory name .)
Example:
% Chown user file1 ownership of file file1, changed to user ownership.
% Chown-R user dir1 changes the ownership of the Directory dir1 and all its files and subdirectories to that of the user.
Check the name of the group to which you belong
======================================
Execution format: groups
Example:
% Groups
Change the group ownership of files or directories
======================================
Execution format: chgrp [-R] groupname name (name can be a file name or directory name)
Example:
% Chgrp vlsi file1 changes the group ownership of file file1 to the very large definition group.
% Chgrp-R image dir1: Change the directory dir1 and all its files and subdirectories to the image group.
Change the last modification time of a file or directory to the current time)
========================================================== =
Execution format: touch name (name can be a file or directory name .)
Example:
% Touch file1
% Touch dir1
File Link
============
The same file can have more than one name and can be connected to several files.
Execution format: ln oldname newname (Hard link)
Example:
% Ln file1 file2 link file2 to file file1.
Execution format: ln-s oldname newname (Symblick link)
Example:
% Ln-s file3 file4: link file4 to file file3.
Search for file strings
====================
Execution format: grep string file
Example:
% Grep abc file1: Find the entire line of text in file1 where the string abc is located.
Find the path of a file or command
================================
Execution format: whereis command (display command path .)
Execution format: which command (display command path and user-defined difference)
Execution format: whatis command (displays the abstract of the command function .)
Execution format: find search-path-name filename-print (search for a file path in a specified path)
Example:
% Find/-name file1-print (from the root directory, find the path with the file name file1)
Compare the content of a file or directory
================================
Execution format: diff [-r] name1 name2 (name1 name2 can be a file name or directory name at the same time)
Example:
% Diff file1 file2 compares different lines in file1 and file2.
% Diff-r dir1 dir2 compares different files in the dir1 and dir2 directories.
How can I bind multiple IP addresses to a network card?
==========================================
The network device configuration file of Linux is stored in/etc/sysconfig/network-scripts. For the first network device of Ethernet, the configuration file name is typically a ifcfg-eth0 if you need to bind one more IP address to the first network device, you just need to create a file named ifcfg-eth0 in the/etc/sysconfig/network-scripts directory: 0 file, content example:
DEVICE = "eth0: 0"
IPADDR = "211.100.10.119"
NETMASK = "255.255.255.0"
ONBOOT = "yes"
DEVICE indicates the DEVICE name, IPADDR indicates the IP address of the DEVICE, NETMASK indicates the subnet mask, and ONBOOT indicates automatic start at system startup.
If you need to bind another IP address, you only need to add the file name to the eth0: x of the DEVICE in the file. LINUX supports up to 255 IP aliases.
How to set the welcome information after login
==========================================
Modify/etc/motd and write text into it, so that the user can get the corresponding prompt information before executing shell after correct Logon Through telnet.
Motd is "messages of the day", that is, the meaning of the day information. The administrator can write some precautions or notifications to remind the formal users.
How to set the welcome page before login
==========================================
Modify/etc/issue or issue.net and write text to it so that you can get a prompt before login. This will help you identify the host you are connecting.
The issue content is displayed on the user interface for local login, while issue.net is displayed when users use network telnet.
How to quickly execute a specific historical command in bash
==========================================
In bash, press ctrl + r to find the matched commands in the History command and execute
How to view the process inheritance relationship
==========================================
Enter
Pstree
The program will list the inheritance relationships between running processes in the system in a tree structure.
How to find out the process with the largest memory usage
==========================================
In addition to using the top command to view memory usage, you can also use faster command line commands. The related commands are as follows:
Ps aux | sort + 4n
Or
Ps aux | sort + 5n
How to edit binary files in Linux
==========================================
To modify the binary file.
How to set the user password expiration time
==========================================
You can use usermod-e to set the password expiration time for a user. To set the password expiration time for a user, modify/etc/login. PASS_MAX_DAYS in defs, for example, changing the password expiration time for all users is 30 days:
PASS_MAX_DAYS 30
If the value is 99999, the password never expires.
How to modify the MAC address of a NIC
==========================================
You must first disable the NIC device. Otherwise, the system is reported to be busy and cannot be changed.
Command:/sbin/ifconfig eth0 down
Modify the MAC address. This step is simpler than that in Windows.
Command:/sbin/ifconfig eth0 hw ether 00: AA: BB: CC: DD: EE
Enable NIC/sbin/ifconfig eht0 up again
The MAC address of the NIC is changed.
How to use Bash to correct errors
==========================================
When you enter a command and do not know whether it is correct, you can use ctrl + t to correct the command.
For example, input mkdri and press ctrl + t. bash will help you correct the closest command mkdir.
How to prevent non-root users from logging on remotely
==========================================
Create the/etc/nologin file so that all non-root users cannot log on remotely.
How to not display messages of other users
==========================================
You can use mesg n to prohibit others from sending messages to him. In fact, it is to prohibit others from writing permissions to their terminals. When someone tries to use write to send messages to him, the sender will see the prompt:
Write: user has messages disabled on pts/n
How to know the library files used by a command
==========================================
For example, to know what library files ls uses, you can use:
$ Ldd/bin/ls
How to temporarily increase swap space
==========================================
Generate a 64 m empty file
# Dd if =/dev/zero of =/swapfile bs = 1024 count = 65536
Initialize the file as a swap file:
Mkswaps/swapfile 65536
Sync
Activate the swap file:
Swapon/swapfile
How to keep a user process running after the user exits the system
==========================================
Use nohup command &, for example:
Nohup wget-c ftp://test.com/test.iso
In this way, even if the user exits the system, the wget process continues to run until the test. iso download is complete.
How to limit the minimum password length of a user
==========================================
Modify the PASS_MIN_LEN value in/etc/login. defs. For example, the minimum password length is 8:
PASS_MIN_LEN 8
In this way, if the length of the password entered is less than 8, the password cannot be set.
How to limit