Last active
February 20, 2020 20:35
-
-
Save inad9300/8f6b5948213cffe86b24e765fdbc8762 to your computer and use it in GitHub Desktop.
Useful GNU/Linux commands and tips.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
st = status | |
co = checkout | |
ci = commit | |
# Undo commit. This resets HEAD, so the currently checked out commit to its parent. It should only be used when you | |
# have accidentally committed something and want it to be "uncommited" again. So it takes all changes of the latest | |
# commit back to "local" changes. | |
uci = reset HEAD~ | |
# Display git branch graph. | |
adog = log --all --decorate --oneline --graph | |
# Remove all local branches not present on remote. | |
cleanup = ! git remote prune origin && git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d | |
# Show the diff of the code right after a pull. | |
dull = git diff HEAD@{1} HEAD@{0} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# NOTE To run the command, these two are valid options: | |
# a) Run it with a dot in front, e.g. ". go.sh /tmp". | |
# b) Create an alias in "~/.bashrc", e.g. "alias go='. go.sh'", and run the alias, e.g. "go /tmp". | |
if [ -n "$1" ]; then | |
cd $1 | |
ls | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Analyze startup times | |
systemd-analyze | |
systemd-analyze blame | |
systemd-analyze critical-chain | |
# Reduce wrong password delay to 0.5 s (not working on elementary OS?) | |
sudo vim /etc/pam.d/login | |
auth optional pam_faildelay.so delay=500000 | |
# Sane sudo options | |
sudo visudo | |
Defaults env_reset,timestamp_timeout=30,pwfeedback # Re-ask for password every 30 min and enable password feedback. | |
Defaults !tty_tickets # Allow session to be valid for all terminals. | |
`whoami` ALL=(ALL) NOPASSWD:ALL # Give yourself some trust (place after all other priviledge specifications). | |
# Enable multitouch | |
# https://github.com/bulletmark/libinput-gestures | |
# Disable touchscreen (on Surface Pro) | |
xinput disable "pointer:NTRG0001:01 1B96:1B05" | |
# Disable Wi-Fi powersave in Ubuntu | |
sudo vim /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf | |
[connection] | |
wifi.powersave = 2 | |
# Enable fractional scaling in Ubuntu | |
# For X: | |
gsettings set org.gnome.mutter experimental-features "['x11-randr-fractional-scaling']" | |
# For Wayland: | |
gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']" | |
# Generate SSH keys | |
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment