Every time you visit the ubuntu Chinese forum, you will see a random command line under the title of the post, which is well written. So I output all of them. I wanted to make a picture. It's a pity that it's too big. We have to use the output method for 220 entries.
View the installation content of the software xxx:dpkg -L xxx
Find the software in the software library:Apt-cache search Regular Expression
Find the software in the software library:Aptitude search package
Find the package of the file:dpkg -S filename
Find the package of the file:apt-file search filename
Query which packages the software xxx depends on:apt-cache depends xxx
Query 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 dist-upgrade
Clear the residual configuration file of the deleted package:dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
Automatic Processing of H files is missing during compilation:sudo auto-apt run ./configure
View the temporary storage directory of the downloaded package 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
Recover all packages from the list of backup installation packages:dpkg --set-selections < ~/somefile;sudo dselect
Clear the old software cache: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
View the address of the package on the server:apt-get -qq --print-uris install ssh | cut -d\' -f2
View the kernel:uname -a
View the Ubuntu version:Cat/etc/issue or lsb_release-
View the modules loaded by the kernel:lsmod
View PCI devices:lspci
View USB devices:lsusb -v
View the NIC status:sudo ethtool eth0
View CPU information:cat /proc/cpuinfo
Display current hardware information:sudo lshw
Display System running time:uptime
View the partition of the hard disk:sudo fdisk -l
Hard Disk Partition:sudo fdisk /dev/sda
Hard disk formatting:sudo mkfs.ext3 /dev/sda1
Check the hard disk (do not check the mounted partitions; otherwise, the data is easily damaged ):sudo fsck /dev/sda1
Partition mounting:Sudo mount-t file system type (-o nls = utf8 or-o iocharset = utf8)
Detach a partition:Sudo umount directory name or device name
View the IDE Hard Disk information:sudo hdparm -i /dev/hda
View STAT hard disk information:Sudo hdparm-I/dev/sda or sudo blktool/dev/sda id
View the remaining disk space:df
View the space occupied by the directory:Du-hs directory name
The USB flash drive cannot be detached:sync;fuser -km /media/usbdisk
View the current read/write status of the hard disk:sudo iostat -x 2
View the current memory usage:free
Dynamically display process execution status:top
View the processes:ps -A
View the current process tree:pstree
Abort a process:Kill process number or killall process name
Force stop a process:Kill-9 process number or killall-9 process name
Abort a program in graphical mode:Xkill the mouse with the skeleton icon. Click the program to be aborted.
View the files opened by the process:lsof -p
Display the process of opening the file abc.txt:lsof abc.txt
Display what programs are running on port 22:lsof -i :22
Display the files currently opened by the nsd process:lsof -c nsd
Run the program in the background. After logging out, the program does not end:Nohup Program &
Detailed display of program running information:strace -f -F -o outfile
Increase the maximum number of opened files in the system:Ulimit-n 4096 or echo 4096>/proc/sys/fs/file-max
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
How to Set a dynamic Domain Name:w3m -no-cookie -dump 'http://usere:pass@members.3322.org/dyndns/update?system=dyndns&hostname=yourdns.3322.org'
Query the NIC address based on the IP Address:Arping IP Address
Check the computer name based on the IP Address:Nmblookup-a ip Address
View the current IP Address:ifconfig eth0 |awk '/inet/ {split($2,x,":");print x[2]}'
View the IP address of the current Internet: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\}'
Check the program for listening to port 80:lsof -i :80
View the physical address of the current NIC:arp -a | awk '{print $4}'
Add a second IP address for the same NIC:sudo ifconfig eth0:0 1.2.3.4 netmask 255.255.255.0
Now let the Network Support nat:echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward; sudo iptables -t nat -I POSTROUTING -j MASQUERADE
View route information:Netstat-rn or sudo route-n
Manually add a route entry:sudo route add -net 192.168.0.0 netmask 255.255.255.0 gw 172.16.0.1
Manually delete a route entry: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 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
Mask IPV6:echo 'blacklist ipv6' | sudo tee /etc/modprobe.d/blacklist-ipv6
Check the current network connection status and program:sudo netstat -atnp
View the current traffic of ADSL:sudo ethstatus -i ppp0
View the registration and filing status of a domain name:whois baidu.cn
View the Routing Status of a domain name:tracepath baidu.cn
Obtain the IP address from the server again:sudo dhclient
Download the website documentation:wget -r -p -np -k http://www.xxx.com
How to download five threads:axel -n 5 http://www.xxx.com/downloadfile.zip
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
Start a service temporarily:/Etc/init. d/service name start
Add users:Sudo adduser User Name
Delete A User:Sudo deluser User Name
Modify the password of the current user:passwd
Change User Password:Sudo passwd User Name
Modify user information:sudo chfn userid
How to disable an account:Sudo usermod-L user name or sudo passwd-l User Name
How to enable an account:Sudo usermod-U user name or sudo passwd-u User Name
Add a user to the admin group:Sudo usermod-G admin-a username
Configure which Java is used by default:sudo update-alternatives --config java
Terminal setting Proxy:export http_proxy=http://xx.xx.xx.xx:xxx
Modify system logon information:sudo vim /etc/motd
Use sun's java compiler:sudo update-java-alternatives -s java-6-sun
Switch the input method engine:im-switch -c
Convert the file name from GBK to UTF8:convmv -r -f cp936 -t utf8 --notest --nosmart *
Convert the file content from GBK to UTF8:iconv -f gbk -t utf8 $i > newfile
Convert mp3 tag encoding:sudo apt-get install python-mutagen;find . -iname '*.mp3' -execdir mid3iconv -e GBK {} \;
Chinese characters are displayed in the console:sudo apt-get install zhcon;zhcon --utf8 --drv=vga
Lftp logon Remote Windows Chinese FTP:lftp :~>set ftp:charset GBK
Garbled PDF files:sudo apt-get install xpdf-chinese-simplified xpdf-chinese-traditional poppler-data
View the file content on one screen:Cat file name
View the file content by page:More file name
You can view the file content on a controllable page:Less file name
View part of the file based on String Matching:Grep string file name
Display the name of the file containing the string:Grep-l-r string path
Display file names that do not contain strings:Grep-L-r string path
Quickly search for a file:Find directory-name file name
Create two empty files:touch file1 file2
Recursively create some nested directories:mkdir –p /tmp/xxs/dsd/efd
Recursively Delete nested directories:rm –fr /tmp/xxs
Return to the current user's home directory:cd ~
View the absolute path of the current directory:pwd
List all files in the current directory:ls -a
Move the file in the path and rename it:Mv path/file/New Path/New File Name
Copy a file or directory:Cp-av original file or original directory new file or new directory
View File Types:file filename
Compare the differences between the two files:diff file1 file2
Display the last six lines of the xxx file:tail -n 6 xxx
Keep displaying the latest content:tail -n 10 -f /var/log/apache2/access.log
View the content of lines 5 to 10th of the file:sed -n '5,10p' /var/log/apache2/access.log
Find the xxx command:Apropos xxx or man-k xxx
Transfer files through ssh:scp -rp /path/filename username@remoteIP:/path
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 special file named -help.txt:Rm -- --help.txt or rm./--help.txt
View the subdirectories of the current directory:Ls-d */. Or echo */.
Move the files accessed in the last 30 days to the parent back directory:find . -type f -atime -30 -exec mv {} ../back \;
Display xxxx files within one hour:find . -type f -mmin -60|xargs -i grep -l xxxx '{}'
Display files in the last two to eight hours:find . -mmin +120 -mmin -480 -exec more {} \;
Delete Files modified 30 days ago:find . -type f -mtime +30 -mtime -3600 -exec rm {} \;
Delete files that were accessed 30 days ago:find . -type f -atime +30 -atime -3600 -exec rm {} \;
Delete the file ending with avi or rm from guest:find . -name '*.avi' -o -name '*.rm' -user 'guest' -exec rm {} \;
Delete Files Not used seven days after the end of java and xml:find . ! -name *.java ! -name '*.xml' -atime +7 -exec rm {} \;
Delete all. svn directories:find . -name .svn -type d -exec rm -fr {} \;
Delete all Temporary File ended:find . -name '*~' -exec rm {} \;
Count the number of current files:ls .|wc -w
Count the number of current directories:ls -l |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}'
Use ssh to synchronize remote data to a local directory:rsync -Pa -I --size-only --delete --timeout=300 Remote_IP:/home/ubuntu /backup
Added 7Z compression software:sudo apt-get install p7zip p7zip-full p7zip-rar
Added support for rar software compression and decompression:sudo apt-get install rar unrar
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
Added lha support:sudo apt-get install lha
Added support for resolving cab files:sudo apt-get install cabextract
Show Calendar:cal
Set date:date -s mm/dd/yy
Set Time:date -s HH:MM
Write time into CMOS:hwclock --systohc
View the CMOS time:hwclock --show
CMOS read Time:hwclock --hctosys
Synchronization time from the server:sudo ntpdate ntp.ubuntu.com
Set the time zone of your computer to Shanghai:sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
Disable UTC and write 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 disable the monitor:xset dpms force off
Set the CPU frequency:sudo apt-get install cpufrequtils;sudo cpufreq-info
Command shutdown:sudo halt
Shutdown now:sudo shutdown -h now
Automatic shutdown:sudo shutdown -h 23:00
Shutdown in 60 minutes:sudo shutdown -h +60
Command to restart the computer:sudo reboot
Restart your computer now:sudo shutdown -r now
Close the notebook touchpad:synclient touchpadoff=1
Enable the notebook touchpad:synclient touchpadoff=0
Count the occurrence frequency of each word and sort it:awk '{arr[$1]+=1 }END{for(i in arr){print arr[i]"\t"i}}' FILE_NAME | sort -rn
Collect and sort port 80 connections: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 the playback history of a Totem PLAYER:rm ~/.recently-used
How to display color characters in vim:sudo cp /usr/share/vim/vimcurrent/vimrc_example.vim /usr/share/vim/vimrc
Let vim directly support editing the. gz file:sudo apt-get install vim-full
How to display the row number in vim::set number
View the Startup Program in the session settings:ls ~/.config/autostart
Increase the response speed of wine:sudo sed -ie '/GBK/,/^}/d' /usr/share/X11/locale/zh_CN.UTF-8/XLC_LOCALE
Create an ISO file:mkisofs -o test.iso -Jrv -V test_disk /home/carla/
Image Capture with a latency of 10 seconds:gnome-screenshot -d 10
The current activation window is captured with a latency of 5 seconds:gnome-screenshot -w -d 5
How to use command line burning:cdrecord -scanbus;cdrecord -v -eject speed=8 dev=1,1,0 test.iso
Where is the recycle bin:~/.local/share/Trash/
Where is the configuration file opened by default:~/.local/share/applications/mimeapps.list
How to view the HTTP header:w3m -dump_head http://www.xxx.com
Continuously monitor memory usage:watch -d free
How to switch to the root account:sudo -Hs
Read-Only mounting of ntfs partitions:sudo mount -t ntfs -o nls=utf8,umask=0 /dev/sdb1 /mnt/c
Writable mounting of ntfs partitions:sudo mount -t ntfs-3g -o locale=zh_CN.utf8,umask=0 /dev/sdb1 /mnt/c
Mount the 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 the ISO file:sudo mount -t iso9660 -o loop,utf8 xxx.iso /mnt/iso
Content of the file displayed with a row number:Nl file name
Convert rmvb to avi in batches: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 in batches:for i in *; do inkscape $i --export-png=`echo $i | sed -e 's/svg$/png/'`; done
Batch scale down images to 30%:for i in *; do convert -resize 30%x30% $1 sm-$1; done
Batch convert jpg to png:for i in *; do convert $i `echo $i | sed -e 's/jpg$/png/'`; done
Get jpg extension information (Exif ):identify -verbose xxx.jpg
View All listening ports of the current system:nc -zv localhost 1-65535
Remove ^ M from the file:cat filename | tr -d "^M" > newfile
Remove ^ M from the file:sed -e "s/^M//g" filename > newfile
Convert bin/cue to the iso file:sudo apt-get install bchunk;bchunk image.bin image.cue image
Convert the directory to an iso file:mkisofs dirname -o isofile.iso
Convert CD to iso file:dd if=/dev/cdrom of=isofile.iso
Ape to flac:sudo apt-get install flac shntool;shntool split -t "%n.%p-%t" -f example_UTF-8.cue -o flac example.ape -d flacOutputDir
Ape 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 whether local security risks exist:sudo apt-get install rkhunter;rkhunter --checkall
How to install anti-virus software:sudo apt-get install clamav;clamscan -r ~/
View the network connection status:netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'
Memory consumption of the statistical program:ps -eo fname,rss|awk '{arr[$1]+=$2} END {for (i in arr) {print i,arr[i]}}'|sort -k2 -nr
Display the current memory size:free -m |grep "Mem" | awk '{print $2}'
Process by memory from large to small:ps -eo "%C : %p : %z : %a"|sort -k5 -nr
Process by cpu utilization from large to small:ps -eo "%C : %p : %z : %a"|sort -nr
Measure 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}'
Clear dead processes:ps -eal | awk '{ if ($2 == "Z") {print $4}}' | sudo kill -9
CD ):sudo apt-get install abcde;abcde -o mp3 -b
CD capture is Flac (lossless ):sudo apt-get install abcde;abcde -o flac -b
Displays the statistics of the system installation package:apt-cache stats
Show the names of all available system packages:apt-cache pkgnames
Show package information:apt-cache show k3b
» Reprinted copyright: Some of the ubuntu Forum pulled down from the command line» This article link address: http://www.jijiwaiwai.info/2012/03/27/ubuntu_forum_cli_js_get_linux/» if you like can: Click here to subscribe to this site