tmux
New session
List sessions
Attach to session
Keys
All must be preceded by `ctrl+b` | Key | Function | | --- | -------- | | `d` | Detach | | `?` | Show Help |Select
[Source](https://www.rockyourcode.com/copy-and-paste-in-tmux/) Enter ‘copy mode’ by pressing `CTRL+b`, `[`. Use the arrow keys to go to the position from where you want to start copying. Press `CTRL+SPACE` to start copying. Use arrow keys to go to the end of text you want to copy. Press `ALT+w` or `CTRL+w` to copy into Tmux buffer. Press `CTRL+b`, `]` to paste in a possibly different Tmux pane/window.emacs
Emacs no window
GUI
Keys
`C-x` means `control` + `x` | Key | Function | | --- | -------- | | `C-x C-c` | Close |ddcutil
Detect monitors.
Show capabilities for the monitor.
Get and set values
https://www.ddcutil.com/commands/
Examples
Manual start Start on boot Show monitor models: Get more information on the *Feature*. Set a value for a *Feature*. Get the current value of a *Feature*.weechat
Key | Function |
---|---|
^p |
Previous buffer |
^n |
Next buffer |
Command | Function |
---|---|
/fset * |
Show current configuration |
/set |
Set the configuration |
/list |
List all channels |
/list -re #arch* |
Search channels |
Examples
Add a server Connect to a server Identify Set the nick Show the current options for the server Search for a channel Join a channel Show help Part a channelnnn
Keys
`^R` means `Control` + `r` | Key | Function | | --- | -------- | | `q` | Close context / Close | | `Q` | Close | | `o` | Open with | | `.` | Toggle hidden | | `b` `^/` | Bookmark key | | `1-4` | Context 1-4 | | `/` | Filter (Search) | | `f` `^F` | File details | | `e` | Edit file | | `n` | New | | `d` | Toggle detail mode | | `Space` `^J` | (Un)select | | `p` `^P` | Copy selection here | | `v` `^V` | Move selection here | | `x` `^X` | Delete | | `^R` | Rename | | `!` `^]` | Shell | | `=` | Launch app | | `]` | Cmd prompt. `Ctrl+d` to exit |Configure bookmarks
w3m
N
Number in some cases.()
Optional.shift+n
Press shift andn
at the same time to getN
esc n
Pressesc
thenn
^
isctrl
Keys
| Key | Function | | --- | -------- | | `H` | Hot keys | | `o` | Show options | | `B` | Close this buffer and go to previous buffer "Back" | | `s` | Select buffer | | `/` | Search forwards | | `?` | Search backwards | | `n` | Next "search" item | | `N` | Previous "search" item | | `g` | Go to top | | `G` | Got to bottom | | `T` | New tab with the same link but not the same buffer | | `ctrl+t` | Open link in a new tab | | `esc t` | List of all tabs | | `^q` | Close tab | | `{}` | Previous/Next tab | | `tab` | Next link | | `shift+tab` | Previous link | | `a` | Save link to file | | `shift+u` | Go to url | | `[]` | First/Last link | | `L` | List all links | | `esc l` | List of links to go. Better `shift+l`| | `u` | Peek the URL of a link | | `c` | Peek current URL | | `M` | Browse current document using external browser | | `esc m` | List of links to show, not to go | | `esc shift m` | Browse current document using external browser | | `(N) esc shift m` | Browse current document using N external browser | | `^h` | Show history | | `i` | Peek image URL | | `I` | View image | | `esc I` | Save image | | `esc b` | Show bookmarks | | `esc a` | Add current URL to bookmarks | | `space` | Page down | | `b` | Page up | | `,.` | Shift screen one column left/right | | `<>` | Scroll left and right | | `=` | Display information about current document | | `ctrl+c` | Show current line number | | `ctrl+r` | Reload page |Paths
| Paths | Usage | | ----- | ----- | | `~/.w3m/bookmark.html` | Bookmarks | | `~/.w3m/config` | Config | | `~/.w3m/pre_form` | Pre-fill forms |Links: - http://w3m.rocks/
surfraw
Browse something.
surfraw musicbrainz rolling stones
BROWSER=qutebrowser sr urban tldr
/usr/lib/surfraw/imdb E.T. -browser=w3m
List of elvi
Create new elvi
with mkelvis
from https://github.com/Hoboneer/surfraw-tools
Paths
| Path | Use | | ---- | --- | | `~/.config/surfraw/elvi/` | Per‐user elvi | | `~/.config/surfraw/conf` | Per‐user config file | | `~/.config/surfraw/bookmarks` | Per‐user bookmarks file | Table: surfraw pathsInstall `surfraw-tools`
LXD
lxc launch images:debian/10 -e elvi && lxc exec elvi -- /bin/bash
apt-get install -y python3-venv pipx
pipx install surfraw-tools --force
/root/.local/pipx/venvs/surfraw-tools/bin/mkelvis rarbg rarbgmirror.org 'rarbgmirror.org/torrents.php?search='
lxc file pull elvi/root/rarbg ~/.config/surfraw/elvi/
# Power Off container
BROWSER=qutebrowser sr rarbg Ubuntu
scrcpy
MOD
is left alt
or right super
.
Shortcut | Action |
---|---|
MOD+f |
Switch fullscreen mode |
MOD+r |
Rotate device screen |
MOD+o |
Turn device screen off (keep mirroring) |
MOD+s |
Click on APP_SWITCH |
MOD+h or Middle-click |
Click on HOME |
Right-click |
Back | Power on while screen is off |
MOD+p |
Click on POWER |
https://github.com/Genymobile/scrcpy#shortcuts
More
| Shortcut | Action | | ----- | ----- | | `MOD+←` (left) | Rotate display left | | `MOD+→` (right) | Rotate display right | | `MOD+g` | Resize window to 1:1 (pixel-perfect) | | `MOD+w` or Double-click | Resize window to remove black borders | | `MOD+b` or Right-click | Click on BACK | | `MOD+m` | Click on MENU (unlock screen) | | `MOD+↑` (up) | Click on VOLUME_UP | | `MOD+↓` (down) | Click on VOLUME_DOWN | | `MOD+Shift+o` | Turn device screen on | | `MOD+n` | Expand notification panel | | `MOD+Shift+n` | Collapse notification panel | | `MOD+c` | Copy to clipboard | | `MOD+x` | Cut to clipboard | | `MOD+v` | Synchronize clipboards and paste³ | | `MOD+Shift+v` | Inject computer clipboard text | | `MOD+i` | Enable/disable FPS counter (on stdout) | | `Ctrl+click-and-move` | Pinch-to-zoom |Anacron
Run anacron right now.
Options
- `s` Serialize execution of jobs - `f` Force execution of jobs, even before their time - `n` Run jobs with no delay, implies -s - `d` Don't fork to the background - `q` Suppress stderr messages, only applicable with -d - `u` Update the timestamps without actually running anything - `V` Print version information - `h` Print this message - `t` Use alternative anacrontab - `T` Test an anacrontab - `S` Select a different spool directoryRun the scripts directly.
rsync
rsync -aPHAXv -- /path/to/source user@server:/path/to/destination/
rsync -aPHAXv -- /path/to/file user@server:/path/to/file
rsync -e 'ssh -i ~/.ssh/id_rsa -l user' -- /path/to/file user@server:/path/to/destination/
Options
- `r` recurse into directories - `l` copy symlinks as symlinks - `p` preserve permissions - `t` preserve modification times - `g` preserve group - `o` preserve owner (super-user only) - `D` preserve device and special files - `a` archive mode; equals -rlptgoD (no -H,-A,-X) - `H` preserve hard links - `A` preserve ACLs (implies --perms) - `X` preserve extended attributes - `partial` keep partially transferred files - `progress` - `P` same as `--partial` `--progress` - `v` Verbose, useful to know which file changes - `e` Specify the remote shell command to use - `z` compress - `n` dry run - `S` sparse - `q` quiet - `u` skip files that are newer on the receiver - `U` preserve access (use) times - `delete` delete extraneous files from dest dirs. Sync (match) source and destination. Needs `r` or `d`. - `r` `recursive` recurse into directories - `d` `dirs` transfer directories without recursing - `remove-source-files` sender removes synchronized files (non-dir). Move files.tcpdump
tcpdump -ennq \( arp or icmp \)
tcpdump -ennq arp
tcpdump -ennqti enp2s0 tcp port 443 and src 10.0.0.1
tcpdump -ennqti enp2s0 dst port 443
tcpdump 'tcp[tcpflags] & (tcp-rst|tcp-ack) == (tcp-rst|tcp-ack)'
tcpdump net 192.168.1.0/24
tcpdump src 192.168.1.1 and dst 192.168.1.2 and dst port 80
tcpdump 'icmp[icmptype] != icmp-echo and icmp[icmptype] != icmp-echoreply' ## Not ping
tcpdump -ennqti eth0 tcp port not 22 ## Do not show SSH traffic
Options
- `e` Print the link-level header on each dump line. - `n` Don't convert addresses to names. - `q` Print less protocol information so output lines are shorter. - `t` Don't print a timestamp on each dump line. - `i` listen on interface - `I` Put the interface in "monitor mode" (WiFi) - `w` write to file - `A` print each packet in ASCII without the link-level header. Handy for capturing web pages. - `X` show the contents in Hex and Ascii - `XX` show the contents and headers in Hex and Ascii - `l` Make stdout line buffered. Useful if you want to see the data while capturing it. - `q` quiet - `t|tttt` human-readable timestamp output - `v|vvv` verbose - `c` get x number of packets and stop - `s` size of the capture in bytes. `s0` to capture everything. - `S` print absolute sequence numbers - `e` get the ethernet header - `dst|src|net` - `arp|icmp|tcp|udp|ip6` - `r` Read packets from fileTCP flags
RST SYN SYN and ACK SYN and RST URG ACK PSH FINpass
pass insert internet/gitlab
pass insert --multiline internet/gitlab
pass --clip internet/gitlab
pass show --clip internet/gitlab
pass generate internet/gitlab
pass edit internet/gitlab
pass otp append --echo internet/gitlab
pass rm internet/gitlab
TOTP from hex to B32
Initialize
Create a GPG key. Get the key ID. In this case is `AA21250888469FBC`. Initialize the repo with the key. Initialize a git repo. Manually decrypt a file.Backup
Backup
Export the keys (public and private). The key id is in `~/.password-store/.gpg-id`.gpg --output gpg_sec.gpg --armor --export-secret-key AA21250888469FBC
gpg --output gpg_sec.gpg --armor --export-secret-key `cat ~/.password-store/.gpg-id`
Restore
Import the keys. And trust the keys again to encrypt new passwordsMore
- `passmenu`: dmenu. - `gpg-agent`: Will keep the password for your key. - `pinentry`: Will pop a window to introduce your password.Re-encrypt every password with another key
where `"8271F30B83C51C44"` is the GPG ID of the new key. You have to input the password for the old key.Custom pinentry program
In Arch Linux edit `/usr/bin/pinentry`.#!/bin/sh
test -e /usr/lib/libgtk-x11-2.0.so.0 &&
exec /usr/bin/pinentry-curses "$@"
#exec /usr/bin/pinentry-gtk-2 "$@"
Links
-aria2c
Options
- `d` Directory to store downloaded files - `o` File name of the downloaded file - `i` Download from file - `c` Continue partially downloaded content - `j` Max concurrent downloadsnetcat
listen
- BSD
nc -lvn 9001
- Linux
nc -lvnp 9001
- Send file
nc -lvnp 80 < file
- Receive file
nc -lvnp 9001 > file
The file can contain any protocol information like http.
connect
- BSD
nc -vnp 10.0.0.1 9001
- linux
nc -v 10.0.0.1 9001
wget
wget --continue --mirror --no-host-directories --no-parent --recursive --user-agent=firefox --reject -R ".DS_Store,Thumbs.db,thumbcache.db,desktop.ini,_macosx,index.html*" --limit-rate=200k --random-wait --no-check-certificate https://www.example.com
wget -O file.zip http://www.example.org/random_name_file
wget -R ".DS_Store,Thumbs.db,thumbcache.db,desktop.ini,_macosx,index.html*" -nH -nc --no-cache --no-check-certificate -e robots=off -c --report-speed=bits --unlink https://www.example.com
Download a Full Website Using wget –mirror $ wget --mirror -p --convert-links -P ./LOCAL-DIR WEBSITE-URL
Options
- `--continue` - `--mirror` - `--no-host-directories` - `--no-parent` - `--recursive` - `--user-agent` - `--reject` - `--limit-rate` - `--random-wait` - `--no-check-certificate` - `--tries` - `-A` - `--spider`mpv
Options
- Right click over the seek buttons - show chaptersreadline
Shortcuts for bash, ftp and some others like telnet.
https://man.archlinux.org/man/readline.3
Keys
Run `bindkey` in `zsh` to see all of them. `^[` is `Meta` and `^` is `Control`. Dump the keycodes with `sudo dumpkeys -C /dev/console`. The *kill ring*. When something is erased, in most cases, is placed in a *kill ring*. To get what is inside the *kill ring* use `C-y`. *Kill* means move it to the *kill ring*. | Key | command | Explanation | | --- | :-----: | :---------- | | `ESC` | prefix-meta | Metafy the next character typed. `ESC f` is equivalent to `Meta-f`. | | `C-x C-e` or `C-x-e` | edit-command-line | Edit the current line in $EDITOR | | `C-_` or `C-x C-u` | undo | Incremental undo, separately remembered for each line. | | `C-o` | operate-and-get-next | Accept the current line for return to the calling application as if a newline had been entered, and fetch the next line relative to the current line from the history for editing. A numeric argument, if supplied, specifies the history entry to use instead of the current line. | | `C-k` | kill-line | Kill the text from cursor to the end of the line. | | `C-x Rubout` or `C-x C-k` | backward-kill-line | Kill backward to the beginning of the line. `Rubout` is `Backspace`. `Rubout` does not work for me in zsh. | | `C-u` | unix-line-discard | Kill backward from point to the beginning of the line. The killed text is saved on the kill-ring. | | `M-.` or `M-_` | yank-last-arg | Insert the last argument to the previous command (the last word of the previous history entry). With a numeric argument, behave exactly like yank-nth-arg | | `C-d` | end-of-file (EOF) and delete-char | The character indicating end-of-file as set, for example, by "stty". Also deletes the current character. | | `M-t` | transpose-words | Drag the word before point past the word after point, moving point over that word as well. If point is at the end of the line, this transposes the last two words on the line. | | `M-n-Backspace` | ? | Kill `n` words backwards. The words can be printed again with `C-y` | | `M-Rubout` or `C-w` | backward-kill-word | Kill the word behind point. Word boundaries are the same as those used by backward-word. | zsh only: | Key | command | Explanation | | --- | :-----: | :---------- | | `M-s` | spell-word | Fix word in cursor. Does not seem to work for arguments. | | `M-q` or `C-q` | push-line | Push the current buffer onto the buffer stack and clear the buffer. Next time the editor starts up, the buffer will be popped off the top of the buffer stack and loaded into the editing buffer. | | `M-g` or `C-g` | get-line | Pop the top line off the buffer stack and insert it at the cursor position. | | `M-l` | ls | execute `ls` | | `M-'` | quote-line | Quote the current line; that is, put a `'` character at the beginning and the end, and convert all `'` characters to `'\''`. | More zshsysrq
Keyboard | Shortcut | Description |
---|---|---|
Alt+SysRq+r |
Unraw | Take control of keyboard back from X. |
Alt+SysRq+e |
Terminate | Send SIGTERM to all processes, allowing them to terminate gracefully. |
Alt+SysRq+f |
OOM killer | Needs Unraw. |
Alt+SysRq+j |
Thaw | Needs Unraw. Unfreeze processes that are in uninterruptible sleep because of filesystem issue. |
Alt+SysRq+i |
Kill | Send SIGKILL to all processes, forcing them to terminate immediately. |
Alt+SysRq+s |
Sync | Flush data to disk. |
Alt+SysRq+u |
Unmount | Unmount and remount all filesystems read-only. |
Alt+SysRq+b |
Reboot | Reboot |
patch
-p
works
-pn
means Strip the smallest prefix containing n leading slashes from each file name found in the patch file.
If your patch contains
patch
will merge a/docs/arch/fstab.md
with b/docs/arch/fstab.md
.
If you specify -p1
it will merge docs/arch/fstab.md
with docs/arch/fstab.md
.
With -p2
arch/fstab.md
with arch/fstab.md
.
And -p3
fstab.md
with fstab.md
.
Create patch.
git clone --depth 1 <repo>
cd <repo>
vim path/to/file.md
git diff origin/master path/to/file.md > ~/file.patch
Creates a diff with this headers. You have to strip a/
and b/
with -p1
in patch.
Patch.
Mysql
- Show databases:
show databases;
- Change current database:
use database_name;
- Show tables:
show tables;
- Select rows:
select * from users;
- Select rows in vertical:
select * from users \G
mysql> help
\g go Send command to mysql server.
\G ego Send command to mysql server, display result vertically.
dd
ddrescue
lnav
There is a statically linked binary.
Open all logs from today.
Recursively open all files in a folder.
Shortcuts
TAB
- FiltersG
- Go to bottomg
- Go to tope/E
- Move to the next/previous errorw/W
- Move to the next/previous warning/
- SearchTAB
- When in search, autocompleten/N
- Search forward/backward>
- When in search, move horizontally to view the search hitENTER
- Focus on the breadcrumb barTAB
- or right-arrow) to move through the breadcrum bar.:
- Open command prompt:goto
- Go to a line, timestamp, ...f/F
- Move to the next/previous file.