Daily Tips

  Benpian will use in their daily work to some commands or tricks, right, constantly updated ...

pip source

temporary use

# pip3 install -i https://pypi.douban.com/simple/ package

Permanent modification

# vim ~/.pip/pip.conf 
[global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple 

ubuntu源

# sudo sed -i 's/us.archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list
# sudo sed -i 's/mirrors.ustc.edu.cn/us.archive.ubuntu.com/g' /etc/apt/sources.list

UTC time transfer GMT

# date -d "1970-01-01 UTC `echo "$(date +%s)-$(cat /proc/uptime|cut -f 1 -d' ')+202077.293542"|bc ` seconds"

tcpdump packet capture

# sudo tcpdump -i p2p1 -w ./1.pcap host 172.16.xx.144

Vim tips

String match

:% S / string / & gn # frequency / statistical strings appear
: set ignorecase # case-insensitive (command line mode) 
: the SET noignorecase # case sensitive (command line mode)

Copy and paste indent solutions disorder problem

Enter the command set paste # command line mode:

linux View Folder Size

# Du - SH the WebRTC / 
# du - SH * | the Sort -h # Sort by size

IP Regular

Use shell commands to extract ip address from the text:

# grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' file.txt
# grep -E -o '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)' file.txt

Take some lines in the file linux

Take file lines 200-300, the other is written to the file:

# sed -n '200,300p' 172.16-ips.txt > 100.txt

linux to windows file format conversion - newline

# sed -e 's/$/\r/' 10-vul.txt > 10-vuls.txt

Mirror cloning site

# wget -m -p -E -k -K -np -v http://www.baidu.com

Output redirection

# id 2>&1 |tee 12.txt
# id 1 |tee 1.txt

OPTIONS method enabled to view the site

# curl -I -X OPTIONS http://what-site/

Vulnerability Search (NVD)

The National Vulnerability Database: https: //nvd.nist.gov/products/cpe/search

Find specific files

.Git find all files in the current directory and subdirectories

# Find ./ -name -type D ' .git '     # find 
# Find ./ -name -type D ' .git ' -exec RM -rf {} \; # to identify and remove
# find . -name *.wav -exec du -sh {} \; | sort -h

Single file size exceeds 100M

# find ./ -type f -size +102400k
# find ./ -type f -size +102400k -exec du -sh {} \;

At the same time find a variety of file suffixes

Find suffix such as TXT | the INI | PHP file 
# the Find ./ -regex " * \ YUV.. " 
# The Find ./ -regex " * \ WAV \ |.... * \ YUV " 
# the Find ./ -regex " .. * \ TXT \ | * \ the INI \ | * \ PHP.... " -exec RM -rf * {} \;

The number of files in the directory Statistics

# ls -lR | grep "^-"| wc -l
# webrtc-linux/src# ls -lR | grep "^-"| wc -l

pycharm delete files * .pyc

# find .  -name *.pyc -exec rm -rf {} \;

markdown Insert Picture

![image](https:///xxx.png)

ls output a column

# Ls -l | awk  ' {print $ 9} '

Display the current existence of all user groups

# Groups             # simple list 
# CAT / etc / Group # can see the group with which users

linux basic compilation tools

Ubuntu/Debian
# apt-get install build-essential
RedHat/CentOS
# yum group install "Development Tools"

 

Guess you like

Origin www.cnblogs.com/Hi-blog/p/Tips.html