Ubuntu one-sentence tips-getting started with Linux (for beginners)

Source: Internet
Author: User
View the installation content of software xxx
Dpkg-l xxx

Search software
Apt-cache search Regular Expression

Find the package of the file
Dpkg-s filename apt-file search filename

Queries which packages the software XXX depends on
Apt-Cache depends xxx

Queries which packages depend on the software xxx
Apt-Cache rdepends xxx

Add a CD Source
Sudo apt-CDROM add

System Upgrade
Sudo apt-Get update sudo apt-Get upgrade sudo apt-Get dist-Upgrade

--------------------------------------------------------------------------------
Automatic Processing of H files is missing during compilation
Sudo auto-apt run./configure

View the temporary directory for storing downloaded packages when installing software LS/var/Cache/APT/Archives

Back up the list of all packages installed in the current system dpkg -- Get-selections | grep-V deinstall> ~ /Somefile

Restore all packages from the list file of the installation package backed up above
Dpkg -- Set-selections clear old software caches
Sudo apt-Get autoclean

Clear all software caches
Sudo apt-Get clean

Delete isolated software that is no longer used by the System


Sudo apt-Get autoremove

Apt-cache search package
Apt-Cache show package obtains package information, such as description, size, and version.
Sudo apt-Get install package installation package
Sudo apt-Get install package--reinstall re-installation package
Sudo apt-get-F install fix and install "-F =-fix-missing"
Sudo apt-Get remove package Delete package
Sudo apt-Get remove package--Purge delete a package, including deleting a configuration file.
Sudo apt-Get Update update source
Sudo apt-Get upgrade updates installed packages
Sudo apt-Get dist-upgrade System
Sudo apt-Get dselect-upgrade using dselect
Apt-Cache depends package for dependency usage
Apt-Cache rdepends package is used to check which packages are dependent on this package.
Sudo apt-Get build-dep package installation-related compilation environment
Apt-Get source packageSource code
Sudo apt-Get Clean & sudo apt-Get autoclean clear useless packages
Sudo apt-Get check whether any corrupted dependency exists


----------------------------------------------------------------------
View the kernel
Uname-

View Ubuntu version
CAT/etc/issue

View the 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 Hard Disk Partitions
Sudo fdisk-l

View IDE Hard Disk Information
Sudo hdparm-I/dev/hda

View SATA hard disk Information
Sudo hdparm-I/dev/SDA
Or sudo apt-Get install blktool sudo blktool DEV/SDA ID

Viewing hard disks is better than space
DF-HDF-H

View space occupied by Directories
Du-HS directory name

The USB flash drive cannot be detached.
Syncfuser-km/Media/usbdisk

View Current memory usage
Free-l

--------------------------------------------------------------------------------
View Current Process
PS-

Kill a process
Kill process number (that is, the first column of the number in PS-A or the killall process name)

Force a process to be killed (when the above method fails)
Kill-9 process no. Or killall-9 process name

View the real-time status of the current process
Top

View files opened by a 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

View dialing logs
Sudo plog

View Nic addresses by IP Address
Atping IP Address

View current IP Address
Sudo ifconfig eth0 | awk '/inet ADDR/{split ($2, X, ":"); print X [2]}'

View the IP address of the current Internet
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 port 80 of the current listenerProgram
Lsof-I: 80

--------------------------------------------------------------------------------
View the physical address of the current Nic
Sudo ARP-A | awk '{print $4 }'
Sudo ifconfig eth0 | head-1 | awk '{print $5 }'

Enable the network to support NAT now
Sudo Echo 1>/proc/sys/NET/IPv4/ip_forward
Sudo iptables-T nat-I postrouting-J Masquerade

View route information netstat-Rn
Sudo route-n

Manually add or delete a route entry
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

How to modify the MAC address of a NIC
Sudo ifconfig eth0 down # disable the NIC
Sudo ifconfig eth0 HW ether 00: AA: BB: CC: DD: ee # change the address
Sudo ifconfig eth0 up # Start the NIC

--------------------------------------------------------------------------------
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 close a service
/Etc/init. d/service name stop

Configure which sudo Update-alternatives -- config Java is used by default in Java

Modify user information
Sudo chfn userid

Set proxy for Apt
Export
Http_proxy = http://xx.xx.xx.xx: XXX

Modify system logon information
Sudo Vim/etc/motd

Convert the file name from GBK to utf8
Sudo apt-Get install convmv
Convmv-r-F cp936-T utf8 -- notest -- nosmart *

Quickly search for a file
Whereis filename
Find directory-name file name

View File Types
File filename

Display the last six lines of XXX File
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.