Skip to content

Instantly share code, notes, and snippets.

@cirias
Last active November 3, 2015 01:24
Show Gist options
  • Save cirias/594242077126b954c9ac to your computer and use it in GitHub Desktop.
Save cirias/594242077126b954c9ac to your computer and use it in GitHub Desktop.
linux-tips.md
Set brightness
xrandr -q | grep " connected"
xrandr --output HDMI1 --brightness 0.7
Sudo without password on Ubuntu
sudo visudo
<username> ALL=(ALL) NOPASSWD: ALL
Remove package and dependences
apt-get autoremove
Change default editor
sudo update-alternatives --config editor
Update new font

After copy font file to ~/.fonts

sudo fc-cache -f
How to delete file(s) in secure manner
shred
VPN Error
NetworkManager[3590]: <error> [1412801125.247964] [nm-vpn-connection.c:1374] get_secrets_cb(): Failed to request VPN secrets #2: (6) No agents were available for this request.

mv .gconf/apps/nm-applet/%gconf.xml .gconf/apps/nm-applet/%gconf.xml.backup
Cap as Ctrl
sudo vi /etc/default/keyboard

then find the line that starts with XKBOPTIONS, and add ctrl:nocaps to make Caps Lock an additional Control key or ctrl:swapcaps to swap Caps Lock and Control.

For example, mine looks like

XKBOPTIONS="lv3:ralt_alt,compose:menu,ctrl:nocaps"

then run

sudo dpkg-reconfigure keyboard-configuration

The reason this way is better is that it will take effect on the virtual consoles (e.g. Ctrl+Alt+F1) as well as in the graphical desktop.

ip route
  1. make sure the main route table unmodified.
$ ip route show table main
default via 192.168.11.1 dev p2p1 
172.17.0.0/16 dev docker0  proto kernel  scope link  src 172.17.42.1 
172.18.188.0/24 dev eth0  proto kernel  scope link  src 172.18.188.132 
192.168.11.0/24 dev p2p1  proto kernel  scope link  src 192.168.11.42
  1. create a custom route table, edit /etc/iproute2/rt_tables add 2 custom to last.
  2. add rule to the table custom.
$ ip route add default via 172.18.188.1 dev eth0 table custom
$ ip route add 192.168.11.0/24 via 192.168.11.1 dev p2p1 table custom
# ip route show table custom
  1. create match rule
# ip rule add iif ppp0 table custom
$ ip rule add from 10.99.99.0/24 table custom
# ip rule show
list all version of a package
# list
sudo dnf --showduplicates list vim
# install
sudo dnf install vim-enhanced-2:7.4.764-1.fc22.x86_64 --allowerasing
Fedora create rc.local
touch /etc/rc.d/rc.local
# add bash sheband and your content
chmod +x /etc/rc.d/rc.local
Fedora brightness control
dnf install xbacklight
# or
cat /sys/class/backlight/intel_backlight/brightness
Make Windows live usb
# Install ms-sys
tar -xzvf ms-sys.tar.gz
cd ms-sys
make
make install

# create usb
dd if=win8.iso of=/dev/sdb bs=4M
ms-sys -7 /dev/sdb
Change all the directories to 755
find /opt/lampp/htdocs -type d -exec chmod 755 {} \;
Show public key fingerprint
ssh-keygen -E md5 -lf ~/.ssh/id_dsa.pub
Create public key from private
ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment