1: ls related options:
-A: This option can display hidden files starting ".".
-I: displays the inode number of each file,
-R: list all sub-directory layers at the same time
-L display in long format
-F: Display suffix
# For example:
Directory test/
The executable file ls * is followed by a * number.
The document test has no special display
2: Clear screen:
Clear
Shortcut Key ctrl + l
3: date
Use the date command to display and modify the system time on linux,
Modification Method: date MMDDhhmmyy
MM Month: 0-12
DD: 1-31
Hh hour: 00-23
Mm: minute 0-59
Yy, 1970-2037
# Administrator permissions required for Modification
Example: change the date to 2010, January 1, August 29
Date 082917302010
4: create a directory using mkdir
-P: Create a multi-level directory
-M: grant the directory permission value when creating a directory.
Example:
Mkdir-p/name/a/B/c/d
Delete an existing multi-level directory:
Rmdir-p/name/a/B/
# If-p is not added here, only the last directory can be deleted at a time.
If-p is added, it can be deleted once.
When deleting a directory, it must be empty.
5: delete command: rm
-I you need to manually confirm before deleting the file
-V display information when deleting an object
-R: Directory deletion-f ignore prompt
6: Copy command: cp
-A: the effect of this parameter is the same as that of the "-dpR" parameter.
-R recursive processing: All files in the specified directory are processed together with subdirectories.
-P: Keep the directory permission after replication.
-V displays the progress when copying files.
-F if the target file name is duplicated during copying, the original file will be deleted,
# Cp-vRp/etc/home/usr/test
7: mv cut File
Apart from moving files, music videos can also be used to modify file names.
Syntax format: mv [source file and directory] [target file and directory]
-F interactive operations are prohibited. When an mv operation overwrites an existing target file, no instructions are given. If this option is specified, the I option will no longer work.
-Ask the user before overwriting.
# Mv aaa/redhat cut aaa to the/redhat Directory
Mv install. log install to change install. log to install
8: pwd shows the current location
All users can use
9: cd command for directory Switching
This is an internal shell file and does not exist in any directory.
Direct cd or cd ~ You can go back to the home directory
Cd-switch to the previous working directory
Cd... also switch to the upper-level directory
Cd! $ Return to the directory involved in the previous operation
10: touch creates a text file
Example: touch a.txt // you can create multiple documents at a time.
# Touch/a/{a, B, c}
# Touch a B c
The above two methods can be used
If you want to input the content in the document in addition to vi, you can also write: echo "content"> a.txt
11: Command for viewing text files
Cat view the short point file // display all at once no matter how many times
-N: Number of all output rows starting from 1
-B is similar to-n, except that the blank row is not numbered.
More
Display file content by PAGE
B. Flip the page and press a space to exit q or Q.
If you want to view one page, you can use less
If you only want to view the first three rows of head-3 password, you can only view the first 10 rows by default,
The tail-4 file name looks at the last few lines of the file,
The tail-f file name allows you to view dynamic files in real time and Monitor Trojan attacks at any time.
12: mount
Example: mount-t ext3/dev/cdrom/mnt/cdrom if-t is not added, the file system type is not specified.
Umount-a unmount all mounted
-T supports FAT32 NTFS EXT2 EXT3 ISO9660.
Unmount example: umount/mnt/usb
13: ifconfig view the current Nic Configuration
-A. view the configuration information of all NICs.
Ifconfig eth0 192.168.0.106 netmask 255.255.255.0 up
That is to say, changing the current IP address to a temporary IP address reboot will disappear.
14: ln generate a link file
Ln-s [source file] [target file]
Note: absolute paths must be used for source and target files.
A hard Link means that a file can have multiple aliases.
A soft connection is used to generate a special file. The file content points to another location.
Ln file1 file2 file 1 link to file 2 This is a hard link and cannot be linked across partitions
Ln-s file1 file2 soft link can be cross-File System
Example:
The file here is a directory:
Ln-s/root/passwd/home/redhat # The file alias must not be created
If passwd->/root/passwd is displayed, the connection is successful.
Hard link: directory cannot be connected
Ln a.txt the www file must be not created when it is connected.
Purpose: To change the source file, the target file will be changed, and the source file of the target file will be changed.
15:
Whereis displays the directory where system commands and help manuals are located
Whatis command name
For example, whatis ln shows what this command is.
16: SEARCH Command
Find [search path] [Search Keyword] [file or directory]
[Root @ root ~] # Find/etc-name f *
Explain this command to find all files starting with f under/etc.
SEARCH Command: more convenient than find
Locate needs to use this frequently: updatedb needs to be updated frequently
Usage: locate a.txt
Grep Content File
Grep-v # exclude files #
17: HELP command:
Manual
Press Q to exit help in man ls format
Command -- help
Info ls
18: File compression
Gzip-1 file: the fastest compression speed
Gzip-9 file compression works best
But the directory cannot be compressed.
Extract
Gunzip file.gz
Gzip-d file.gz
Tar packaging command
-C. A. tar file
-V viewing compression process
-F: Specify the compressed file name.
-
Format: tar cvf jesse.tar a.txt. Compress a.txt into a file named jesse.tar.
For common compressed directory commands:
Tar zcvf file.tar.gz dir
Unzip the command:
Tar zxvf file.tar.gz
19: communication between servers
Communication between users on the same server
Write User Name
Instant Messaging
Ctrl + d End message
The root user sends messages to the group.
Wall mass messaging
Common users can also use
Wall happy new year!
Mesg n message shielding
Mesg y
Blocking common user commands
However, the Administrator's message cannot be blocked.
Email:
1: First enable mail service
Command: service sendmail start
2: mail User Name
Write content
Ctrl + d End Content
3: receive
Mail
Enter
Reply directly to r
Do not want to reply q to quit
20: Switch host command
Shutdown-h now shut down immediately
Init 0 Shutdown
Poweroff
Halt
Reboot restart
Init 6 restart
Shutdown-r now restart
Shutdown-h 10 minutes later shutdown
This article is from the "jesse's blog" blog