Shut down the system: shutdown [options] [TIME] [warning message]
-K does not really shut down just send a warning message to all users
-R restart immediately after shutdown
-H does not restart after shutting down the machine
-F Quick shutdown without init program
The MV command plus the pathname is moved, and if the file name is renamed:
Mv/tmp/xxx.tar/root//Move the tar file under the TMP directory to the root directory
MV Aaa.tar Bbb.tar//Rename the file AAA in the current directory to BBB
chmod [Who][+|-|=][mode] File name
Who:u represents the user, file or directory owner
G represents the same group of users, all users with the same group ID as the file owner
o indicates others user
A means all users
+ Add a permission
-Cancel a permission
= Give a given permission and cancel all other permissions
Mode means permission, R: Readable w: writable x: Executable
Chown used to change the owner and group of a file or directory, chown[User: Group] File
PS Display process,-e display all processes-F full format-l long format
DF shows the disk space currently remaining on the disk, the common parameter is K
mount[Options] Device Catalog
-a the file system listed in the/etc/fstab file is mounted;
Mounting floppy and CDROM: Mount/mnt/cdrom
Mount/mnt/floppy
Umount command for uninstalling a file system
Umount [-F] Directory (directory name for uninstallation)
Umount-f/mnt/cdrom (-F Force Unload, force unload file system mounted in/mnt/cdrom directory)
tar[Options] File name
-C Create a new profile
-T view the contents of the archive file
-X decomposing the contents of the archive file
-f Specifies the name of the archive file
-V Show Process information
-Z Using compression method
Example:
Tar-czf oracle.tar.gz/u01/app/oracle/etc/oratab/home/oracle
Merge all files in the/u01/app/oracle directory,/etc/oratab all files and/home/oracle all files into the oracle.tar.gz file, and use the compression method;
Tar-tzf oracle.tar.gz
This command lists all the files in the archive Oracle.tar file list
TAR-XZVF oracle.tar.gz
command to decompose and unzip the archive file into the path of the original file;
RPM Installation
Rpm-i RPM Package Name
Rpm-i tomcat4.rpm The command installs the Tomcat software and configures the relevant system
Rpm-u RPM Package Name
Rpm-u tomcat4.rpm This command will upgrade the Tomcat software and make the relevant system configuration
RPM-QA list all packages that have been installed
You can use the grep command to specify the package name:
Rpm-qa | grep ' Tomcat '
To find out which package a particular file belongs to, use the
RPM-QF filename (Find the name of the file to which it belongs)
To find the functionality of an already installed package, Rpm-qi PackageName
Remove installed packages: rpm-e PackageName
Cat-n File1.txt Displays the contents of the File1.txt file while displaying line numbers
With the "+n" parameter appended to the VI command, the representation needs to be displayed starting from the first line of the Example.txt file:
VI +5 example.txt
VI in last-line mode, enter set number to display line numbers
VI in last-line mode, enter the Nu to display the line number of the row where the cursor is located and the contents of the line
VI Command mode cursor movement:
The H cursor shifts to the left, and a number n is entered before the H command, then the cursor shifts n characters to the left;
The L-cursor moves right and the number n is entered before the L command, then the cursor shifts n characters to the right;
J-Cursor Up, enter the number n before the K command, then the cursor moves up n characters;
K-Cursor down, enter a number n before the K command, the cursor moves down n characters;
0-The cursor moves to the end of the line;
H-Cursor moves to the first line displayed on the screen
The L-cursor moves to the last line displayed on the screen
M-cursor moves to the middle line of the screen
NG: Cursor moves to nth row;
W-or-W cursor moves to the beginning of the next word;
If the start position of the cursor is within the word and not at the end of the word, the command will move the cursor to the ending of this word, and if the cursor starts at the end of the word, the command moves the cursor to the next word ending;
B or B In contrast to e/e, the cursor moves to the beginning of the word
Ctrl+g status Command, which displays the status of the currently edited document, including the name of the file being edited, the current line number, the number of file lines, and the percentage of the entire file before the cursor
: n the cursor moves to the nth line of the file;
: $ cursor moves to the last line of the file;
I: The command is to move the cursor to the beginning of the current line and insert the text before it;
2. VI provides two additional insert commands A and a
A is the new text appended to the current position of the cursor, and the newly entered text is placed after the cursor, and the original text after the cursor moves backwards, and the cursor can be anywhere on a line;
A: is to move the cursor to the end of the line, from there to start inserting new text, enter a command, the cursor automatically moved to the end of the line;
O opens a new line below the line where the cursor is positioned, placing the cursor at the beginning of the line waiting for input text;
o A new line above the line where the cursor is located, placing the cursor at the beginning of the line, waiting for the input text;
X-delete the character at the cursor and precede x with the number n, then delete the n characters from the right at the beginning of the cursor position;
dd-deletes the entire line where the cursor is located, and adds the number n before the DD to delete the contents of the current row and its n-1 rows;
D and d$ command function, are deleted from the cursor at the beginning of the line to the end of the content;
d0-Delete the contents from the beginning of a character to the beginning of the cursor
DW Deletes a word, and if the cursor is in the middle of a word, it is deleted from the position of the cursor to the ending;
NP recovery operation, N is the number of times to recover, such as 2p, the deleted content will be re-inserted two times
Text Copy command:
yy copies the entire line where the cursor is located, plus n, which indicates the contents of the current row and the N-1 row after the assignment
Cancel Previous command: Undo
Command mode input u and u, are canceled just entered the command, restore to the original situation;
Note: You are restoring the current row to the state before it was edited, regardless of how many times the line was edited
U is to revert to the previous operation, revert to the state before using U, and result in nothing
The repeat command works only in command mode, and in this mode, press "."
Search:/and? Can you do that? Search from the current position of the cursor to the head of the file,/from the current position of the cursor to the end of the file
Replace:
All text substitution operations with: start, example
: S/TEXT1/TEXT2 is used to replace the first "Text1" found in the paragraph where the cursor is located with "Text2";
: S/text1/text2 replaces all text1 of the paragraph in which the cursor is located text2
: m,ns/text1/text2/g replaces all searched Text1 with Text2 from M line to N line and can use "1,$" to replace all eligible characters in the document;
Head view text file header and tail view file trailer
Head Example.txt Display the first 10 lines of the file;
Head-n Example.txt Display the first 20 lines of the file
Tail-f Example.txt Displays the following 10 lines, and automatically displays the new file content after the file contents are increased
Ifconfig[-a][-v][-s]<interface>[[<af>]<address]//interface NIC name, address for IP addresses
[[[-]broadcast[<address>]]//broadcast] Sets the broadcast address, address is the IP of the broadcast
[Netmask<address>]//netmask = set Subnet mask
[up|down]//enable current NIC, turn off current NIC
-A view all NIC status
-V View version information for the ifconfig command
-S View statistics
Example: Set the IP address of the first Nic:
Ifconfig eth0 192.168.0.1
To enable or disable the network card:
Ifconfig etho up//ifconfig eth0 down
Set the subnet mask for the first NIC
Ifconfig eth0 netmask 255.255.255.0
Set IP address and subnet mask: ifconfig eth0 192.168.0.1 netmask 255.255.255.0
View the first NIC status Ifconfig eth0
Linux-shell notes