Common Debian commands

Source: Internet
Author: User
Tags import database
Debian Common commands-Linux Release Technology-Debian information. For more information, see the following. 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
Apt-cdrom add
System Upgrade
Apt-get update
Apt-get upgrade
Apt-get dist-upgrade
Clear the residual configuration file of the deleted package.
Dpkg-l | grep ^ rc | awk ''{print $2}'' | tr ["\ n"] [""] | sudo xargs dpkg-P-
Automatic Processing of H files is missing during compilation
Auto-apt run./configure
View the temporary directory for storing downloaded packages during software installation
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 <~ /Somefile
Dselect
Clear old software caches
Apt-get autoclean
Clear all software caches
Apt-get clean
Delete isolated software that is no longer used by the System
Apt-get autoremove
View the address of the package on the server
Apt-get-qq -- print-uris install ssh | cut-d \ ''-f2
View the kernel
Uname-
View Ubuntu version
Cat/etc/issue
View the modules loaded by the kernel
Lsmod
View PCI devices
Lspci
View USB devices
Lsusb
View Nic status
Ethtool eth0
View CPU Information
Cat/proc/cpuinfo
Display current hardware information
Lshw
View Hard Disk Partitions
Fdisk-l
View IDE Hard Disk Information
Hdparm-I/dev/hda
View STAT hard disk Information
Hdparm-I/dev/sda
Or
Apt-get install blktool
Blktool/dev/sda id
View remaining disk space
Df-h
Df-H
View space occupied by Directories
Du-hs directory name
The USB flash drive cannot be detached.
Sync
Fuser-km/media/usbdisk
View Current memory usage
Free-m
View Processes
Ps-aux
Abort a process
Kill process number
Or killall process name
Force stop a process
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
Pppoeconf
ADSL Manual dialing
Pon dsl-provider
Activate ADSL
/Etc/ppp/pppoe_on_boot
Disconnect ADSL
Poff
View dialing logs
Plog
Query Nic addresses based on IP addresses
Arping IP Address
View current IP Address
Ifconfig eth0
View the program listening to port 80
Lsof-I: 80
View the physical address of the current Nic
Arp-a | awk ''{print $4 }''
Ifconfig eth0 | head-1 | awk ''{print $5 }''
Enable the network to support nat now
Echo 1>/proc/sys/net/ipv4/ip_forward
Iptables-t nat-I POSTROUTING-j MASQUERADE
View route information
Netstat-rn
Route-n
Manually add or delete a route entry
Route add-net 192.168.0.0 netmask 255.255.255.0 gw 172.16.0.1
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
Ifconfig eth0 down # disable the NIC
Ifconfig eth0 hw ether 00: AA: BB: CC: DD: EE # change the address
Ifconfig eth0 up # Start the NIC
Count the number of current IP connections
Netstat-na | grep ESTABLISHED | awk ''{print $5}'' | awk-F: ''{print $1}'' | sort | uniq-c | sort-r-n
Netstat-na | grep SYN | awk ''{print $5}'' | awk-F: ''{print $1}'' | sort | uniq-c | sort-r-n
Count the IP addresses of up to 20000 IP packets in the current 100 IP Packets
Tcpdump-tnn-c 20000-I eth0 | awk-F ". "'' {print $1 ". "$2 ". "$3 ". "$4}'' | sort | uniq-c | sort-nr | awk ''$1> 100''
Mask IPV6
Echo "blacklist ipv6" | tee/etc/modprobe. d/blacklist-ipv6
Add a service
Update-rc.d service name defaults 99
Delete a service
The 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
Start a service temporarily
/Etc/init. d/service name start
Configure which Java is used by default
Update-alternatives -- config java
Modify user information
Chfn userid
Set proxy for apt
Export http_proxy = http://xx.xx.xx.xx: xxx
Modify system logon information
Vi/etc/motd
Convert the file name from GBK to UTF8
Apt-get install convmv
Convmv-r-f cp936-t utf8 -- notest -- nosmart *
Batch convert all files in the src directory from GBK to UTF8
Find src-type d-exec mkdir-p utf8 /{}\;
Find src-type f-exec iconv-f GBK-t UTF-8 {}-o utf8 /{}\;
Mv utf8/* src
Rm-fr utf8
Convert the file content from GBK to UTF8
Iconv-f gbk-t utf8 $ I> newfile
Convert mp3 tag Encoding
Apt-get install python-mutagen
Find.-iname "*. mp3"-execdir mid3iconv-e GBK {}\;
Display Chinese characters in the console
Apt-get install zhcon
Enter zhcon for use.
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
Let tail keep reading the latest content
Tail-n 10-f/var/log/apache2/access. log
View the content between the fifth line (inclusive) and the second line (inclusive) in the file.
Sed-n''5, 10p'/var/log/apache2/access. log
Search for files containing xxx strings
Grep-l-r xxx.
Query xxx commands
Apropos xxx
Man-k xxx
Transfer files through ssh
Scp-rp/path/filename [email = username @ remoteIP:/path] username @ remoteIP:/path [/email] # copy the local file to the server
Scp-rp [email = username @ remoteIP:/path/filename] username @ remoteIP:/path/filename [/email]/path # download remote files from server to local
View the applications that read and write a file.
Lsof file name
Change the suffix of all files from rm to rmvb
Rename's/. rm $/. rmvb /''*
Replace uppercase letters in all file names with lowercase letters.
Rename ''tr/A-Z/a-z /''*
Delete a file with a special file name, for example, file name: --help.txt
Rm -- --help.txt or rm./--help.txt
View subdirectories of the current directory
Ls-d */. Or echo */.
Move the files in the current directory that have been accessed in the last 30 days to the upper-level back directory.
Find.-type f-atime-30-exec mv {} ../back \;
Display the files in the current directory within the last 2 hours to 8 hours
Find.-mmin + 120-mmin-480-exec more {}\;
Delete all files modified 30 days ago
Find.-type f-mtime + 30-mtime-3600-exec rm {}\;
Search for and delete the file ending with avi or rm of the guest user.
Find.-name ''' *. avi'''-o-name''' *. rm ''-user''' guest''-exec rm {}\;
The files found do not end with java or xml and are not used for seven days.
Find .! -Name *. java! -Name '*. xml'-atime + 7-exec rm {}\;
Count the number of current files
Ls/usr/bin | wc-w
Count the number of current directories
Ls-l/usr/bin | grep ^ d | wc-l
Display the file name of 2006-01-01 in the current directory
Ls-l | grep 2006-01-01 | awk ''{print $8 }''
Decompress xxx.tar.gz
Tar-zxvf xxx.tar.gz
Decompress xxx.tar.bz2
Tar-jxvf xxx.tar.bz2
Compress aaa bbbdirectory as xxx.tar.gz
Tar-zcvf xxx.tar.gz aaa bbb
Compress aaa bbbdirectory as xxx.tar.bz2
Tar-jcvf xxx.tar.bz2 aaa bbb
Special URI address
* Computer: //-all mounted devices and networks
* Network: //-browse Available Networks
* Burn: // a data virtual directory for burning CDs/DVDs
* Smb: //-available windows/samba Network Resources
* X-nautilus-desktop: //-desktop project and icon
* [Url = file: //] file: // [/url]-local file
* Trash: //-local recycle bin directory
* Ftp: //-FTP folder
* Ssh: //-SSH folder
* Fonts: //-font folder. You can drag the font file here to complete installation. * themes: //-system topic folder
Detailed display of program running information
Strace-f-F-o outfile
Set date
Date-s mm/dd/yy
Set Time
Date-s HH: MM
Write time to CMOS
Hwclock -- systohc
CMOS read time
Hwclock -- hctosys
Synchronize time from the server
Ntpdate time.nist.gov
Ntpdate time.windows.com
Export and import data from mysql
Mysqldump Database Name> file name # Export Database mysqladmin create database name # create database
Mysql database name <file name # import database
What should I do if I forget the mysql root Password?
/Etc/init. d/mysql stop
Mysqld_safe -- skip-grant-tables &
Mysqladmin-u user password ''newpassword ''''
Mysqladmin flush-privileges
Modify the root password of mysql
Mysqladmin-uroot-p password ''your new password''
Download website documentation
Http://www.21cn.com of wget-r-p-np-k
·-R: Create a server directory structure on the local machine;
·-P: Download and display all images of HTML files;
·-Np: only download the contents of the specified directory and Its subdirectories of the target site;
·-K: convert non-relative links to relative links.
How to delete the playback history of a Totem player
Rm ~ /. Recently-used
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.