Install programs on drives other than C:\. Useful when hard drives fail and programs need to be reinstalled; the old references block new installation. Also useful when the main C:\ drive is small, and the program installer does not offer the option of choosing the install location.
start someProgramInstaller.exe /DIR="D:\Programs\Folder\On\Another\Drive\ProgramName"
Source: https://knowledgebase.jam-software.com/7573
- Create a new virtual environment, if needed.
py -m venv .venv - Change the interpreter path, if needed.
CTRL+SHIFT+P - Install
pip-toolsin the virtual environment, if starting for the first time:.venv/Scripts/activatepip install pip-tools
- Start the virtual environment.
.venv/Scripts/activate - Compile the requirements using pip.
pip-compile requirements.in - Sync the requirements.
pip-sync requirements.txt
- πΈ Select entire line:
CTRL+L - πΈπΈπΈ Select all occurences:
CTRL+SHFT+L - Collapse the whole file:
CTRL+K+0 - Expand the whole file:
CTRL+J+0 - "There is a problem in this file":
CTRL+SHIFT+M - Comment or Uncomment:
CTRL+/ - Quickly move lines or blocks up:
ALT+UP ARROW - Quickly move lines or blocks down:
ALT+DOWN ARROW - Find settings.json on Windows 10:
$HOME/AppData/Roaming/Code/User/settings.json
PowerShell is the default terminal at least in my installation of VSCode. My favorite terminal appearance is to show the current folder, in a bold green, followed by the greater than sign, >. To do this, add a prompt function to your PowerShell profile. Choose your own colors, besides green.
Assumption: Get-ExecutionPolicy -List returns RemoteSigned for the current scope.
C:\Users\MyUserName\Documents\WindowsPowerShell\profile.ps1
function prompt {
$Host.ui.rawui.foregroundcolor = "Green"
"$([char]27)[1m" + $(Get-Location).Path.Substring((Get-Location).Path.LastIndexOf("\")+1) + " > "
}- Install Windows Subsystem for Linux to get a Linux shell for Windows.
- Enter
wslinto PowerShell (or your shell of choice) to get started.
The search term font-size: 12px is just an example; replace this text with the search pattern.
grep -Rnw . -e 'font-size: 12px';
Source: rakib and CodeWizard on StackOverflow
du -h --threshold=1G
du -sh -- * | sort -h
Such as 644 or 777.
stat -c "%a %n" *
eval "$(ssh-agent -s)"
ssh-add /mnt/c/Users/Username/.ssh/private_openssh
rsync: Sync folders and files between a remote server and a local server.
Examples:
- Sync from a remote server to a local server.
- Sync between 2 remote servers.
- WordPress usage: Sync uploads, themes, and plugins.
Source (Remote): [email protected]:/www/path/public/shared/web/app/uploads/
Destination (Local): /mnt/c/destination/uploads/ (also known as C:\destination\uploads)
rsync -av --dry-run -e 'ssh -i /local/path/to/public_id_rsa -p 22' [email protected]:/source/home/username/domains/example.com/shared/web/app/uploads /mnt/c/destination/uploads/
Remove the --dry-run flag.
rsync -av --progress --delete -e 'ssh -i /path/to/id_rsa -p 22' /mnt/c/source/themes/my-theme/ username@IP:/destination/home/username/domains/example.com/path/to/themes/my-theme/
Notes:
- Add the
--dry-runflag to test the SSH connection from the shell and show which files will be transferred. - The
$HOMEvariable will not be the same locally and remotely. - The trailing
/inuploads/performs an inner copy, targeting all the files and folders inside ofuploads. If the trailing forward slash "/" were omitted, then a new folder would be created inside of the destinationuploadsfolder:/mnt/c/source/uploads/uploads/ - Consider adding the
--progressflag. - Carefully consider adding the
--deleteflag to delete files from the destination, which are not present in the source. Use--deletewith caution to avoid losing data!- I generally only use
--deleteto sync development uploads with production so that it exactly matches production. - Another common use for
--deleteis backing up plugin folders before testing new versions. And if the new plugin files need to be overwritten, the--deleteflag removes any new files.
- I generally only use
- Use the
--excludetag to exclude files or directories; useful for--exclude={'composer.json', 'composer.lock'}and/or--exclude '.git/'
Push to a remote subtree.
git subtree push --prefix=path/to/subdir remote-name refFor example: A static site generator uses a separate remote repository for its theme files.
- The path/to/subdir theme is installed at
themes/theme-name. - The remote-name was established with
git remote add -f theme-name https://github.com/username/theme-name.git - The ref could be
master,main, or whichever branch on the remote to be targeted.
Make the Bash prompt string a bold green, followed by a dollar sign.
Edit the ~/.bashrc file using your editor of choice.
Add an export statement to .bashrc, defining:
- green-text,
- the most current folder in path,
- a couple of spaces, and
- the $ sign.
export PS1="\[\033[01;32m\]\W \\$ \[$(tput sgr0)\]"Command Line Interface for WordPress.
Install this WP-CLI extension: wp-cli-dotenv-command
Use the wp dotenv init command to create a new environment file with salts:
wp dotenv init --template=".env.example" --with-salts
wp plugin update --all --dry-run