-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmisc.cheat
54 lines (35 loc) · 1.45 KB
/
misc.cheat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
% progress
# Monitor progress of a command
<cmd> & progress -mp $!
% weather
# Show weather info for current location
curl -s "wttr.in" | grep -v "New feature" | grep -v Follow
# Show weather info for a specific location
curl -s "wttr.in/<location>" | grep -v "New feature" | grep -v Follow
% system
# Get name of currently connected monitors
xrandr --query | grep -o '^[^ ]* connected' | cut -d' ' -f1
; https://stackoverflow.com/a/692407
# Pipe stdout and stderr using tee
(<CMD>) > >(tee -a stdout.log) 2> >(tee -a stderr.log >&2)
# Pipe stdout and stderr using tee with timestamps
(<CMD>) > >(while read -r l ; do echo -e "[$(date)]\t$l" ; done | tee -a stdout.log) 2> >(while read -r l ; do echo -e "[$(date)]\t$l" ; done | tee -a stderr.log >&2)
# Get processes attached to a file
lsof <FILE>
% readline
# List all possible readline bindings
bind -l
# List currently set readline bindings
bind -p
% udev
# Get udev info (product, vendor and serial) for device
udevadm info -a -n <device> | grep -E 'ATTRS\{(serial|idVendor|idProduct)\}'
# Reload and trigger the rules
sudo udevadm control --reload-rules && sudo udevadm trigger
% socat
# Create a pair of virtual serial ports
socat -d -d pty,raw,echo=0 pty,raw,echo=0
# Share virtual serial port on TCP (server)
socat -d -d pty,link=${HOME}/dev/virtualcom0,raw,echo=0 tcp-listen:<port>
# Share virtual serial port on TCP (client)
socat -d -d pty,link=${HOME}/dev/virtualcom0,raw,echo=0 tcp:<host_ip>:<port>