1. File Operation commands
1. Create a file
The Touch command is in the same directory/bin/touch
Touch FileName//Create an empty file
2. Switch directories
CD or CD ~//Back to home directory
CD-Return to previous catalog
CD!$ switch to the previous catalog
Cd.. /return to upper level directory
3. Show current directory
Pwd:print Work Directory
4. Copy command
CP Copy files or directories
Cp–a-f-P Source file directory
Cp–a copy directories and subdirectories of subdirectories destination files or directories
Cp–f forced replication
Cp–p copy retains the original file attributes, including creation time
5. Delete command
Rm–i Files/Directories
Rm–f Force Delete
Rm–r Deleting a directory
6. Move files
MV Source File Destination file
MV Oldname newName Rename
7. View Files
Cat filename//Disposable view, read all
More filename//split screen display by Space: Next page (or press f) Enter: Next line Q: Exit
Less fileName//space or F: Next page pageup previous page PageDown next page you can also use the up or down key
Head-n fileName view Top N rows
Tail–n FileName View after a few lines
tail–f filename//real-time viewing of files
2. Directory Operations Command
1. Link files
Ln–s source file Destination file (soft link)
ln file1 file2 (hard link)//cannot span partitions df–t
2. Create a Directory
MKDIR–P//Continuous creation of directories
3. Deleting a directory
RmDir Delete Empty Directory
Rmdir–r Directory//delete directories and directories under the file-F mandatory
RMDIR–P//Continuous deletion
4. View the directory where the command is located
Whereis command//Display system commands and the directory where the Help manual is located
5. Get a description of the command
Whatis ls
6. Find commands
Find search Path search keyword file or directory
Find/etc/–name F FileName
Locate File//Locate the directory where the file is located
Description: The new file cannot be searched because the new file has not been indexed in time, and if you are indexing, use the UpdateDB command to update the index database.
7. Search for content in files:
grep//search string in file-V Exclude string-I case insensitive
8. Help
Man command
Note that man has man1 man3 man5, the default is Man1
--help
Info
3. Compression commands
1.gzip compression
Gzip–1 means fast compression//Cannot compress directory
Gzip–9 Best State compression
2.gzip Decompression
Gunzip file name
Gzip–d file name
3.tar Packaging
TAR–ZCVF Packing Compression
TAR–ZXVF Decompression
4. zip compression
Zip–r compressed file name to compress directory//Compressed directory
Zip–f
UNZIP-A//Decompression
5. Send a message
Write root//Send message to root user
CTR +d End Send
Wall XXX//Send message, all users can receive
msg N//Do not accept messages
Msg y//continue to receive messages
6. Send mail
Open Mail server: Service sendmail start
Mail user name Enter the subject content cc (CTR +d end content)
Mail by number key, indicating the first few letters R: Reply Q: Exit
7. Network-related commands
Ifconfig//View IP configuration
Ifconfig eth1 192.168.1.119
Ping//See if the network is connected to-C send how many times-I wait a few seconds to send the-r display route
8. Turn off the machine
Shutdown–h now or Init 0
Reboot Restart Init 6
Linux command details-common commands