Table of Contents

tail -f /directory/filename

This command is used to tail a file like a debug window and follow the output as it scrolls.

multitail -cS apache /directory/filename directory/filename2

This command is used to tail multiple files like a debug window and follow the output as it scrolls.

sort our HTOP view for memory allocation

du -hc --max-depth=1

Using this command will give you the total Disk Usage for the folder you designate. Useful when trying to track down where precious is being utilized, and tearing down the tree to locate the culprit(s).

To skip network shares: 

du -hcx --max-depth=1

To sort:

du -hc --max-depth=1 | sort -h

echo '' > /directory/filename

This command is used to clear all the text within a file. Useful when you are debugging a log file while starting and stopping an application.

netstat -tulpn

Common netstat command. L = listening, P = Programs, 

rsync -rv <src> <dest> --progress (Contributed by Brad Ellis)

This command will copy from one source folder to another, and give you not only the the throughput, but the % of progress of transfer over a network.

swapoff -a && swapon -a

Used to clear the memory locked up in swap when the physical memory is not 100% utilized. Also a good way to speed up a server acting sluggish and commit memory that should have been cleared.

dpkg-reconfigure gdm

Used to reconfigure the default Display Manager. Primarily used if changing between Gnome, KDE, or straight up Xwindows Display managers. 

tar -zcvf {.tgz-file} {files}

Compress files into tar gz format (replace z with j to compress to bunzip2)

/usr/sbin/sshd -p1234 -d

Used to debug SSH connections and negotiations. After the disconnect happens, the spawned process shuts down. 

SSH root access from a specific IP

Match Address 192.168.1.100
        PermitRootLogin yes

SystemD

Example service file

[Unit]
Description=Hybris Server
After=syslog.target
After=network.target

[Service]
User=hybris
Group=hybris
WorkingDirectory=/home/hybris/hybris/bin/platform
ExecStart=/home/hybris/hybris/bin/platform/hybrisserver.sh start
ExecStop=/home/hybris/hybris/bin/platform/hybrisserver.sh stop
PIDFile=/home/hybris/hybris/bin/platform/tomcat/bin/hybrisPlatform.pid

[Install]
WantedBy=multi-user.target

Linux Benchmark Commands

Disk speed

$ dd if=/dev/zero of=test bs=64k count=16k conv=fdatasync

Network Speed

wget -O /dev/null http://cachefly.cachefly.net/100mb.test

Benchmark operating system

sysbench --test=cpu --cpu-max-prime=20000 run
sysbench --test=fileio --file-total-size=10G prepare
sysbench --test=fileio --file-total-size=10G --file-test-mode=rndrw --init-rng=on --max-time=300 --max-requests=0 run
sysbench --test=fileio --file-total-size=10G cleanup