cat data_access.log 2>&1 | grep key
== cat data_access.log |& grep key
cat data_access.log | grep key
== cat data_access.log > >(grep key)
https://beyondgrep.com/feature-comparison/
grep XXXX data_access.log | sort | uniq -c | sort -h
cut -d " " -f 2 data_access.log | grep XXXX | sort | uniq -c | sort -h | sed 's/\s\+/ /g'
grep -o "start.*end" data_access.log | sort | uniq
https://www.thegeekstuff.com/2013/06/cut-command-examples https://github.com/dbohdan/structured-text-tools https://www.datascienceatthecommandline.com
find src -type f -name "*.php" -print0 | xargs -0 -n1 -P8 php -l
printf %s\\n {0..99} | xargs -n 1 -P 8 script-to-run.sh input/ output/
cat commands.sh | xargs -P4 -I "{}" sh -c "{}"
Note: See also parallel
.
https://stackoverflow.com/questions/28357997/running-programs-in-parallel-using-xargs
https://mike42.me/blog/how-to-use-parallel-to-speed-up-your-work
#Trace the Execution of an Executable
strace ls
#Trace a Specific System Calls in an Executable Using Option -e
strace -e trace=open,read ls /home
#Save the Trace Execution to a File Using Option -o
strace -o output.txt ls
#Execute Strace on a Running Linux Process Using Option -p
strace -p 1725 -o firefox_trace.txt
#Print Timestamp for Each Trace Output Line Using Option -t
strace -t -e open ls /home
#Print Relative Time for System Calls Using Option -r
strace -r ls
#Generate Statistics Report of System Calls Using Option -c
strace -c ls /home
#Resolve every fd into its name, and every socket fd into its address line
strace -yy wget https://cdn0.bodas.net/usuarios/fotos/7/1/9/0/sfxb_376425.jpg
http://www.thegeekstuff.com/2011/11/strace-examples/
#Shared library dependencies
ldd /bin/ls
objdump -p /bin/ls | grep NEEDED # or grep DLL for Windows libs
#Disassemble
objdump -d /bin/ls or nm /bin/ls or readelf -a /bin/ls
#Debug (man ld.so)
LD_DEBUG=libs /bin/ls # or ltrace
#Print the strings of printable characters in files
strings /bin/ls
https://www.cs.swarthmore.edu/~newhall/unixhelp/compilecycle.html
php-fpm[6048]: segfault at 10 ip 00007f46db77a8fb sp 00007fffa155e2d0 error 4 in xcache.so[7f46db763000+23000]
# 00007f46db77a8fb - 7f46db763000 = 178FB
addr2line -e /usr/lib64/20131226/xcache.so 178FB
#out /root/source/xcache-3.2.0/mod_cacher/xc_cacher.c:778
https://ablagoev.github.io/linux/adventures/commands/2017/02/19/adventures-in-usr-bin.html#addr2line
pkexec emacs /etc/sudoers
http://manpages.ubuntu.com/manpages/precise/en/man1/pkexec.1.html
flock -n /tmp/path.to.lockfile -c command with args
http://www.elevatedcode.com/2013/05/07/flock-for-cron-jobs.html http://www.computerhope.com/unix/utrap.htm Other in GO croncape jobber
Xephyr -ac -screen 1280x1024 -br -reset -terminate 2> /dev/null :3 &
DISPLAY=:3.0 gnome-wm &
DISPLAY=:3.0 ssh -X jennie@desktop xterm
http://jeffskinnerbox.me/posts/2014/Apr/29/howto-using-xephyr-to-create-a-new-display-in-a-window/
sudo apt-get -y install x11vnc
x11vnc -display :0
apt-get install devscripts
apt-get source XXXXX
cd XXXXXX
sudo apt-get build-dep XXXXXX
dpkg-buildpackage -b -uc
Simple: use Effing package management (fpm)
fpm -s dir -t deb \
--deb-no-default-config-files \
--config-files "etc/galicasterpro/conf.ini" \
-d python \
-d python-pip \
-d "package > 1.0" \
--after-install $OLD_PWD"/postinst" \
--before-install $OLD_PWD"/preinst" \
--url "http://rubenrua.es" \
--vendor "My Company" \
-m "rubenrua <[email protected]>" \
--description "My descriptn" \
-n name -v $VERSION_NUMBER .
cat ~/.ssh/config
Host *
ServerAliveInterval 120
ServerAliveCountMax 3
Since I'm not allowed to edit Jauco's answer, I'll give the full answer that worked for me (Russell's page relies on unguaranteed behaviour that, if you close fd 1 for stdout, the next creat call will open fd 1.
So, run a simple endless script like this:
import time while True: print 'test' time.sleep(1)
Save it to test.py, run with
python test.py
#Get the pid:
ps auxw | grep test.py
#Now, attach gdb:
gdb -p (pid)
#and do the fd magic:
(gdb) call creat("/tmp/stdout", 0600)
$1 = 3
(gdb) call dup2(3, 1)
$2 = 1
Now you can tail /tmp/stdout and see the output that used to go to stdout.
$ python3 -m http.server.
https://gist.github.com/willurd/5720255
socat or ssh -L MY_PORT:HOST_IN_LOCAL_NET:LOCAL_PORT [email protected]
Example:
socat -v TCP-LISTEN:80,fork,reuseaddr TCP:172.0.0.1:8080
ssh -L 2222:192.168.1.38:22 -L 8080:192.168.1.38:80 [email protected]
ssh -p 2222 localhost && wget localhost:8080
~C (to open the ssh command prompt) and type a command (e.g.) “-L 80:localhost:8000”
See also: https://ngrok.com, https://github.com/agrinman/wormhole, https://tmate.io/ and socks
[Unit]
Description=Laravel queues
[Service]
User=www-user
Group=www-user
Type=simple
Restart=on-failure
RestartSec=30
Nice=10
WorkingDirectory=/www/laravel/
ExecStart=/usr/bin/php artisan queue:work --queue=default --sleep=30 --timeout=1800 --tries=1 --memory=256
StandardOutput=null
TimeoutStartSec=30
[Install]
RequiredBy=multi-user.target
- https://github.com/0xAX/linux-insides
- http://wiki.openvz.org/Package_managers
- http://www.vicente-navarro.com/blog/2009/06/13/reenvio-dinamico-de-puertos-montar-un-servidor-socks-con-ssh/
- autojump - https://olivierlacan.com/posts/cd-is-wasting-your-time/ (See https://github.com/clvv/fasd)
- https://tldr.sh (alternative to man pages)