Skip to content

Instantly share code, notes, and snippets.

@albertzsigovits
Last active June 27, 2019 07:06
Show Gist options
  • Save albertzsigovits/8716cd6808aff19c358925978671aaa1 to your computer and use it in GitHub Desktop.
Save albertzsigovits/8716cd6808aff19c358925978671aaa1 to your computer and use it in GitHub Desktop.
Universal Linux Tips and Tricks
# Linux tips & tricks
#####################
- Binding WIN+L or Ctl+Alt+L to xscreensaver-lock:
==================================================
1. edit ~/.config/openbox/ubuntu-rc.xml
2. <keybind key="C-A-L">
<action name="Execute">
<command>dm-tool lock</command>
</action>
</keybind>
<keybind key="W-L">
<action name="Execute">
<command>dm-tool lock</command>
</action>
</keybind>
3. openbox --reconfigure
- Get colored output on jq with less:
=====================================
jq -C '' random.json | less -R
- Rotating second monitor display:
==================================
xrandr --screen DP2 --rotate left
- Change keyboard locale:
=========================
sudo dpkg-reconfigure keyboard-configuration
setxkbmap hu
- Get command autocompletion in the prompt:
===========================================
sudo apt-get install bash-completion
- Sorting and displaying count of unique hits from a list:
==========================================================
cat list.txt | sort | uniq -c | sort -rn | less
- Grep switches and colored output with less:
==========================================================
grep -ahioRE --color=always | less --RAW-CONTROL-CHARS
- For loop with bash:
==========================================================
for i in $(seq -q 01 31); do echo -n "$i"; cat $i-day.csv | egrep -aiRE 'C\:' | awk -F, '{print $12}' > $i-day.txt; done
- Cutting filenames from full paths:
==========================================================
sed 's/\\[^\\]\+$//' paths.txt
- Sorting output into columns:
==========================================================
paste - - -
xargs -n5 -d'\n'
- jq-fu:
==========================================================
jq -rC '.data[].file[] | select(.family == "malware")? | .category?,.type[].code?' list.json | less -R
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment