Unix/Linux tips

Source: Internet
Author: User
Copy the specified files under the directory (including subdirectories) to a specific directory, but does not contain the directory, only files.

Find ~ /My. Codes-name "*. c"-exec CP {}.\;


Search for 0-byte files in the directory and delete them.

Find.-size 0C-exec Rm-I {}\;


Remove the port setting file (under the corresponding port directory)

Make rmconfig/make rmconfig-recursive


List all users

Logins


Synchronize Internet time

Ntpdate clepsydra.dec.com

 

Rm cannot be deleted once because too many files are generated by Sendmail.

Find/var/spool/cilentmqueue/-type F-delete 

 

Pack Installed ports

Echo/var/DB/PKG/*/| tr \ n | cut-F5-D/| xargs-N 1 pkg_create-JB

 

Use pkg_cutleaves for software package management

Pkg_cutleaves-Lc> ~ /Installed.txt # generate all leaf nodes

Pkg_cutleaves-LXG # generate the/usr/local/etc/pkg_leaves.exclude file and record the dependencies of each software package

Pkg_cutleaves-rxg # Delete unnecessary software packages

 

Update System Patches

# FreeBSD-update fetch

# FreeBSD-update install

 

Tcpdump monitors and records specified IP Packets

Tcpdump-VV-nn-S-W ~ /Log. Log host 192.168.1.1

 

Start chromium in stealth mode

Chromium -- incognito

 

Mount fat/FAT32 format USB flash drives cannot display long file names

Mount-T vfat/dev/sdb/mnt/directory

 

Locale: cannot set lc_all to default locale: no such file or directory

Localedef-v-c-I zh_cn-F UTF-8 zh_CN.UTF-8

 

Hg SSL required (note: this modification is not secure)

Modify ~ /. Hgrc, add

[Web]

Push_ssl = false

ModifySource codeUnder the library directory. HG/hgrc (if the file does not exist, add)

[Web]

Allow_push = *

 

Random start of spawn-fcgi in FreeBSD (unverified)

Add the following section in/etc/rc. conf:

Code 1 # Start PHP - FastCGI
2 If [ - X / USR / Local / Bin / Spawn - Fcgi]; then
3 / USR / Local / Bin / Spawn - Fcgi - A 127.0 . 0.1   - P 9000   - U WWW - G WWW - C 25   - F / USR / Local / Bin / PHP - CGI >   / VaR / Run / Fcgi. PID
4 Echo - N ' Php-FastCGI '
5 Fi

 

Vim/gvim save and restore the session

Save:

: Mksession session_name.vim

Recovery:

# Vim-s session_name.vim

 

Mount the Windows shared directory

Mount_smbfs-I 192.168.2.1 // username @ servername/share/mount point

 

SSH remote append pub key

Cat ~ /. Ssh/id_rsa.pub | SSH user @ machine "mkdir ~ /. Ssh; CAT >> ~ /. Ssh/authorized_keys" 

 

Vim deletes content in the specified start and end rows.

: N1, n2d

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.