For the front end, NPM install -g XXX after XXX, XXX is the most common command line operation… After all, you even have to interface with Git.

Say some common operations, after mastering, in Linux can also show a, not happy?

ls

Display details by line
ls -l
# display by line, and show hidden files
ls -la
Copy the code

cd

This has the same effect as adding nothing after the CD.
cd~ /# Enter the parent directory note.. It has to be preceded by a space
The path operator also has a CD. Try it yourself
Then you can see why fs.readdir returns. And.. Two operators
cd.Copy the code

In addition, use the TAB key, can automatically complete; If you have two directories ABC and abd and you only type AB, TAB will list all directories ab*. This is common and easy to use, support Chinese, type blackboard.

ssh

Logging in with a password is insecure and cumbersome. If SSH is configured, you can directly

ssh [email protected]
Copy the code

You can log in, which is called a secret free login.

If you’ve ever logged in to Git using SSH, the default key pair has already been generated locally. Take a look first:

% ls -l ~/.ssh total 24 -rw------- 1 kema staff 2602 10 21 2020 id_rsa -rw-r--r-- 1 kema staff 572 10 21 2020 id_rsa.pub  -rw-r--r-- 1 kema staff 3127 5 22 10:04 known_hostsCopy the code

If no, use

ssh-keygen

Create key:

# if ~/.ssh does not exist
mkdir ~/.ssh
cd ~/.ssh
ssh-keygen -t rsa -C "comment" -b 4096
Copy the code

If there is no default key pair, press enter. If you want to create a new one, you can

Creates a key pair with the specified name

ssh-keygen -t rsa -C "test-rsa" -b 4096 -f test-rsa
Copy the code

All the way back to the car, when finished, take a look:

% ls -l ~/.ssh total 40 -rw------- 1 kema staff 2602 10 21 2020 id_rsa -rw-r--r-- 1 kema staff 572 10 21 2020 id_rsa.pub  -rw-r--r-- 1 kema staff 3127 5 22 10:04 known_hosts -rw------- 1 kema staff 3369 6 28 19:46 test-rsa -rw-r--r-- 1 kema staff 734 6 28 19:46 test-rsa.pubCopy the code

Log in using the default public key (ID_RSA)

Copy the contents of the local default public key

% cat ~/.ssh/id_rsa.pub ssh-rsa AAAAB3NzaC1yc2E.... AxnM8c= [email protected]Copy the code

You can see a bunch of characters at the beginning of Ssh-RSA (the line inside is the Mosaic I typed). Select and copy all these words.

Record the public key (authorized_keys) on the server

Log in to your server and create the ~/.ssh/authorized_keys file (if it doesn’t exist) :

mkdir ~/.ssh
touch ~/.ssh/authorized_keys`
Copy the code

Write public key:

echossh-rsa AAAAB3NzaC1yc2E.... AxnM8c= [email protected] >> ~/.ssh/authorized_keys`Copy the code

In addition to remember your current user name: username dog, for example, the public record location as/home/dog /. SSH/authorized_keys.

At the next login, enter:

ssh [email protected]
Copy the code

I can log in directly.

Log in using the specified key pair

Let’s copy the test-rsa.pub content we just generated and put it into the authorized_keys file on the server in the same way.

Then execute:

ssh -i ~/.ssh/test-rsa [email protected]
Copy the code

Login succeeded.

Git with ssh-key

git config core.sshCommand "ssh -i ~/.ssh/test-rsa"
Copy the code

Continuously updated

If you think of it, let me stop here.