Linux commands frequently used in summary

Source: Internet
Author: User

  • Common decompression commands

Tar.bz2 command: tar-jxvf * .tar.bz2

Tar. z command: tar-zxvf *. tar. z

Tar.gz command: tar-Zxvf * .tar.gz

PS: You can use man to help with these parameters. Note that these parameters are case sensitive.

The software package with tar.gz and tar.bz2 is mostly installed through./configure; make install; some software is directly make; make install

  • Common compression commands

Compression: name of the file or directory to be compressed by tar-j c v-f filename.tar.bz2
Query: tar-j t v-f filename.tar.bz2
Decompress: tar-j x v-f filename.tar.bz2-C directory to be decompressed

  • Common switch commands

Shutdown command:
Shutdown is available only with the root permission.
Init 0

Restart command:
Init 1
Reboot

  • Directory command

Switch Directory: directory to be switched by cd
The current directory is pwd.
View the files in this directory: ls
[Root @ Tsai bin] # ls -- color displays the archives in color
[Root @ Tsai bin] # ls-l list the file system structure in detail
[Root @ Tsai bin] # ls-A: Show Hidden Files (Files starting)
[Root @ Tsai bin] # ls-Al displays hidden files and details at the same time
[Root @ Tsai bin] # ls-Al | more displays the file content on one page

Create a new directory: mkdir new directory name
Delete Directory: rmdir directory name
If the directory contains something, use the RM-RF file directory.

  • FILE command:

Overwrite the copy of the original file: the target file of the CP-RF Source File
Overwrite the movement of the original file: target file of the MV-I source file
View File Content: Cat
Compare two different files: Diff

  • File Search command:

Find the LS command directory: whereis ls
Find the file with test: Find | grep 'test'

  • Network command:

View port 80 usage: netstat-anp | grep 80

Download command: wget http://example.com/packages/
Batch download: wget-I filename.txt
Store the link address in filename.txt.

View IP address and other information: ifconfig

  • Rmp software usage;

Installation: rpm-I your-package.rpm

Query the installed pcre package: rpm-qa | grep pcre

Delete pcre package: rpm-e -- nodeps pcre-6.6-2.el5_1.7

Upgrade: rpm-Uvh xxxxx. rpm <= upgrade xxxxx. rpm

 

  • Disable and enable Linux Firewall

1) takes effect after restart
Enable: chkconfig iptables on
Close: chkconfig iptables off
2) takes effect immediately and becomes invalid after restart
Enable: service iptables start
Disable: service iptables stop

  • Killing command
Command: Search for related processes: ps aux | grep program_filter_word command: killall-9 nginx // kill nginx process to view the server status of the Website: curl -- head www.sohu.com

 

  • Other commands:

Yum Installation Software: yum install autoconf

Add apache boot self-start:

Echo "/usr/local/apache/bin/apachectl start">/etc/rc. local

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.