Ubuntu routine skills

Source: Internet
Author: User
I am not actually SA. Many Ubuntu commands cannot be remembered in many cases. So we can find a place to record it. Long-term update. You may have to deal with ubuntu in the next three months. This document may be updated for a long time. 1: How to view logs in color. To view logs better, you need to install two packages apt-getinstall-ytmuxccze. At this time, you can view logtail-f/var/log/syslog.

I am not actually SA. Many Ubuntu commands cannot be remembered in many cases. So we can find a place to record it. Long-term update. You may have to deal with ubuntu in the next three months. This document may be updated for a long time.

1: View logs in color

How can I view logs and display them better?

Two packages need to be installed

Apt-get install-y tmux ccze

You can view the log at this time.

Tail-f/var/log/syslog | ccze

Tail-f/var/log/squid/access. log | ccze


2: Use IPMItool

Apt-get-y install ipmitool

2: Load IMPI

Http://wiki.adamsweet.org/doku.php? Id = ipmi_on_linux

Modprobe ipmi_msghandler
Modprobe ipmi_devintf
Modprobe ipmi_si

In this case, you can view the ipmi information.

# Ipmitool lan prinet

 

3: tasksel -- list-tasks

When installing ubuntu, you have a software package. After installation, I want to see which software packages are available?

# Tasksel-h
Unknown option: h
Usage:
Tasksel install
Tasksel remove
Tasksel [options]
-T, -- test mode; don't really do anything
-- New-install automatically install some tasks
-- List-tasks list tasks that wocould be displayed and exit
-- Task-packages list available packages in a task
-- Task-desc returns the description of a task

Tasksel -- list-tasks

This will list all the combinations.

Which packages are included in the end?

Tasksel -- task-packages dns-server

The output of the command shocould list:
Bind9-doc
Bind9utils
Bind9

 

If you want to install

Tasksel install dns-server

 

4: search software

This is a google search software technique that I often use and is recorded here.

Httpd-2.2.8.tar.gz, intitle: index

5. Load the iso file

Mount-t auto-o loop/downloads/CentOS-6.2-x86_64-core.iso/mnt/

If it is an optical drive, it is much simpler.

Mount/dev/cdrom/mnt

 

6: Query package

If you want to query the packages in the source. If you do not know the package name clearly.

# Apt-cache search openstack

7: view the server motherboard Model

The server is ultra-micro, but I don't know the specific model, so I cannot upgrade it. You can view it through the command line.

# Dmidecode | grep-A16 "System Information $"
System Information
Manufacturer: Supermicro
Product Name: X8DT3
Version: 1234567890
Serial Number: 1234567890
UUID: 3B703625-21C8-F25D-475C-0025902EF986
Wake-up Type: Power Switch
SKU Number: To Be Filled By O. E. M.
Home: 1234567890

Handle 0x0002, DMI type 2, 15 bytes
Base Board Information
Manufacturer: Supermicro
Product Name: X8DT3
Version: 2.0
Serial Number: OM16S33000
Asset Tag: 1234567890

 

8: replace in VI

You often need to replace text in batches. I usually only use full text replacement. (Reference http://apps.hi.baidu.com/share/detail/16718996)

: G/str1/s // str2/g

Replace str1 with string str2

9: dpkg usage

Dpkg is rarely used, but it is still very practical.

Sometimes you need to determine the software package of a file.

# Dpkg -- search/etc/nova. conf
Nova-common:/etc/nova. conf

View installed packages

Dpkg -- status nova-common

List Installed packages

# Dpkg -- list

To count the number of installed packages

# Dpkg -- list | wc-l

 

10: full-text search

This is often used. Search for the/etc directory, find the configuration file, and run the two commands to achieve the same effect.

# Grep-lr "NOVA_API_KEY"/Opt/stack/

# Find/Opt/stack| Xargs grep "NOVA_API_KEY"

 

11: view the port

I can't remember this command.

Ps aux | grep vnc

 

12: Where is the apt-get package stored?
By default, the installed ubuntu package is saved in
/Var/cache/apt/archives
You can back up this directory. The next installation will not require Internet connection.
To clear the cache folder, run
Sudo apt-get clean

13: Is VI hard to use?

By default, vi is difficult to use. Install vim. Ubuntu12.04. You only need to install vim. When you open a file with vi, the color is displayed.

14. Set static IP addresses

For example, if you set static IP addresses, dhcp is often used by default.

# The loopback network interface
Auto lo
Iface lo inet loopback

# The primary network interface
Auto eth0
Iface eth0 inet static
Address 172.16.10.51
Netmask 255.255.0.0
Network 172.16.0.0
Broadcast 172.16.0000255
Gateway 172.16.10.1
# Dns-* options are implemented by the resolvconf package, if installed
Dns-search test.com

For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2

Related Article

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.