cheats/linux.md

1.7 KiB

Linux Cheats

General (tested in Debian)

Set script as startup

If, for some reason, apache isn't startup:

sudo update-rc.d apache2 defaults

Check a package version/info

dpkg -l matrix-synapse


SSH

Copy files to/from an SSH connection: (SSH format: user@host:/path )

scp <source> <destination>

Recursivly give directories execute privileges: (-type f for files instead)

find /path/to/base/dir -type d -exec chmod +c {} +


GROUPS

Create groups

groupadd <groupName>

Add user to a group

usermod -a -G <group> <user>

Open ports with iptables

Don't do that. Use UFW instead.

Allow a connection with UFW:

sudo ufw allow <port/service>

Enable ufw service:

sudo ufw enable


Partitions

The following command is not permanent:

mount /dev/sda11 /opt

To mount partition permanently, instert the following into /etc/fstab:

UUID=03ec5dd3-45c0-4f95-a363-61ff321a09ff /opt ext4 defaults 0 2


Arduino

Find what 'channel'(?) the Arduino is plugged in at: dmesg | grep tty

Do following commands to "talk" with an Arduino (with a set script):

python
import serial ser = serial.Serial('/dev/ttyACM0',115200)
ser.readline()
ser.write("PP\n")

To set the time of current clock-program, continue with:

from datetime import datetime ser.write("T"+datetime.now().strftime("%y%m%d0%w%H%M%S")+"\n") ser.readline()