Linux Basic Operation Notes __linux

Source: Internet
Author: User
Tags curl gettext hash iptables

1, view the public IP:

Curl Members.3322.org/dyndns/getip

Expand:

Curl Command

function: Perform download file operation

①curl http://www.baidu.com

Will print out the Baidu home page HTML source code.

②curl-o mbaidu.html http://www.baidu.com

Baidu will be the first page of the HTML source code to download and save to the local mbaidu.html.

③curl-o http://www.baidu.com

Will prompt: Remote file name has no length!

④curl-o http://www.gnu.org/software/gettext/manual/gettext.html

The file will be downloaded and saved to the local gettext.html file, and the following is the download process ( Note that CTRL + C or ctrl+z will interrupt the download ):

[Root@shawnlinux shawn]# Curl-o http://www.gnu.org/software/gettext/manual/gettext.html
% total% Received% Xferd Average Speed time
Dload Upload Total spent left Speed
1375k 947k 0 0 29485 0 0:00:47 0:00:32 0:00:15 42763^c

(The above information is stated in the download to 68%)

⑤curl-o mbaidu.html Http://www.baidu.com-O http://www.gnu.org/software/gettext/manual/gettext.html

Multiple files will be downloaded mbaidu.html and gettext.html to local, and the following is the download process:

% total% Received% Xferd Average Speed time
Dload Upload Total spent left Speed
2381 2381 0 0 14517 0--:--:----:--:----:--:--14518
1375k 1030k 0 0 58138 0 0:00:24 0:00:18 0:00:06 50404^c

⑥curl-u Ftpuser:ftppass-o ftp://ftp_server/public_html/

All files under the public_html directory on the FTP server will be listed.

Ftpuser:ftppass is the FTP username and password, used: connection.

⑦curl-u Ftpuser:ftppass-o ftp://ftp_server/public_html/xss.php

The xss.php file on the FTP server will be downloaded to the local.

⑧curl-u ftpuser:ftppass-t myfile.txt ftp://ftp.testserver.com

Upload the local file myfile.txt to the FTP server.

Curl-u ftpuser:ftppass-t "{file1,file2}" ftp://ftp.testserver.com

Upload multiple local files to the FTP server.

Curl-u Ftpuser:ftppass-t-Ftp://ftp.testserver.com/myfile_1.txt

To save from standard input to a server-specified file


2, view all the files in the directory:

Ls

3. Entry and exit directory

CD MyFolder
Cd..

4. New File

VI index.html
This command will go directly to the Vim Interface Editor. That is, create and edit.

5, VIM editor

Press the I key first to enter the--insert--mode.

and edit it like window editing text.

Press ESC to exit Edit--insert--mode and enter Linux mode.

Enter ": W" to save the edit.

Enter ": Q" to exit the Vim interface and return to the Linux interface.

(Can be ": Wq" save and exit Vim)


6, view the file

VI index.html

will open vim editor index.html

Cat index.html

will be the standard input index.html content.


7, delete the file

RM index.html
will prompt rm:remove regular file ' index.html '?

Enter Y, which means that the deletion is determined and is not recoverable.


8, Network command

① Download Command

Previously, curl can be used to download files or software.

Say another wget order.

wget http://www.gnu.org/software/gettext/manual/gettext.html
Gettext.html will be downloaded locally, following the download process:

--2016-09-21 15:40:17--http://www.gnu.org/software/gettext/manual/gettext.html
Resolving www.gnu.org (www.gnu.org) ... 208.118.235.148, 2001:4830:134:3::a
Connecting to Www.gnu.org (www.gnu.org) |208.118.235.148|:80 ... Connected.
HTTP request sent, awaiting response ... OK
length:1408775 (1.3M) [text/html]
Saving to: ' gettext.html '


27% [====================>] 382,478 33.3kb/s eta 28s


②dns Query

Host Inkbillows.com
The IP of the domain name will be output, such as:

Inkbillows.com has address 180.178.63.180

9. RPM Software Management Tools

① installation Application (only installed. RPM installation packages that have been downloaded to the local area)

-I,--install install package (s)

It can also be used in conjunction with the following command:

-V,--verbose provide more detailed output

-H,--hash print hash marks as package installs (good with-v)

Therefore, the execution of the installation commands often:

Rpm-ivh

This allows you to display the installation details along the installation side.

You can choose to force the installation:

--replacefiles Ignore file conflicts between packages
--replacepkgs Reinstall if the package is already present

--force short hand for--replacepkgs--replacefiles

--nodeps do not verify package dependencies

② Upgrade Application

-U,--upgrade=<packagefile>+ upgrade package (s)

Such as:

Rpm-uvh

③ Uninstall Application

-E,--erase=<package>+ Erase (Uninstall) package

Such as:

Rpm-e


RPM-IVH file.rpm #[Install the new Rpm]--install--verbose--hash
RPM-UVH file.rpm #[    upgrade a rpm]--upgrade
rpm-e file.rpm    #[Uninstall a rpm]--erase

④ See if the application is installed

Query options (with-q or--query)

-A,--all query/verify all packages
-F,--file query/verify package (s) owning file

Such as:

RPM-QA, all installation packages will be listed;

Rpm-qa|grep httpd, the installed HTTPD package will be listed.


10, Yum Software management tools

Yum's mission is to automate upgrades, install/remove RPM packages, collect information about RPM packages, check dependencies, and automatically prompt users to resolve them.

① Installation Application

Yum-y Install httpd

② Upgrade Application

Yum Update httpd

③ Uninstall Application

Yum Remove httpd

④ See if the application is installed

The Info option allows you to view application description information:

Yum Info httpd


11, start Apache

Service httpd Start Services httpd Restart Restart service httpd Stop server

12. See if Apache starts

Ps-ef | grep httpd*

Expand:

① Vertical bar (|)

Command 1 | Command 2 His function is to pass the result of the first command 1 execution as command 2 input to command 2.

such as: Ls-s|sort-n

②grep command

Grep:global Regular expression print, using regular expressions to search for text and print it.

grep [Options]:

-V: Displays all rows that do not contain matching text.

③ps command

-e Select all processes. Identical to-a

-F do full-format listing. This option can is combined with many the other Unix-style options to add
Additional columns. It also causes the command arguments to be printed.


13. Turn on/off the firewall

① Open/Close iptable

Service Iptables Start

Service Iptables Stop


② Open/Close Firewalld

Systemctl Start Firewalld

Systemctl Stop Firewalld

Disable FIREWALLD, the system does not automatically open FIREWALLD after reboot:

Systemctl Disable FIREWALLD

To view the FIREWALLD status:

Systemctl Status Firewalld


Expand:

Netstat command

①-a

List all current connections (show domain name resolution)

②-n

Does not use the domain name resolution display, displays the IP.

③-p

displaying process information

④-u

Show UDP protocol connections

⑤-t

Show TCP protocol connections


Such as:

Netstat-anput

The list of connections indicated is listed.

Netstat-anput | grep 8080

Lists the connections that match 8080 to see if the specified port is open for listening.


14. Find Files

Find. -name httpd.conf

http.conf This file will be found in the current directory and its subdirectories and printed out in the directory.

Find ~-name httpd.conf
The httpd.conf file will be found in the root directory and its subdirectories.

Find/-name httpd.conf
The httpd.conf file will be found in the root directory and its subdirectories

15, upload the download file

Rz
The Windows Selection File dialog box opens, the selected file is clicked on, and the execution is uploaded to the Linux server. Adopt Zmodem protocol.
SZ index.html
Opens a dialog box for the location where you choose to save Windows, saves the location after the selection, and index.html the Linux server to the selected location.

Note: Only single or multiple actions for a file are not supported for the entire operation of the files in the folder and its directories.


16, switch to the background

① in front of the command to execute

such as the Jar/war package generated by the Springboot project, by:

Java-jar Boot.jar

Execution will remain running in the foreground so that no other commands can be executed, and you need to cut to the background:

First, Ctrl+z.

Then, BG 1

Can be cut to the background,

Can pass

Jobs

View the running status in the background.

However, you cannot close Xshell, otherwise the task will stop automatically, and if you need to run in the background, you need to:

Nohup Java-jar Boot.jar

This is the background boot service, if you want to view the background service:

Ps-ef | grep java

You can view the status of the Java-jar Boot.jar command in the background, that is, the service that the command starts.






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.