Linux Common Instructions Operation notes

Source: Internet
Author: User

This blog post is my daily work in the more commonly used instruction operation, will gradually be completed, we feel useful can refer to reference, I will change this blog post. The Linux OS version I'm using is Ubuntu.


First, the Switch machine

Reboot restart your computer

Shutdown-r now restart your computer

Shutdown-h +10 "This is a warning information" 10 minutes after shutdown

Poweroff-h shut down the machine


Second, version

Uname-a View Linux Current version


Third, installation

Apt-get Install the package to be installed


Iv. Configuration Iptables

1. View Table

Iptables-l Input: View the input table in the filter

Iptables-l: The default is to view the table information in the filter

The above two commands are the default view of the information in the filter, to see the NAT table as follows:

Iptables-l-T NAT


2. Add rules

Add a prohibit access to port 555 with the UPD protocol

Iptables-a input-pudp--dport 555-j DROP//accept

Remove a prohibit access port 555 with the UPD protocol

iptables-d input-pudp--dport 555-j DROP//accept

Clears all rules in the input table

Iptables-f INPUT


3. Save the Rules

The above commands are memory-intensive, meaning that the previously configured rules are emptied after the computer restarts. To be effective after restarting, the following:

Method One:

In the/etc/network/interfaces file, add:

Pre-up Iptables-restore </etc/iptables.up.rules

Post-down iptables-save >/etc/iptables.up.rules


Method Two:

After configuring some rules, execute the following sentence

IPTABLES-SAVE-T Filter > Iptables.bak

After the computer restarts, execute the following sentence

Iptables-restore < Iptables.bak



4. Using the ADB command on the root phone

First, the system is read-only, the ADB shell, then mount, see the system corresponding information, Su, and then execute the following sentence on the line

Mount-rw-o remount-t Yaffs2/dev/block/mtdblock11/system

(The simplest method is: Mount-o remount rw/system)


Off-topic knowledge

New partition: Mount-o ro/dev/hdd1/mnt/c mount/dev/hdd1 to/mnt/c and read-only


Second, if the ADB shell a mobile phone, when there is no CP copy command, you can use the cat command to replace

cat/sdcard/app/a.apk >/sdcard/b.apk//After executing this sentence, b.apk is exactly the same as a.apk.


5. View installed software

Ubuntu:

Dpkg-l//View all installed software

Dpkg-l | grep Tomcat//See if software like Tomcat is installed


6, how to check whether the Linux system is 32-bit or 64-bit

getconf word_bit Results: Display 16 or 32

getconf long_bit Results: Display 32 or 64


or file Bin/ls


7. View NAT mapping table for Linux

Iptables-t NAT-VL

Some people on the Internet also say that using iptables-t nat-l-n

However, it is a mistake to verify that the iptables command does not have the-l option under the Linux 5.5 x64 system.


8. Linux Viewing process

Ps-a view process, not including background.

PS-E view the process, including the background.


9. Killing process

Kill PID (Process number)


10. View history Commands

In the home directory. Bash_history


11. Decompression command

tar.gz Bag: TAR-ZXVF xxx.tar.gz

GZ Package: Gunzip-v xxx.gz


This article from "Dan Dan Home" blog, reproduced please contact the author!

Linux Common Instructions Operation notes

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.