Ubuntu Common 200 Commands

Source: Internet
Author: User
Tags bz2 locale rar set time svn

   view software XXX installation content: Dpkg -l xxx find software in the Software Library:apt-cache search  regular expressions find software in the Software Library: aptitude  search  package Find which package the file belongs to: Dpkg -s filename find out which package the file belongs to:apt-file search  filename query software xxx depends on which packages: apt-cache depends xxx query software XXX is which package depends on: apt-cache rdepends xxx Add a disc source: sudo  apt-cdrom add system Upgrade: Sudo apt-get update;sudo apt-get dist-upgrade clears the residual profile of the deleted package: dpkg -l |grep ^rc|awk  ' {print $2} '  |sudo xargs dpkg - P is missing the automatic processing of H files at compile time: Sudo auto-apt run ./configure View temporary storage directory for download packages when installing software: ls /var/cache/apt/ Archives back up the list of all packages that are currently installed on the system: dpkg --get-selections | grep -v deinstall > ~/ Somefile Recover all packages from the list file of the backup installation package: Dpkg --set-selections < ~/somefile;sudo dselect Clean up the old version of the software cache: Sudo apt-get autoclean Clean up All software caches: Sudo apt-get clean remove orphaned software that is no longer used by the system:sudo apt-get  Autoremove View the address of the package on the server: Apt-get -qq --print-uris inStall ssh | cut -d\ '  -f2 view kernel: uname -a view Ubuntu version:cat /etc/issue  or   Lsb_release -a view kernel-loaded modules: Lsmod View PCI device: LSPCI view USB device: Lsusb -v view NIC Status: Sudo ethtool eth0 View CPU Information: Cat /proc/cpuinfo Display current hardware information: SUDO&NBSP;LSHW Display system run time: Uptime View the partition of the hard disk: Sudo fdisk -l hard disk partition:sudo  FDISK&NBSP;/DEV/SDA hard disk Format: SUDO&NBSP;MKFS.EXT3&NBSP;/DEV/SDA1 hard drive check (do not check the mounted partition, otherwise easily corrupt data): sudo fsck / DEV/SDA1 Partition mount:sudo mount -t  file system type   (-o nls=utf8  or  -o iocharset=utf8)   Equipment Path   Access route   partition uninstall:sudo umount  directory name or device name View IDE hard disk information: sudo hdparm -i /dev/ HDA View stat Hard drive info  :sudo hdparm -I /dev/sda  or  sudo blktool /dev/sda  ID view hard disk spare space: DF View directory Footprint:du -hs  Catalog A famous dish cannot be uninstalled: Sync;fuser -km /media/usbdisk view the current read and write status of the hard disk:sudo  IOSTAT&NBSP;-X&NBSP;2 View current Memory usage: Free dynamic display of Process execution: Top View what processes are currently in progress: PS&NBSP;-A View Current process tree: Pstree abort a process:kill  process number   or  killall  process name coercionStop a process:kill -9  process number   or  killall -9  process name graphical way abort a program:xkill  the mouse with the skeleton logo, Click on the program you want to abort to see the files open by the process: Lsof -p shows the process of opening file Abc.txt  :lsof abc.txt  displaying 22 ports What program is running now  :lsof  -i :22  Show NSD process now open files &NBSP;:LSOF&NBSP;-C&NBSP;NSD run the program in the background, after logging out, does not end programs  :nohup  programs  & Detailed display of program operation information  :strace -f -F -o outfile <cmd> increase system maximum number of open files: ulimit -n  4096  or  echo 4096 > /proc/sys/fs/file-max configuration  ADSL :sudo  PPPOECONFADSL manual dialing: sudo pon dsl-provider activation  adsl:sudo /etc/ppp/pppoe_on_boot Disconnect &NBSP;ADSL  :sudo poff Viewing the dial-up log: Sudo plog How to set the dynamic domain name:w3m -no-cookie -dump  ' Http://usere:[email  protected]/dyndns/update?system=dyndns&hostname=yourdns.3322.org ' IP check NIC address  :arping  IP address view current IP address according to IP check computer name &NBSP;:NMBLOOKUP&NBSP;-A&NBSP;IP address  :ifconfig eth0 |awk  '/inet/ { Split ($2,x, ":");p rint x[2]} ' to view the current IP address of the extranet  :w3m -no-cookie -dump www.123cha.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 Nic:arp -a | awk  ' {print &NBSP;$4} ' adds a second IP address to the same NIC  :sudo ifconfig eth0:0 1.2.3.4 netmask  255.255.255.0 immediately let the network support nat :echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward;  sudo iptables -t nat -i postrouting -j masquerade  Viewing routing information:netstat  -rn  or  sudo route -n Manually add a route  :sudo route add -net 192.168.0.0  netmask 255.255.255.0 gw 172.16.0.1 manually delete a route:sudo route del -net  192.168.0.0 netmask 255.255.255.0 gw 172.16.0.1 How to modify the network card MAC address  :sudo ifconfig  Eth0 hw ether 00:aa:bb:cc:dd:ee count the number of current IP connections  :netstat -na|grep established|awk   ' {print $5} ' |awk -f:  ' {print $1} ' |sort|uniq -c|sort -r -n shielded ipv6 :echo  ' Blacklist ipv6 '  |  sudo tee /etc/modprobe.d/blacklist-ipv6 View current network connection status and program  :sudo netstat - ATNP View ADSL Current traffic: sudo ethstatus -i ppp0 Check the registration status of the domain name: whois baidu.cn Check the routing of a domain name: tracepath  baidu.cn to obtain an IP address from the server  :sudo dhclient download the Web site document: wget -r -p -np -k http:// Www.xxx.com How to 5 threads Download: Axel -n 5 http://www.xxx.com/downloadfile.zip Add a service: SUDO&NBSP;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 shuts down a service:/etc/init.d/service name  stop start a service temporarily:/etc/init.d/service name  start Add user:sudo adduser  User name Delete User:sudo deluser  user name modify current user's password: passwd Modify user password:sudo passwd  user name modify user profile:sudo chfn  UserID How to disable an account:sudo usermod -l  username   or  sudo passwd -l  user name How to enable an account: sudo  usermod -U  User name &nbspor  sudo passwd -u  user name add user to admin group:sudo usermod -g admin -a  User name Configure default Java to use which  :sudo update-alternatives --config java terminal setting agent  :export http_proxy =http://xx.xx.xx.xx:xxx Modifying system logon Information: SUDO&NBSP;VIM&NBSP;/ETC/MOTD using Sun's Java compiler: Sudo update-java-alternatives  -s java-6-sun Switch IME engine: im-switch -c Convert file name from GBK to utf8 :convmv -r -f cp936 - t utf8 --notest --nosmart * Convert file contents from GBK to Utf8 :iconv -f gbk -t utf8   $i  > newfile Conversion  mp3  tag encoding  :sudo apt-get install python-mutagen; find . -iname  ' *.mp3 '  -execdir mid3iconv -e GBK {} \; console display Chinese  :sudo apt-get install zhcon;zhcon --utf8 --drv=vgalftp  log in to remote Windows Chinese ftp: lftp :~>set ftp:charset gbkpdf  file garbled  :sudo apt-get install  xpdf-chinese-simplified xpdf-Chinese-traditional poppler-data One screen view file contents  :cat  FileName Paging view file contents:more  FileName Controllable paging view file contents:less  File names are based on string matching to view the contents of the:grep  string   file name displays the file name that contains the string:grep -l -r  string   path displays a file name that does not contain a string: grep  -L -r  string   Path Quick Find a file:find  directory  -name  file name create two empty files:touch file1  FILE2 Create nested directories recursively: MKDIR&NBSP;–P&NBSP;/TMP/XXS/DSD/EFD recursively delete nested directories: Rm –fr /tmp/xxs back to the current user's host directory: cd ~ View the absolute path of the current directory: PWD lists all files in the current directory: ls -a move the file under the path and rename:mv  path/file   /new Path/new file name copy file or directory: Cp -av   Original or original directory   new or new directory view file type: File filename Compare the differences between two files: Diff file1 file2 Displays the contents of the 6 line of the xxx file  : Tail -n 6 xxx constantly displays the latest content  :tail -n 10 -f /var/log/apache2/ Access.log View the contents of line fifth to 10th of the file  :sed -n  ' 5,10p '  /var/log/apache2/access.log find the command &nbsp about XXX;: apropos xxx  or  man -k xxx transfer files via SSH  :scp -rp /path/filename [email  protected]:/path  change the suffix of all files from RM to RMVB&Nbsp;:rename  ' s/.rm$/.rmvb/'  * change the capitalization of all filenames to lowercase:rename  ' tr/a-z/a-z/'  * delete special file names  --help.txt   Files:rm -- --help.txt  or  rm ./--help.txt View subdirectories of the current directory:ls -d */.  or  echo */. Move files that have been accessed in the last 30 days to the parent back directory  :find . -type f -atime -30 -exec &NBSP;MV&NBSP;{}&NBSP, .... /back \; displays files containing  xxxx  within one hour: find . -type f -mmin -60|xargs -i   grep -l xxxx  ' {} ' displays files within the last 2 hours to 8 hours:find . -mmin +120 -mmin  -480 -exec more {} \; Delete files that were modified 30 days ago  :find . -type f -mtime  +30 -mtime -3600 -exec rm {} \; Delete the file access time before 30 days  :find . -type  f -atime +30 -atime -3600 -exec rm {} \; Delete Guest's file ending with AVI or RM: find . -name  ' *.avi '  -o -name  ' *.rm '  -user  ' guest '  -exec rm& nbSp {} \; Delete files that are not used at the end of Java and XML for 7 days  :find . ! -name *.java ! -name  ' *. XML '  -atime +7 -exec rm {} \; Delete all  .svn  directories  :find . - name .svn -type d -exec rm -fr {} \; Delete all temporary files ending with "~" &NBSP;:FIND&NBSP;.  -name  ' *~ '  -exec rm {} \; statistics current number of files: ls .| WC&NBSP;-W Statistics current directory number: ls -l |grep ^d|wc -l Displays the file name of the 2006-01-01 in the current directory  :ls -l |grep  2006-01-01 |awk  ' {print $8} ' synchronizes remote data to a local directory using SSH  :rsync -pa -i -- Size-only --delete --timeout=300 remote_ip:/home/ubuntu /backup add  7Z  compress software: sudo  apt-get install p7zip p7zip-full p7zip-rar add  rar  software compression and decompression support  :sudo  apt-get install rar unrar Decompression  xxx.tar.gz :tar -zxvf xxx.tar.gz Decompression &NBSP;XXX.TAR.BZ2&NBSP;:TAR&NBSP;-JXVF&NBSP;XXX.TAR.BZ2 Compression aaa BBB directory is XXX.TAR.GZ&NBSP;:TAR&NBSP;-ZCVF&NBSP;XXX.TAR.GZ&NBSP;AAA&NBSP;BBB compressed AAA&NBSP;BBB directory is Xxx.tar.bz2 :tar &NBSP;-JCVF&NBSP;XXX.TAR.BZ2&NBSP;AAA&NBSP;BBB Add  lha  Support  :sudo apt-get install  LHA Add Solution  cab  File support  :sudo apt-get install cabextract display calendar: Cal set Date:date -s  Mm/dd/yy set time: date -s hh:mm write time to CMOS&NBSP;:HWCLOCK&NBSP;--SYSTOHC view CMOS time  :hwclock -- Show read CMOS time  :hwclock --hctosys sync time from server  :sudo ntpdate ntp.ubuntu.com set PC's time zone to Shanghai: sudo  cp /usr/share/zoneinfo/asia/shanghai /etc/localtime turns off UTC and writes the current time to CMOS. :sudo sed -ie  ' s/utc=yes/utc=no/g '  /etc/default/rcs;sudo hwclock -- SYSTOHC Modify the root password of MySQL  :sudo mysqladmin -u root -p password  ' Your new password ' How to use the command to turn off the monitor  :xset dpms force off set CPU frequency  :sudo apt-get install  cpufrequtils;sudo cpufreq-info  command shutdown: Sudo halt now shut down the machine:sudo Shutdown -h now 11 o'clock Auto Power off: sudo shutdown -h 23:0060 minutes after shutdown: sudo shutdown -h  +60 command to restart your computer: Sudo reboot Restart your computer now: Sudo shutdown -r now turn off your notebook's touchpad  :synclient  Touchpadoff=1 Open the Notebook's touchpad: synclient touchpadoff=0 count the frequency of each word and sort  :awk  ' {arr[$1]+=1 }end{for (i  in arr) {print arr[i] "\ t" i} '  file_name | sort -rn statistics 80 port connections and sort  : netstat -na|grep :80|awk  ' {print $5} ' |awk -f:  ' {print $1} ' |sort|uniq - C|sort -r -n Add the terminal to the right-click menu:sudo apt-get install nautilus-open-terminal  How to delete totem movie player's play History  :rm ~/.recently-usedvim  how to display color characters  :sudo cp /usr/share/vim/ VIMCURRENT/VIMRC_EXAMPLE.VIM&NBSP;/USR/SHARE/VIM/VIMRC  vim  Direct support for edit  .gz  file  :sudo  apt-get install vim-fullvim  How to display line numbers:: Set number View the startup program in Session settings: ls ~/.config/ Autostart improves the reaction speed of wine  :sudo sed -ie ' /GBK/,/^}/D '  /usr/share/x11/locale/zh_cn.utf-8/xlc_locale production ISO file: MKISOFS&NBSP;-O&NBSP;TEST.ISO&NBSP;-JRV  -v test_disk /home/carla/delay 10 seconds Capture: gnome-screenshot -d 10 delay 5 seconds Catch current activation window: gnome-screenshot  -w -d 5 how to command line burn: cdrecord -scanbus;cdrecord -v -eject speed=8 dev=1,1,0 Where is the  test.iso Recycle Bin: ~/.local/share/trash/where is the default open mode profile: ~/.local/share/applications/mimeapps.list How to view HTTP headers: w3m -dump_head http://www.xxx.com continuous monitoring of memory usage: Watch  -d free How to switch to the root account: sudo - HS read-only mount NTFS partition: sudo mount -t ntfs -o nls=utf8,umask=0 /dev/sdb1 /mnt/ C writable Mount NTFS partition: sudo mount -t ntfs-3g -o locale=zh_cn.utf8,umask=0 /dev/sdb1 / MNT/C mount FAT32 Partition: sudo mount -t vfat -o iocharset=utf8,umask=0 /dev/sda1 /mnt/ C Mount shared files: sudo mount -t smbfs -o  username=xxx,password=xxx,iocharset=utf8 // 192.168.1.1/share /mNt/share mount ISO file: sudo mount -t iso9660 -o loop,utf8 xxx.iso /mnt/ ISO with line number displays the contents of the file:nl  filename rmvb to Avi:for i in *; do mencoder -oac mp3lame  -lameopts vbr=3 -ovc xvid -xvidencopts fixed_quant=4 -of avi  $i  -o  ' echo  $i  | sed -e  ' s/rmvb$/avi/';  done convert svg to png:for i in bulk  in *; do inkscape  $i  --export-png= ' echo  $i  | sed -e  ' s /svg$/png/';  done bulk Zoom out to 30%:for i in *; do convert -resize 30%x30%  $1 sm-$1; done Batch conversion jpg to png:for i in *; do convert  $i   ' echo   $i  | sed -e  ' s/jpg$/png/';  done gets the extended information for JPG (EXIF):identify -verbose  Xxx.jpg View all listening ports for the current system: nc -zv localhost 1-65535 remove ^m:cat filename | tr -d from the file   "^m"  > newfile Remove the text^m:sed -e  "s/^m//g"  filename > newfile convert bin/cue to ISO file:sudo apt-get  Install bchunk;bchunk image.bin image.cue image conversion directory to ISO file: mkisofs dirname -o  isofile.iso convert CD to ISO file: Dd if=/dev/cdrom of=isofile.isoape to Flac:sudo apt-get install  flac shntool;shntool split -t  "%n.%p-%t"  -f example_utf-8.cue -o  flac example.ape -d flacoutputdirape conversion to mp3:sudo apt-get install flac  shntool lame;shntool split -t  "%n.%p-%t"  -f example_UTF-8.cue -o  ' Cust  ext=mp3 lame --r3mix -b 320 --quiet - %f '  example.ape -d  mp3outputdir Check for local security risks: Sudo apt-get install rkhunter;rkhunter --checkall How to install anti-virus software: sudo apt-get install clamav;clamscan -r ~/View network connection Status: Netstat -n | awk   '/^tcp/ {++s[$NF]} end {for (A in s)  print a, s[a]} ' statistical program memory consumption: Ps -eo fname,rss|awk   ' {arr[$1]+=$2} end {for  (I in arr)  {print i,arr[i]}} ' |sort -k2 &NBSP;-NR displays the current memory size:free -m |grep  "Mem"  | awk  ' {print $2} ' sort processes by memory from large to small: PS  -eo  "%c  : %p : %z : %a" |sort -k5 -nr the process from large to small by CPU utilization: ps -eo  "%c  : %p : %z : %a" |SORT&NBSP;&NBSP;-NR statistics the size of all JPG files in the current directory: find . -name *.jpg -exec wc -c {} \;|awk  ' {print $1} ' |awk   ' {a+=$1}end{print a} ' clears zombie process:ps -eal | awk  ' { if  ($2 ==  "Z")  {print $4}} '  | sudo kill -9CD  capture rail for  mp3  (lossy): Sudo apt-get  install abcde;abcde -o mp3 -bCD  capture rail for  Flac  (lossless):sudo apt-get  Install abcde;abcde&nBsp;-o flac -b displays statistics for the system installation package: Apt-cache stats Displays the name of all packages available for the system: Apt-cache pkgnames Displays the package information: Apt-cache  show k3b



Original address: Ubuntu Common 200 commands
Tags: bash ubuntu command

Smart recommendations
    • VirtualBox + Ubuntu virtual Machine directory sharing
    • ubuntu12.04 installation php5.4/php5.5
    • NTPDATE[16603]: The NTP socket is on use
    • Ubuntu AppArmor where sacred
    • Configure Web site SSL for HTTPS access under Ubuntu nginx

Ubuntu Common 200 Commands

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.