Ubuntu command a word trick __ubuntu

Source: Internet
Author: User
Tags memory usage ide hard drive

View Software XXX Installation content
dpkg-l xxx


Find software
Apt-cache Search Regular Expression


Find out which package the file belongs to
dpkg-s filename apt-file Search filename


Query software xxx depends on which packages
Apt-cache depends xxx

Query software XXX is dependent on which packages
Apt-cache rdepends XXX


Add a CD source
sudo apt-cdrom add

System upgrades
sudo apt-get update sudo apt-get upgrade sudo apt-get dist-upgrade


--------------------------------------------------------------------------------
Lack of automatic processing of H files at compile time
sudo auto-apt run./configure


View the temporary storage directory for downloading packages when installing software ls/var/cache/apt/archives

Backs up the list of all packages currently installed on the system dpkg--get-selections | Grep-v deinstall > ~/somefile

Recover all packages from the list file of the installation package backed up above
Dpkg--set-selections cleans up older versions of the software cache
sudo apt-get AutoClean

Clean up all software caches
sudo apt-get clean

Remove orphaned software that the system no longer uses
sudo apt-get autoremove
----------------------------------------------------------------------
View Kernel
Uname-a

View Ubuntu version
Cat/etc/issue

View modules loaded by the kernel
Lsmod

View PCI Devices
Lspci

View NIC Status
sudo ethtool eth0

View USB Devices
Lausb

View CPU Information
Vat/proc/cpuinfo

View current hardware information
Lshw

--------------------------------------------------------------------------------

View partitions of the hard disk
sudo fdisk-l

View IDE Hard drive information
sudo hdparm-i/dev/hda

View SATA Hard Drive information
sudo hdparm-i/dev/sda
or sudo apt-get install blktool sudo blktool DEV/SDA ID

Viewing a hard disk is better than space
Df-hdf-h

To view the space occupied by the directory
DU-HS Directory Name

U disk cannot unload
Syncfuser-km/media/usbdisk

View current Memory usage
Free-l

--------------------------------------------------------------------------------
View Current Process
Ps-a

Kill a Process
Kill process Number (that is, the first column of numbers in ps-a or the Killall process name)

Force a process to kill (when the method above does not succeed)
Kill-9 process number or killall-9 process name

View real-time status of the current process
Top

To view files opened by the process
Lsof-p

Configure ADSL
sudo pppoeconf

ADSL Manual Dialing
sudo pon dsl-provider

Activate ADSL
Sudo/etc/ppp/pppoe_on_boot

Disconnect ADSL
sudo poff

viewing dial-up logs
sudo plog

View network card address based on IP
Atping IP Address

View current IP Address
sudo ifconfig eth0 |awk '/inet addr/{split ($2,x, ":");p rint x[2]} '

View the IP address of the current extranet
W3m-no-cookie-dump ip.loveroot.com |grep-o ' [0-9]\{1,3\}\. [0-9]\{1,3\}\. [0-9]\{1,3\}\. [0-9]\{1,3\} '

View the program currently listening on port 80
Lsof-i: 80

--------------------------------------------------------------------------------
View the physical address of the current network card
sudo arp-a | awk ' {print $} '
sudo ifconfig eth0 | head-1 | awk ' {print $} '

Let the network support NAT now
sudo echo 1 >/proc/sys/net/ipv4/ip_forward
sudo iptables-t nat-i postrouting-j Masquerade

View routing Information Netstat-rn
sudo route-n

Manually increase the deletion of a route
sudo route add-net 192.168.0.0
netmask 255.255.255.0 GW 172.16.0.1
sudo route del-net 192.168.0.0
netmask 255.255.255.0 GW 172.16.0.1

Ways to modify the MAC address of a network card
sudo ifconfig eth0 down #关闭网卡
sudo ifconfig eth0 hw ether 00:aa:bb:cc:dd:ee #然后改地址
sudo ifconfig eth0 up #然后启动网卡

--------------------------------------------------------------------------------
Add a service sudo UPDATE-RC.D service name defaults 99

Delete a service
sudo update-rc.d service name remove

Temporarily restart a service
/etc/init.d/Service Name Restart

Temporarily turn off a service
/etc/init.d/Service Name Stop

Configure the default Java use which sudo update-alternatives--config java

Modify user Information
sudo chfn userid

Set up agent for APT
Export
Http_proxy=http://xx.xx.xx.xx:xxx

Modify System Login Information
sudo vim/etc/motd

Convert file name from GBK to UTF8
sudo apt-get install CONVMV
Convmv-r-F cp936-t UTF8--notest--nosmart *

Quick Find a file
Whereis filename
Find directory-name filename

View File types
File filename

Show the contents of the xxx file in the penultimate 6 lines
Tail-n 6 XXX

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.