scripts

UNIX/Linux

1.Delete all files in the current directory that do not start with 20111001 and end with bad

rm ls -1 | grep -v ’20111001.*.bad’

2.Change all file names in the current directory from uppercase to lowercase

for each in *; do mv -i $each echo $each|tr A-Z a-z;done

3.wget download website directory

Download the entire website directory

wget -c -r -np -k -L -p http://www.xxx.com/path/

Download the entire website directory+external images or connections

wget -np -nH -r --span-hosts http://www.xxx.com/path/

4.Delete lines in the document that contain specific strings

sed -i '/qwert/d' /path/to/file

Delete file contains lines for qwert from /path/to/file

5.Reverse convert the. db file generated by Postmap to a text configuration file

postalias -s test > testrecover

Note: The first test refers to test.db, so there is no need to input. db

6.Command line shutdown of selinux

setenforce 0

7.View the space occupied by each folder in the root directory (1 layer depth)

du -h --max-depth=1 /

MAC OSX

1.Prompt for program copy damage during system installation
Due to verification issues with the installation program certificate, it is necessary to change the system time (to ensure network disconnection)
10.14 date 101112132015
10.15 date 101112132019

Windows

1.Traverse the current directory and subdirectories, renaming all files with HTML suffixes as PHP suffixes

for /r . %a in (*.html) do rename %a *.php

2.Copy all PHP suffix files, including subdirectories, from C: \ BAK to D: \ BAK with the same name and suffix as txt

xcopy C:\BAK\*.php D:\BAK\*.txt /s

Turn on and off Windows features

1.Command line startup/shutdown of Windows built-in firewall

Enable

netsh firewall set opmode enable

Disable

netsh firewall set opmode disable

2.Win7 disable/enable hibernation

Disable

powercfg -h off

Enable

powercfg -h on

3.Windows Server 2003 turn on/off automatic disk letter allocation

Enable

mountvol /e

Disable

mountvol /n

4.Win8/2012Enable/disable F8 to enter safe mode

Enable

bcdedit /set {default} bootmenupolicy legacy

Disalbe

bcdedit /set {default} bootmenupolicy standard

5.Win8/10/11 Enable/disable testing mode

Enable

bcdedit /set testsigning on

Disable

bcdedit /set testsigning off

Hyper-V Common commands

Enable Hyper-V virtualization nesting for a virtual machine (VM Name)

1
Set-VMProcessor -VMName VM-Name -ExposeVirtualizationExtensions $true

Disable Hyper-V virtualization nesting for a virtual machine (VM Name)

1
Set-VMProcessor -VMName VM-Name -ExposeVirtualizationExtensions $false

Phone

1.View phone IMEI

*#06#

2.View phone and battery information (temperature, voltage, etc.)

*#*#4636#*#*