Ubuntu Terminal Basics Command

Source: Internet
Author: User
Tags bz2 readable

1. Shortcut keys for starting the terminal: Ctr + ALT + T
2. Terminal Font enlargement:ctr+shift+ ' + '
3. Terminal Font enlargement:ctr+ '-'
4.ls: View file information for the current directory
4.1ls Path: View information for the specified directory
4.1.pwd: View the path where the directory is located
5. Touch : Create File
5.1Touch 1.txt 2.txtCreate multiple Files
6.mkdir: Create a folder
7.rmdir: Delete Empty folders
8.RM: default deleted files, prompt: Delete folder need to add-r option,-r: Recursively delete all files in the folder
9.CD: Switch Directories
9.1:CD Directory Name: Switch to the specified directory
9.2:CD.: Switch to the current directory
9.3:CD.: Switch to the previous level directory
9.4:CD ~: Switch the directory where the user is located
9.5:CD: Switch User directory, equivalent to CD ~
9.6:CD-: Switch to the previous directory
10. Absolute path: The path from the root directory is the absolute path
11. Relative path: The path from the current directory is the relative path
12. Summary: If the directory you want to enter is not near the root directory and the current directory, use the absolute path uniformly
13. Auto-complete: Two-times Tab key
14.CP: Copy
14.1 CP file name path: Copy the file to the specified path (specified directory)
14.2 cp filename Path/new file name: Copy the file to the specified path, and then modify the assigns filename
14.3 cp Folder path-r: Copy folder to specified directory, hint: need to add-r option
14.4 CP Path/filename path/New file name: Copy the file under the specified directory to the new directory and rename it
14.5 CP filename New file name: Copy file to change the file to a new filename, the original file still exists
15.MV: Move
15.1 mv filename Path: Move the file to the specified path (directory)
15.2 mv filename Path/new file name: First move the file to the specified directory and rename it
15.3 MV Path/File name destination path/new file name: Move the specified file into the target path and rename it
15.4 MV filename New file name: rename
16.Tree: Displays directory file information as a number of directories
16.1 Tree Path: View information about the trees of a specified path
17.Cal: View the calendar for the current month
17.1 cal-y: View calendar year-round
18.Date: Current Time
18.1 Date "+%y%M month%d day%h:%m:%s" gets the current time of year and month day very second
19. History: View history commands
19.1! History Command Number: Execute the specified command
20. Format of TERMINAL commands
20.1 command name command option parameter-"command name (LS, CP, MV) command option (-r) parameter (file name or path), hint: options and parameters can be swapped position, but if the error option needs to be added after the command,

For example: Scp-r
20.2 options and parameters for a command can have multiple or no

21. View Help
21.1--help: Command--help
21.2Mans: Man command
22.RMThe options
22.1- I.: A message reminds you when you delete a file or a folder
22.2- R: Delete all contents of the folder in a recursive way
22.3- D: Delete Empty folders
22.4- v: Displays post-deletion description information
22.5- F: Deleted file does not exist without error, if there is a direct delete
23.lsOptions
23.1- L: Displaying file information in list mode
23.2 -A: Show hidden files
23.3- H: Displays the unit size of the file
23.4ll:->ls-al
23.5 L :-> ls
24. mkdir Options
24.1- P: Create the folder you depend on in advance.
25. CP Options
25.1- F: direct override, default CP is also overlay, generally not set
25.2- I. : If the file has a display reminder
25.3- v: Displays the path description after the copy
25.4- R: Recursively copy all the contents of the folder in the past
26.MVOptions
26.1- I.: If the file has a display reminder
26.2- v: Shows the path description after the move
26.3- F: direct override, default MV is also overlay, usually not set
27. Redirect (>>): Re-specify the direction of the display, the terminal display of the contents of the file, and later to view the information in the file to view it
27.1 > Represents the W mode that is equivalent to the file operation if the file exists before the contents of the file are emptied and then written
27.2>>Indicates that if a file exists, append writes to the original data, which is equivalent to the A mode of the file operation
27.3 Summary: Commands that can be combined with redirects: ls, tree cat
28. More: Split screen Display
28.1 F: Next page (space)
28.2 B: Previous page (only for files, combined with pipeline use the previous page can not see (b no use))
28.3 Enter: Next line
28.4 Q: Exit

gedit: Commands for text editing tools that can be read and writable
Cat: View the contents of the file at the terminal, read-only and cannot be edited, hint: only for small files
Integration of cat 1.txt 2.txt > 3.txt files
Pipeline, can be understood as the storage of data containers
32.1. Commands that can be used in conjunction with pipes are: LS, cat, tree, etc.
33. Links
33.1 Soft Links: Like a shortcut, the original file deleted after the shortcut can not be used, note: Create a soft link does not

Will add 1 to the number of hard links
33.2 Hard links: Like a person has more than one name, a name does not apply, through other names can be found after this

person, meaning: original file delete through hard link file still can get file data, note point: Create Hard link,

The number of hard links will be added 1, can be combined with reference counting to understand the number of hard links

33.3 Note: Folders cannot create hard links, but can create soft links
33.4 Pit Point Summary: If you create a soft link and the original file is not in the same directory, then the path of the original file using absolute Road

such as: Ln-s/home/python/desktop/abc/1.txt ~/desktop/1-s.txt

33.5 Supplement: Why create a soft link if you do not have to use the absolute path in the same directory as the original file, because

The default is to open the soft link in the current directory to find the original file, so you need to specify the path of the original file

grep: Finding the specified content in a file
34.1-n: Display Line numbers
34.2-i: Ignoring case
34.3-V: Reverse Based on content
Supported wildcard characters: ^, $, [123],. Use the way grep "^a" 1.txt-n
Find: finding files in a specified directory
35.1-name: Search by file name
35.2-size: According to the size to find, but not accurate, generally do not
35.3-perm: Based on file permissions to find
Supported wildcard characters: *,? [], *: Match 0 or more characters,?: Matches any one of the characters [35]: matches any one of the enumerated

of characters
How to use: Find. -name "*.txt"
36. ls : View file information by wildcard character
Supported wildcard characters: *,? , []
Summary: Wildcard character is the function of fuzzy query
How to use: LS *.txt, note the dot without double quotes
37. tar packaging
37.1 TAR-CVF Test.tar *.txt Test.tar Note is in package, no compression
38.gzip Compression
38.1 gzip Test.tar-test.tar.gz Compression pack
39.tar packaging and compression
39.1 TAR-ZCVF test.tar.gz *.txt test.tar.gz Compression pack
39.2-z: Compression-C: Package V: Show package file information F: Specify document name
40.Tar unpacking
40.1 TAR-XVF Test.tar-pack inside the file
41.gzip Unzip
41.1 gzip-d test.tar.gz, Test.tar bag
42.Decompression and unpacking of tar
42.1 tar-zxvf test.tar.gz. zip file inside the package
42.2-c: Extract to the specified directory TAR-ZXVF test.tar.gz-c./123
43.bz2 Compression and decompression
43.1 TAR-JCVF test.bz2 *.txt test.bz2 Compression pack
43.2 tar-jxvf test.bz2. zip file inside the package
43.3 TAR-JXVF Test.bz2-c 456 Unzip the package to the specified path
44.zip compression and decompression
44.1 zip Test[.zip Optional] *.txt->test.zip compression Package
44.2 Unzip Test.zip get the files inside the package
44.3 Unzip test.zip-d 567 unzip the package to the specified path
45.chmod: Modify Permissions
45.1 user role: U: Current user g: Same group of users o: Other User A: all users
45.2 Permissions: R (4): Readable W (2): Writable x (1): Executable
45.3 using the letter method to set the file readable writable executable chmod a=rwx 1.txt
45.4 using the digital method to set the file readable writable executable chmod 777 1.txt
45.5 using the alphabet to set the file does not have permissions chmod a=-1.txt or chmod a= 1.txt
45.6 setting files without permissions using the Digital method chmod 1.txt
45.7 setting permissions for different users by using the alphabet: chmod u=r,g=w,o=rw 1.txt
46.CPOptions
-A: Preserves file permissions for other users,-a contains the-r option which means that-a can copy the folder
47.which: View the location of the command (path)
47.1 which LS
48.sudo-s: Switch to Administrator
49. The execution of the command does not have sufficient authority to precede the commandsudo, for example: sudo apt-get install SL
50. W.H.O. : View the currently logged in user
51.WhoAmI: Current User
52.passwd: Change Password
53.Exit: Exit User
54.SCP: Remote Copy
54.1 SCP 1.txt [email protected]:/home/python/desktop-] Copy the local files to the remote server
54.2 scp-r test [email protected]:/home/python/desktop-] Copy the local folder to the remote server
54.3 SCP [email protected]:/home/python/desktop/1.txt. -"Remote copy of server files to local
54.4 scp-r [email protected]:/home/python/desktop/test. -"Remotely copy the server's folder to a local
55.SSH: Remote Login
56.VimThe use
56.1 vim Mode: Command mode, edit mode, last line mode
56.2 command mode into edit mode: I Command mode enters last-line mode: colon (:), prompting the editor not to enter the last line mode need to enter through the command mode, command mode is the mode of editing and the terminal mode of the broker
56.3 edit mode and last line are into command mode:ESC
56.4 yy : Copy cursor line, prompt:3yy: Copy the row of the cursor and the following two rows of data
56.5P: Paste, Tip: Paste multiple times: digital +p
56.6DD: Cut (delete)
56.7 V : Select the line that the cursor is passing through, and tip: Copy the line that the cursor passes through: Y
56.8shift+6: Back to the beginning
56.9 shift+4 : Back to the end of the line
56.10G: Back to the last line
56.11GG: Back to First line
56.12Digital +g: Returns to the specified line
56.13 x : Delete data from previous
56.14X: Delete data from the back and forth
56.15 up or down, on:kUnder J Left:hRight:LYou can use the arrow keys up or down
56.16ctr+f: Take a look at the next pagectr+b: one page
56.17 queries:->: /1N: View Next ContentN: View previous Content
56.18 Replace:%s/1/2/gGlobal substitution%: Entire files: Replace1: Original content2: Post-replacement contentg: Global
56.19 replacing the specified line contents: 38,39S/2/3 Replace 38, 392 rows of data
56.20u: Undo
56.21 SHIFT + > Indent Right shift+ < Indent left
56.22 .Repeat Last Action
56.23 : Wq = : x  Save exit: wJust save

Terminal network

1. Network: A tool that connects two or more devices (computers, smartphones, ipads, etc.) together
1.1 The purpose of the Learning Network: to transfer data from one party to another through the network to complete the sharing of data
2. IP Address
2.1:IP Address: Identifies a single device in the network
2.2. The role of IP address: To find a unique device by IP address, and then send data to the device
2.3. IP addresses are divided into IPv4 and IPv6, IPv4: Dotted decimal ipv6: hexadecimal data
3. Private IP: The IP address used in the LAN
3.1 192.168.xx.xx 172.16.xxx.xx 10.0.xxx.xxx
3.2 Native IP address: 127.0.0.1 native domain name: localhost
3.3 Domain name convenient for everyone to remember the IP address of a computer, domain name and IP address one by one corresponding
3.4 Ping 127.0.0.1 indicates that there is no problem with your computer's network card
4. ifconfig & Ping
4.1 ifconfig: View network card information, Window:ipconfig
4.2 Ping: Check the network for problems
4.3 Ping 127.0.0.1 Indicates that there is no problem with your computer's network card
4.4 Ping 192.168.36.104 instructions in the same LAN
4.5 Ping www.baidu.com instructions to surf the internet
5. Port:
5.1 Port is a channel of data passing in and out, like the door of the classroom
6. Port number
6.1 Port number: Use a unique number to represent a port with a range of 0-65535
6.2 Well-known ports: range of port numbers used by the system: 0-1023
6.3 Dynamic Port: The number of ports the programmer can set to the program: 1024-65535, if you do not set the port number for the program, then the system automatically in the dynamic port range to find a free port number to set the program
6.4 Netstat-an View those port numbers in use
6.5 lsof-i[tcp/udp]:8080 find the corresponding application based on the port number
6.6 Tip: If you look at other users ' applications, you need to add sudo, for example: sudo lsof-i:3306
6.7 kill-9 process number: Strong kill process
7. Network communication process
7.1 Locate the corresponding device via the IP address, then locate the port via the port number and then pass the data to the application
8. Socket
8.1 Socket is a socket, is the data of the porter, is responsible for the data from one side to the other side, to complete the communication between the different computer process tools

Ubuntu Terminal Basics Command

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.