From 6e5044eb4ba064a497699208068d2553ac172f8c Mon Sep 17 00:00:00 2001
From: johannst Collect arguments and prefix them with another option.awk(1)
+awk [opt] program [input]
@@ -1404,6 +1405,24 @@ echo -e 'a1 a2\nb1 b2\nc1 c2\nd1 d2' | paste - -
# a1 a2 b1 b2
# c1 c2 d1 d2
xargs(1)
+
+xargs [opts] [cmd [init-args]]
+ -l [<num>] maximal number of lines per cmd invocation
+ if <num> it not provided, num=1 is assumed
+ -I <str> replace <str> in the [init-args] with the arg;
+ this implies -l, and hence processes one arg at a time
+
Example
+# Using -l to process one arg at a time.
+eval strace -f (find /dev -name 'std*' | xargs -l echo -P | xargs) ls
+
+# Using -I to place the arg at the specified location.
+eval strace -f (find /dev -name 'std*' | xargs -I {} echo -P {}) ls
+
+# Both commands achieve the same thing and result in something like:
+# eval strace -f -P /dev/stdin -P /dev/stdout -P /dev/stderr ls
+
Tools
fido-vertical-mode
in case vertical mode is preferred.
key fn description
+---------------------------------------------
+ M-! shell-command run shell command synchronously
+ M-& async-shell-command run shell command asynchronously
+ M-| shell-command-on-region run shell command on region;
+ prefix with C-u to replace region with
+ output of the command
+
gpg
-o|--output Specify output file
@@ -2653,7 +2681,7 @@ taskset -ac 0-2,4 CMD [ARGS]
# Pin all tasks of running PID onto cores 0,2,4.
taskset -ac 0-5:2 -p PID
-Utility script to extract cpu lists grouped by the last-level-cache.
import subprocess
@@ -2760,13 +2788,18 @@ renice -n 5 -p PID
-o <file> ... log output into <file>
-l <filter> . show who calls into lib matched by <filter>
-C .......... demangle
+ -e <filter> . show calls symbols matched by <filter>
-x <filter> . which symbol table entry points to trace
(can be of form sym_pattern@lib_pattern)
+ -n <num> number of spaces to indent nested calls
-List which program/libs call into libstdc++
:
ltrace -l '*libstdc++*' -C -o ltrace.log ./main
+List calls to specific symbols:
+ltrace -e malloc -e free ./main
+
Trace symbols from dlopen(3)
ed libraries.
# Assume libfoo.so would be dynamically loaded via dlopen.
ltrace -x '@libfoo.so'
@@ -3280,7 +3313,7 @@ thread name <name>
or stepping.
off: (default) Resume only threads of current process (inferior).
- shell <shell_cmd>
Run the shell_cmd and print the output, can also contain a pipeline.
@@ -3525,7 +3558,7 @@ New value = 3
set (s=0x7fffffffe594, v=3) at test.c:5
5 }
-# Run shell commands.
(gdb) shell zcat /proc/config.gz | grep CONFIG_KVM=
@@ -3595,7 +3628,7 @@ $MOOSE=moose
host:port
tty
-# Start gdbserver.
gdbserver localhost:1234 /bin/ls
@@ -5860,7 +5893,7 @@ link time -lgcov
.
generated for a single file for example such as
gcov <SRC FILE | OBJ FILE>
-Example
+Example
#include <cstdio>
void tell_me(int desc) {
@@ -6766,7 +6799,7 @@ cpupower -c all frequency-info -g
# Change frequency governor to POWERSAVE (eg).
cpupower -c all frequency-set -g powersave
-Example
+Example
Watch cpu frequency.
watch -n1 "cpupower -c all frequency-info -f -m | xargs -n2 -d'\n'"
@@ -6789,12 +6822,14 @@ lpadmin -x PRINTER
Printer & Printing options
# List printer options.
# CHECK printer-make-and-model
-lpoptions -p Brother_MFC_L2750DW_series
+lpoptions -p PRINTER
# List printing options.
-lpoptions -p Brother_MFC_L2750DW_series -l
+lpoptions -p PRINTER -l
+# Set an options, eg duplex mode.
+lpoptions -p PRINTER -o 'Duplex=DuplexNoTumble
# Set the default printer (stored in ~/.cups/lpoptions).
-lpoptions -d Brother_MFC_L2750DW_series
+lpoptions -d PRINTER
Inspect installed printer.
# List default printer.
@@ -6879,7 +6914,7 @@ locally and -R
means that requests are issued remotely.
drop into shell)
-f
run ssh
command in the background
-Example
+Example
# Forward requests on localhost:8080 to moose:1234 and keep ssh in forground
# but dont drop into a shell.
ssh -N -L 8080:1234 moose
--
cgit v1.2.3