List SSH connections

I was “lazy” to reconnect and get the custom remote SSH port so got if from


#!/bin/bash
ss -tnpa |grep ESTAB |grep ssh

Lint all PHP files in CLI


#!/bin/bash
find . -name '*.php' | xargs -i php -l {} | grep -v 'No syntax errors'

view raw

php7-lint.sh

hosted with ❤ by GitHub

Works on Linux. For OSX see https://unix.stackexchange.com/a/285170/39470

 

Open new Chrome window from command line via SSH

I switch between computers and sometimes when I’m switching I need to push an URL/prepare a window so found a solution with the following command:

mike@remotehost $ export DISPLAY=:0; nohup chromium --new-window https://github.com/deployphp/deployer#installation

UPDATE 2017-06-18


DISPLAY=:0 nohup chromium URL_TO_OPEN_ON_REMOTE_BROWSER > /dev/null &

Control VLC playback from command line

Working on two computers requires some control from command line (CLI). Glad that VLC implemented command line control.

I just found a solution at http://stackoverflow.com/a/9047708/289404 and made some command scripts in my home directory bin (~/bin).

Scripts that I use can be seen at https://gist.github.com/mikaelz/71055bbf5fc1aaf34ae7

Control VLC via CLI

logrotate error: stat of /var/log/xferlog failed

In Arch Linux the logrotate service was failing:

user@host# systemctl start logrotate.service 
Job for logrotate.service failed. See "systemctl status logrotate.service" and "journalctl -xe" for details.

So I ran it by hand to debug:

user@host# logrotate /etc/logrotate.conf

And the following error appeared:

logrotate error: stat of /var/log/xferlog failed

I fired up a grep for xferlog in the /etc directory:

user@host:/etc# grep -r xferlog *
logrotate.d/proftpd:/var/log/xferlog

Solution was commenting the xferlog rule in logrotate.d/proftpd. I don’t need the transfer log.