Basic Linux (Debian/Mac) Commands

 Time information

# Command: timedatectl

root@debian:/home/pi# timedatectl
      Local time: Sun 2017-06-25 16:37:23 CEST
  Universal time: Sun 2017-06-25 14:37:23 UTC
        RTC time: Sun 2017-06-25 14:37:21
       Time zone: Europe/Vienna (CEST, +0200)
     NTP enabled: no
NTP synchronized: no
 RTC in local TZ: no
      DST active: yes
 Last DST change: DST began at
                  Sun 2017-03-26 01:59:59 CET
                  Sun 2017-03-26 03:00:00 CEST
 Next DST change: DST ends (the clock jumps one hour backwards) at
                  Sun 2017-10-29 02:59:59 CEST
                  Sun 2017-10-29 02:00:00 CET

Show space on mounted harddrives (human readable)

# Command df -h

root@debian:/home/pi# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       189G   26G  154G  15% /
udev             10M     0   10M   0% /dev

Show information attached HD

# Command ls -l /sys/block/sd* | sed 's/.*\(sd.*\) -.*\(ata.*\)\/h.*/\2 => \1/'

root@debian:/home/pi# ls -l /sys/block/sd* | sed 's/.*\(sd.*\) -.*\(ata.*\)\/h.*/\2 => \1/'
ata3 => sda

Show information about harddrive

# Command: hdparm -I /dev/sda

# maybe you have to install hdparm with (apt-get install hdparm)

root@debian:/home/pi# hdparm -I /dev/sda

/dev/sda:

ATA device, with non-removable media
	Model Number:       VBOX HARDDISK                           
	Serial Number:      VB7749bd7c-37a37909 
	Firmware Revision:  1.0     
Standards:
	Used: ATA/ATAPI-6 published, ANSI INCITS 361-2002 
	Supported: 6 5 4 
Configuration:
	Logical		max	current
	cylinders	16383	16383
	heads		16	16
	sectors/track	63	63
	--
	CHS current addressable sectors:   16514064
	LBA    user addressable sectors:  268435455
	LBA48  user addressable sectors:  419430400
	Logical/Physical Sector size:           512 bytes
	device size with M = 1024*1024:      204800 MBytes
	device size with M = 1000*1000:      214748 MBytes (214 GB)
	cache/buffer size  = 256 KBytes (type=DualPortCache)
Capabilities:
	LBA, IORDY(cannot be disabled)
	Queue depth: 32
	Standby timer values: spec'd by Vendor, no device specific minimum
	R/W multiple sector transfer: Max = 128	Current = 128
	DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 *udma6 
	     Cycle time: min=120ns recommended=120ns
	PIO: pio0 pio1 pio2 pio3 pio4 
	     Cycle time: no flow control=120ns  IORDY flow control=120ns
Commands/features:
	Enabled	Supported:
	   *	Power Management feature set
	   *	Write cache
	   *	Look-ahead
	   *	48-bit Address feature set
	   *	Mandatory FLUSH_CACHE
	   *	FLUSH_CACHE_EXT
	   *	Gen2 signaling speed (3.0Gb/s)
	   *	Native Command Queueing (NCQ)
Checksum: correct

Unpack .tgz files

#unpack in the same folder

tar zxvf file.tgz

#unpack in a different location
tar zxvf file.tgz -C /path/to/desination

Unpack .zip files

apt-get install unzip

unzip file.zip

Find files

"find" "path" "type" "Name"

find / -name "EXAMPLE"

Important OSX Commands for me 🙂

find TimeLapse/ -name "*.JPG" -exec mv '{}' JPG/ \;

Argon One Pi 4 Fan Control scirpt and commands

curl https://download.argon40.com/argon1.sh | bash
#alternativ:
curl https://www.schaupper.at/Upload/scripts/argon1.sh | bash

#change the config for the fan 
#default 55c - 10%
#default 60c - 55%
#default 65c - 100%
argonone-config

#uninstall
argonone-uninstall

## Function of Keys is:
## SHUTDOWN - Long-press (>3s)
## Restart - double-click 
## Force Shutdown - Long-press (>5s)

Mac turn off packet signing for SMB 2 and SMB3

sudo -s
echo "[default]" >> /etc/nsmb.conf
echo "signing_required=no" >> /etc/nsmb.conf
exit

Copy SSH Key to remote machine

ssh-copy-id <remote-user>@<remote-ipadress>

Remove SSH Key

ssh-keygen -R <hostname/ip>

--------
if not the error is following 
ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ERROR: @    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
ERROR: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
ERROR: IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
ERROR: Someone could be eavesdropping on you right now (man-in-the-middle attack)!
ERROR: It is also possible that a host key has just been changed.
ERROR: The fingerprint for the ECDSA key sent by the remote host is

Start Screensaver via Terminal

open -b com.apple.ScreenSaver.Engine

File creation:

mkfile -n 100g temp_100GB_file
dd if=/dev/zero of=data.bin count=400 bs=1024

Zip Folder

zip -r zipfile.zip folder_to_compress

unzip folder

unzip zipfile.zip

Spotlight (Check if search is for path enabled)

sudo mdutil -s /path/to/volume

Spotlight (disable for this path or volume)

sudo mdutil -i off /path/to/volume

VNC Service – enable / disable via SSH

help
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart --help

stop remote management
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -deactivate -stop 

start
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate

allow access for all
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -allowAccessFor -allUsers -privs -all

Schedule shutdown time (MacOSX Ventura)

sudo pmset repeat shutdown MTWRFSU 12:00:00

Schedule wakeup time

sudo pmset repeat wakeorpoweron MTWRFSU 09:00:00

Set wakeup and shutdown time

sudo pmset repeat wakeorpoweron MTWRFSU 09:00:00 sleep MTWRFSU 12:00:00

check which schedule is active

sudo pmset -g sched

delete all schedule events

sudo pmset repeat cancel

Exiftool modify Date change to original

exiftool -R '-FileModifyDate<DateTimeOriginal' PATH

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Time limit is exhausted. Please reload the CAPTCHA.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.