In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about what the CLI command is about. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Wget
On Unix-like operating systems, the wget command downloads files for HTTP, HTTPS, or FTP services over the network. By default, it is included in all self-weight Linux distributions.
The easiest way to use wget is to provide it with the location of the file you want to download through HTTP. Download files using wget
Http://website.com/static/images/header.jpg can be done with the following command:
Wget http://website.com/static/images/header.jpg
One of the great advantages of wgetwget is that it is non-interactive, which means that it can run in the background when the user is not logged in. This allows you to start retrieving and disconnecting from the system, letting wget get the job done.
Scp
Have you ever encountered the problem of getting files from a remote server on your local computer? For example, getting files uploaded by users can cause some trouble.
You can download this file from the command line using the scp command. Scp is short for secure copy. More importantly, however, it is a remote secure copy. This command is similar to the cp command that you may already know, but the source or destination is on another system.
The following command copies the file foobar.txt from the remote server to the local directory.
Scp username@remotehost.com:/path/to/foobar.txt / some / local / directory
But scp can also be used to copy files from a local directory to a remote server.
Scp / some/local/directory/foobar.txt username@remotehost.com:/ destination / path /
Use the-r option to do the same for the directory, which copies the entire directory recursively.
Ssh-keygen
The ssh-keygen command is used to generate a new SSH key pair. You can use the public SSH key generated by this command in Gitlab or Bitbucket to establish a secure connection.
After you add a SSH key to Gitlab or Bitbucket, you are not prompted for a password every time you try to push a file to a remote branch.
To generate an SSH key pair, use the following command:
Ssh-keygen-t ed25519
Note that in the example above, we used the ED25519 signature algorithm. Although ED25519 is considered a best practice, you should always do some research on the different signature algorithms available.
It takes up to ten minutes (about three minutes) to generate a SSH key pair and set it correctly in Gitlab or Bitbucket, but it's totally worth it!
Chmod
In Unix and Unix-like operating systems, chmod are commands and system calls that change access to file system objects (files and directories).
According to Wikipedia, this is the definition of the chmod command. The server cannot access a file due to a misconfiguration of file permissions.
The chmod command itself is very simple, but giving correct permissions to files and directories is another matter.
Ssh-keygen-t ed25519
The first example grants read and write permissions to users and groups of robots.txt files. Read permission is granted to the file.
The second example grants read, write, and execute permissions to users and groups for the public / images folder. Others are granted read and execute permissions on the folder.
If you want to learn more about setting the correct permissions for files and directories, it is recommended that you read the Wikipedia page about chmod.
Tar
Linux tar stands for tape archiving. It is used to collect many files into an archive file. Tar is the most widely used command for creating compressed archive files.
Let's start with how to create an archive file for a specific directory:
Tar-cvf my-archive.tar / path/to/directory
This command will result in an archive file called my-archive.tar, the tar file, which contains all the files in the / path/to/ directory created in the current working directory.
Creating an archive file is the first step. The second part includes unzipping the archive file because at some point we want to use the files in the tar file. You can extract the file to a specific directory by typing the following command:
Tar-xvf my-archive.tar-C / home / myfolder / alias
Everyone uses commands that are too long or too complex to fully remember. Fortunately, you can create an alias for this command, so you don't have to remember the entire command.
Alias short-command= "your custom and very long command here"
Although there is a problem with creating an alias in this way: this alias is temporary. If created in this manner, the alias is only available for the current terminal session.
To keep alias between sessions, you can save it in the user's Shell configuration file. If you use Bash or ZSH respectively, this configuration file may be located in ~ / .bashrc or ~ / .zshrc.
Tip 1: direct output
The screen is a standard output device. But sometimes you don't want to output everything on the screen. In some cases, you may want to output the results of some commands to a file.
For example, for logging purposes. To redirect the output, use >. In the following command, the output of ls-al is redirected to the file myfile instead of the screen.
Ls-al > myfile
In this example, I used ls, but it could actually be any command with some output. To confirm that this is feasible, you can check the myfile file.
Tip 2: merge commands
You can run two or more commands at a time. The semicolon (;) operator allows you to do this. You can execute multiple commands in succession, regardless of whether each previous command was successful or not.
Ls-al; pwd
If you want to run the second command only if the first command is successful, separate the command with logic and operator (that is, & &).
Mkdir images & & cd images
If we try to create a folder, we just want to CD to the images folder.
Sometimes you may only want to execute the second command if the first command is unsuccessful. To do this, we use the logical OR operator, that is, |.
Thank you for reading! This is the end of this article on "what are the CLI commands?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 245
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.