Linux Shell Learning

Source: Internet
Author: User

1. Man Shows color characters

In ~ /. Add the following content to bashrc:

Export less_termcap_mb = $ '/E [01; 31m'
Export less_termcap_md = $ '/E [01; 31m'
Export less_termcap_me = $ '/E [0m'
Export less_termcap_se = $ '/E [0m'
Export less_termcap_so = $ '/E [01; 44; 33m'
Export less_termcap_ue = $ '/E [0m'
Export less_termcap_us = $ '/E [01; 32m'

 

2. Forcibly clear the recycle bin

$ Sudo Rm-RF $ home/. Local/share/trash/Files

(The recycle bin path after Ubuntu 8.04 is $ home/. Local/share/trash, and before Ubuntu 8.04 is $ home/. Trash)

 

3. Configure the path of the configuration file in the Open Mode

Global:/etc/gnome/defaults. List

User :~ /. Local/share/applications/defaults. List

 

4. Clear/display the icon of the mounted hard disk on the desktop

Clear icon: gconftool-2 -- set/apps/Nautilus/desktop/volumes_visible 0 -- type bool

Show icons: gconftool-2 -- set/apps/Nautilus/desktop/volumes_visible 1 -- type bool

 

5. Synchronize Internet server time

$ Sudo ntpdate ntp.ubuntu.com

$ Sudo ntpdate time.nist.gov

 

6. delete all "~ "End file

$ Find.-Name "*~ "-Exec RM {}/;

 

7. Delete all files modified 30 days ago

$ Find.-Type F-mtime + 30-mtime-3600-exec RM {}/;

 

8. display the subdirectories of the current directory

$ LS-D */.

$ Echo */.

 

9. Replace uppercase letters in the file name with lowercase letters.

Rename 'tr/A-Z/a-Z '*

 

10. Ssh File Transfer

1) Copy local files to the remote server:

$ SCP-RP/path/filename username @ remoteip:/path

2) download files from the remote server to the local device:

$ SCP-RP username @ remoteip:/path/filename/path

 

11. Remove the file suffix

$ Echo XXX. c | SED's // (. */)/.. * $/1 /'

 

12. multi-thread download

$ Sudo apt-Get install Axel

$ Axel-N 5 http://www.xxx.xxx/xx.zip

 

13. view route information$ Netstat-Rn $ sudo route-n 14. view the program listening to port 80$ Lsof-I: 80 15. display the process of opening file a.txt$ Lsof a.txt 16. view files opened by the ProcessLsof-P process_id 17. Killing botnetsPS-eal | awk '{if ($2 = "Z" {print $4}' | xargs sudo kill-9 18. Run the program in graphical mode.$ Xkill 19. Continuous monitoring memory usage cleared$ Watch-D free (CTRL + C Exit)

20. The USB flash drive cannot be detached.

$ Sync

$ Fuser-km/Media/USB

 

21. Convert OTF to TTF

$ Sudo apt-Get install fontforge

Create an otf2ttf. Sh file:

#! /Usr/local/bin/fontforge
# Converts a font to TrueType (. TTF)
Print ("Opening" + $1 );
Open ($1 );
Print ("saving" + $1: R + ". TTF ");
Generate ($1: R + ". TTF ");
Quit (0 );

 

Conversion command: $ fontforge-script otf2ttf. Sh <. TTF font file>

Batch conversion: $ for I in *. otf; do fontforge-script otf2ttf $ I; done

Source: http://www.stuermer.ch/blog/convert-otf-to-ttf-font-on-ubuntu.html

 

22. File Segmentation

$ Split-B 2 m largefile lf _

Split largefile into small files whose names are prefixed with LF and whose size is 2 MB.

 

23. List open files

$ Lsof

 

24. When the file is displayed, the row number is also displayed.

$ Nl xxx. cpp

 

25. ls to list absolute paths of Objects

 

$ Ls | sed "s: ^: 'pwd '/:"

 

 

Reference: [Ubuntu command tip manual]

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.