Linux Common Command Summary ....

Source: Internet
Author: User
Tags rar

1.wget plus the URL of the file you want to download, you can download the file in the current directory, such as:

wget http://apache.freelamp.com/httpd/httpd-2.2.14.tar.gz

Note: The URL must be real.

2.RM-RF the directory and all files in that directory are deleted

3.apt-get Install:

* Installation software:#apt-get Install PackageName

This will install the latest packages you need in sources.lists, and automatically install the appropriate dependent packages if there are other dependencies. PackageName can be multiple packages.

Some useful options:

-h this help text.

-D Download only-do not install or unpack archives

-F attempt to continue if the integrity check fails

-S no-act. Perform Ordering Simulation

-Y assume Yes to all queries and does not prompt

-U Show a list of upgraded packages as well

* Uninstall software (with install) 1:

#apt-get Install packagename-

Add a '-' after the package that needs to unload (I have not experimented), of course, can Apt-get install P1 p2-Such a combination of multiple commands , loaded p1 unloading p2.

* Uninstall Software 2:

#apt-get Remove PackageName

This will uninstall the appropriate software, but also uninstall the dependent parts, there is no way to specify not to uninstall the dependent. However, the software configuration file will remain in the system.

* Full Uninstall software includes delete configuration:

#apt-get--purge Remove PackageName

The configuration file will also be deleted.

4. Change the permissions of the command: such as:chmod 777 file /directory name, of course, there are other methods, here only one, the other to learn more, change a folder and all the files inside the permissions, such as: chmod-r 777 directory name

5. On my computer (although three are all set to boot from boot, but it is necessary to manually turn on or off sometimes)

Apache-initiated command:sudo/usr/local/apache2/bin/apachectl start

Apache Restart command:sudo/usr/local/apache2/bin/apachectl restart

MySQL startup command:sudo/etc/init.d/mysql start or:/etc/init.d/mysql start

MySQL restart command:sudo/usr/local/mysql/support-files/mysql.server restart or sudo/etc/init.d/mysql restart

Tomcat boot command:/usr/local/tomcat/bin/startup.sh

Tomcat Close command:/usr/local/tomcat/bin/shutdown.sh

6. View port number:NETSTAT-TNL

View IP : ifconfig -a |grep inet

The format of the results, such as:134.164.1.43 and so on as the IPv4 address, is usually said IP address. The inet6 corresponds to the IPv6 address. If you do not know the format of the IP address, please run:ifconfig-a|grep "inet.*\" In fact, the simplest can be run:ifconfig, but the output is too much. 

7 Example:cp-r/usr/xu//usr/liu/is a copy of all files and their subdirectories in the/usr/xu directory to the directory /usr/liu

MV source file (clip) path target path is to move the source file (clip) into the target path

8.rar format compression: Add a file or directory to a compressed archive, using the a command. For example, add the file files1 to Abc.rar, use the A or m command , a command to add the File1 file to the Abc.rar file to keep the original file1 file unchanged, The M command moves the file1 file to the File1.rar archive (the original file1 file is deleted when the compression is complete , note: Them Command operates only on the file )
$rar a Abc.rar file1

Decompression: Extract the contents of the Abc.rar file, you can use the e or x command , assuming that the Abc.rar directory has a file named File1 and a directory named Test, There is a file named File2 in the test directory ,
RAR e Abc.rar
Note: Using the e command, the file1 file in Abc.rar is extracted to the current directory along with the File2 file in the test directory . If you want to keep the directory structure in the Abc.rar directory, use the x command.
RAR x Abc.rar
Description: The file1 file and the test directory are extracted to the current folder

9. unzip the . zip file command:unzip

The unzip command is capable of extracting files that have been compressed by WinZip.

The unzip command is executed as follows:

# Unzip [-Options ] Compressed file name . zip 

For example , to extract the File1.zip file under the current directory, the execution command is:

# Unzip File1.zip

If you want to view only the files in the compressed file directory, but do not want to unzip, the execution command is:

# unzip-v File1.zip

Unzip the File1.zip file in the /home/zip directory, but if the same file does not overwrite the original file, the execution command is:


The options for the Unzip command are shown in table 7-11.

Table 7-11 unzip command options

options for the unzip command

Parameter description

-V

View a list of file directories, but do not understand the pressure

-D

Unzip the file into the specified directory

-N

Do not overwrite files that already exist

-O

Overwrite files that already exist and do not require user confirmation

10.TAR.BZ2 Decompression: Example:tar vxjf eaample.tar.bz2

. tar.gz Solution: Example: TAR-ZXVF example.tar.gz

One. links

There are two types of Linux link files, similar to shortcuts under Windows system. But the Linux link file is different from the Windows System.

A link is a reference to a file so that you can see it in multiple places in the file system. However, in Linux , links can be treated the same as the original files. Links can be executed, edited, and accessed just like regular files. For other applications in the system, the link is the original file that it corresponds to. When you edit a file through a link, you are actually editing the original file. The link is not a copy.

Soft links and hard links are all available by command LN to create. LN The default is to create a hard link. Use the -s switch to create a symbolic link (a link is a soft link).

Create a hard link: ln-d source_file hardlink_file

Create a soft link: ln-s source_file softlink_file

Delete a link: RM-RF softlink_file

Note: Use ln-s Create a soft link and then go to the soft link and the following error appears:Too Many levels of symbolic links . This error is caused by the previous ln-s command when the source file is not using an absolute path.

So, whether it's a source file or a destination file, use the Absolute Path , the odds of this error are reduced.

the difference between soft and hard links: There are two restrictions on hard-link files: You are not allowed to create a hard link to a directory, and you can create links only between files in the same file system, and only super users can create hard-link permissions.

when you read and write to and delete hard-linked files, the results are the same as soft links. But if we delete the source file of the hard-link file, the hard-link file still exists, and the original content is preserved (the soft link is not the case). At this point, the system forgets that it used to be a hard-link file and treats it as a normal file. We can understand this: a hard link refers to a connection through an index node whose role is to allow a file to have more than one valid pathname, which can be used to delete the error.

The .Find command :

General form:find Pathname-options[-print-exec-ok]

The most common command formats, such as:

Find-atime-2: Find files that have been modified in hours (2 days)

Find. -name "*.log": Find files ending with . Log in the current directory

find/opt/soft/test/-perm 777: Find files with permissions 777 in/opt/soft/test/directory

Find. -type f-name "*.log": Find the current directory, The normal file ending with. log

Find. -size +1000c-print: Find files with current directory larger than 1K

......

Summary of commands commonly used by Linux ....

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.