Common linux operations

Source: Internet
Author: User

 

The linux operating system has been used for a long time, and many versions have been installed (red-flag linux turbo linux fedro ubuntu many versions such as redhat), but it has not been in-depth and I have never insisted on it, so it's still a newbie. I needed to test new features at the company last week, applied for a machine (for linux), and switched to ubuntu11 at home. 10 (windows is too slow ). For new users, and for new linux users who want to get started, I will summarize the commonly used commands that I feel very useful in use, it is also convenient for future use.

The sudo operation is too important. In linux, user permissions are more common or strict. sudo is executed as root. Note that you need to add sudo to operations on some files, such as cp rz scp. Otherwise, the Operation will fail and linux will not give you any prompts! Example: sudo rz

 

Cd command is also available on windows platforms. Cd will be transferred to the current user's home directory, usually/home/user name. Go to the top-level directory cd.

Ls to view the files in the current directory.

Like ls, ll lists detailed information about the file, including permission information and modification time.

 

Rz uploads local files to the server. In the company's deployment environment (the test server is remotely connected through tools such as ssh), it is generally downloaded from the local machine and uploaded to the server. This command is required. After sudo rz is executed, the file selection box is displayed. Select the file to be uploaded.

In addition to uploading files locally, scp may also copy files from a configured environment. In this case, use the scp command. Generally, the target path of The sudo scp files source file is used (do not forget to add sudo ). Example: sudo scp files Remote username @ remote host name or ip: path/local file path

Sz downloads the server file to the local device. However, I like to download client software such as xftp. Windows systems. If you have sufficient permissions to use xftp, you can upload files.

The premise of sz rz is that such tools have been installed on the server. Install the SDK and check it by yourself.

Install software. The simplest way. Generally, tar is downloaded. Gz file. For example, the haproxy I downloaded.

Decompress the tar xvf file name

Cd to the decompressed folder

. Configure-prefix = installation path. You can also directly install configure in the default Software Directory. You can use. configure -- help to view the default installation path specified by the software.

Make:

If sudo make install is installed, it will be OK.

 

You may need to create a folder before installing the software. The following describes file-related operations.

Sudo mkdir folder name create folder

Sudo vi File Name Creation File

Sudo rm file name delete file

Sudo rm-rf folder Delete the entire folder

Cat file name to view the entire file content

The tail-f file name is used to view the last few lines of the file, which is applicable to viewing log files.

The sudo vi file name enters the file vi Mode.

I enter the editing mode with the independent I key. You can use the arrow key to move it to your editing position. Esc exit key exit edit mode

: Colon enters exit mode wq save quit q! Q: Do not save the exclamation mark and exit

Yy then p copies the current row and inserts it into the next row

Dd deletes the current row

Replace ndd n with the number of rows to be deleted, and delete 10 rows in 10dd.

 

Start Software or service

Sudo sh command name haproxy start sudo haproxy path/haproxy-f haproxy configuration file

 

Check whether to start ps-e | grep haproxy java ps-e | grep java if it is started, the corresponding process pid is displayed.

Check whether the program starts ps-ef | grep tomcat. The content of the started file and the corresponding process id are displayed.

 

Killing sudo kill-9 process id

 

Search for files

Sudo find path-name regular expression match mode. For example, I generally globally search sudo find/-name "* haproxy *" to find all files whose names contain haproxy.

Ubuntu's Software Center is really powerful. For those who are familiar with windows systems, this silly installation method is really good. But sometimes we may need some software to start without starting it. How can this problem be solved?

For example:

Sudo update-rc.d-f tomcat remove

 

From yq76034150's column

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.