Some commands for Mac computers

Source: Internet
Author: User
Tags tar unzip

Terminal command:

PWD Displays the current path
CD Dst_dir jump to a different path, either with a relative path or an absolute path:
Example: CD/skip to root Path
Cd.. Jump to Parent Path
Cd.. /.. Jump to upper ancestor path
CD jumps to the home directory of the currently logged in user
CD ~ Jump to the home directory of the currently logged in user

Absolute path: A path that begins with '/', or a relative path
If you want to jump with a relative path, ask for the current path and relative
The path is exactly the absolute path of existence.
LS can list all files and folders under the current path
LS-L lists the details of all files and folders under the current path
LS-A lists all files and folders under the current path, including hidden files and hidden folders, packages
Enclosed. And..
LS-LH displays the size of the file in units such as K,m,g
Touch file_name creates a new file under the current path, and the file name
It's file_name.
Touch/users/qianfeng/test/new_file This means that the absolute path and file name are used in the
New file under Other path
Touch file1 file2 file3 Create multiple files

mkdir New_dir Create a new folder under the current path New_dir
Mkdir/users/qianfeng/test/new_dir Create a new folder under absolute path New_dir
Mkdir.. /test/new_dir creates a new folder with a relative path under other paths New_dir
mkdir dir1 dir2 dir3 Create multiple folders


RM file_name Delete a file
RM file1 file2 File3 Delete multiple files
Rm-r Dir1 Delete a folder
Rm-r dir2 dir3 DIR4 Delete multiple folders

CP src_file New_dir Copy the source file to the other folder (New_dir) below
CP Src_file new_dir/newname Copies a copy of the source file into another folder and
Rename to NewName
MV Src_file New_dir cut the source file to the bottom of the other folder
MV Src_file New_dir/newname cut the source file to the bottom of the other folder and
Name is NewName
MV Old_name new_name Renaming files

The man command name indicates a manual for viewing this command
Example: Man CD
Mans mkdir
Mans Touch
Ifconfig View the status of each network card,
Ping IP See the network from this machine to this IP is not through
The route IP looks at the routing node from the native to this IP

some basic commands for Vim
is an editor under the terminal

The VIM file_name will enter the General Command mode:
Operations that can be performed in general Command mode:
I or a or O can enter edit mode
: w Save the edited file contents
: Q Quit Vim
: Wq Save and exit
: q! Do not save and exit
: w! Force Save
H move the cursor to the left
J Down
K Up
L Right
DD Delete the line where the cursor is located
DD N Delete n rows starting at the line where the cursor is located
U recall the behavior of the previous step
YY the line where the cursor is copied
yy n the N rows at which the line of the copy cursor begins
P Paste the next line in the row where the cursor is located
V Enter the visual mode, after entering the visual mode can use HJKL to move the cursor selected
Text
: Set Nu = = Set Number sets line numbers
: Set Nonu = = Set Nonumber Cancel line number
: N Positions the cursor on nth row
Control + F PAGE Down
Control + b PAGE Up
GG cursor back to top of file
SHIFT + G cursor back to the last line of the file
/string indicates that a string is found in the current file from the head
A string that finds a string in the current file from the tail
SHIFT + 4 Positions the cursor at the end of the row
SHIFT + I positions the cursor at the beginning of the row



What you can do in edit mode:
1, you can edit the file
2, press ESC to return to General Command mode


Supplemental terminal commands:
TAR-CVF Pakage.tar file1 file2 file3
File1 file2 File3 These three files into a
A compressed package Pakage.tar
TAR-CVF Pakage.tar dir means the directory Dir and all files in that directory
and folders into a package
TAR-XVF Pakage.tar Unzip the compressed package Pakage.tar under the current path

Some commands for Mac computers

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.