bash redirect
Error redirect to /dev/null
2>&-
2>/dev/null
|&
&>/dev/null
>/dev/null 2>&1
bash redirect
Error redirect to /dev/null
2>&-
2>/dev/null
|&
&>/dev/null
>/dev/null 2>&1
git rev-list
get latest commits for given directory
git rev-list -1 --abbrev-commit HEAD -- <dir-name>/
list all objects in git repo
git rev-list --objects --all
# delete files in history | |
git filter-branch --prune-empty \ | |
--index-filter 'git rm -rf --cached \ | |
--ignore-unmatch MY-BIG-DIRECTORY-OR-FILE' \ | |
--tag-name-filter cat -- --all |
# www-data is non-login user | |
sudo su -l www-data -s '/bin/bash' |
disable apt repo
sudo sed -i 's:^deb:#deb:' /etc/apt/sources.list
remove unwanted repo:
sed -i '/^#/d' sources.list
sed -i '/^deb-src/d' sources.list
sed -i '/backports/d' sources.list
search and replace
sed -e 's:origin:github:' -i .orig .git/config
find all config
find . -name config -depth 1 -exec sed -e 's:origin:github:' -i .orig {} \;
nmap - port scanner
nmap <machine-address>
nmap -v <machine-address>
The starting logical volume (vm) is 1TB. The volume group (data) has plenty of free space.
This can be queried with lvdisplay
.
The following command will extend the logical volume vm under volume group data by 4 TB
lvextend -L4T /dev/data/vm
resize2fs /dev/data/vm
Run vgdisplay
to confirm:
Ctrl-A [
This will activate copy mode in GNU/screen. Now, you can scroll up/down and look at your data. Use the following keys:
Ctrl-u
and Ctrl-d
scroll the display up/down by the specified amount of lines while preserving the cursor position.
(Default: half screen-full).Ctrl-b
and Ctrl-f
scroll the display up/down a full screen.