Homepage

Space Index

0-9 ... 0 A ... 1 B ... 1 C ... 1 D ... 0 E ... 0
F ... 1 G ... 0 H ... 1 I ... 1 J ... 0 K ... 0
L ... 2 M ... 2 N ... 0 O ... 0 P ... 0 Q ... 0
R ... 1 S ... 3 T ... 0 U ... 0 V ... 1 W ... 0
X ... 0 Y ... 0 Z ... 0 !@#$ ... 0    

0-9

A

Page: A List of Useful Commands
photo_2019-02-13_06-28-37.jpg

B

Page: Bash tricks & commands
set -e to the top level of script file: exit script if any command fails (non-zero value) exec "$@" to the end of script file will redirect input variables, see more here http://wiki.bash-hackers.org/commands/builtin/exec cd {directory} change directory

C

Page: Change Timezone
sudo dpkg-reconfigure tzdata

D

E

F

Page: Find Files Older Than x Days and Show Last Modified Date
# -mtime +2 == older than 2 days # -exec executes the following statement on the found files # stat -c with following literal shows filename with the last modified date find * -mtime +2 -exec stat -c "%n %y" {} \; # to zip; find * -mtime +2 -exec tar czvf

G

H

Home page: Homepage

I

Page: Importing an Untrusted Certificate into JDK
# Copy the certificate into the directory Java_home\Jre\Lib\Security # Change your directory to Java_home\Jre\Lib\Security> # Import the certificate to a trust store. # Here's the import command: keytool -import -alias ca -file somecert.cer -keystore cace

J

K

L

Page: Letsencrypt (Free SSL certificate) for tomcat
# get letsencrypt bot from git git clone https://github.com/letsencrypt/letsencrypt # execute manual retrieve ./letsencrypt-auto --agree-dev-preview --server https://acme-v01.api.letsencrypt.org/directory certonly -a manual # enter email and domain name(s
Page: List & Sort sizes of current directory (recursively)
du -hs * | sort -h

M

Page: Monit configuration to monitor unix systems
# install first sudo apt-get install monit # setup configuration file sudo vim /etc/monit/monitrc set daemon 120 # check services at 2-minute intervals set logfile /var/log/monit.log set idfile /var/lib/monit/id set statefile /var/lib/monit/state # set ma
Page: Monitor disk space and send mail
Install mailx for mail sending sudo apt-get install heirloom-mailx Create disk space monitoring script (alerts for disk usages over 80%) #!/bin/sh df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output; do echo $output

N

O

P

Q

R

Page: Remove Files With 0 Byte File Size
# Use the Find command to find files by size and print file names to standard output. find . -type f -size 0b -print # Substitute -print with -delete to delete the files rather than print them on screen. find . -type f -size 0b -delete

S

Page: Setting bash as default shell
# append below to the last line case $- in *i*) # Interactive session. Try switching to bash. if [ -z "$BASH" ]; then # do nothing if running under bash already bash=$(command -v bash) if [ -x "$bash" ]; then export SHELL="$bash" exec "$bash" fi fi esac
Page: SFTP user restricted to home directory
# Create user sudo adduser sercan # Change owner as root sudo chown root:sercan /home/sercan # Give almost all rights for root to that folder sudo chmod 750 /home/sercan/ # Then create a public folder to give it user completely sudo mkdir /home/sercan/pub
Page: SSH login - .ssh permissions
# change directory to home cd mkdir .ssh chmod 700 .ssh cd .ssh touch authorized_keys chmod 600 authorized_keys

T

U

V

Page: Vi / Vim
# to delete all lines :%d #ENTER # copy a line and paste, make sure that cursor on top of the line to be copied yyp # insert at the end of line A #SHIFT+a

W

X

Y

Z

!@#$