Skip to content

Commands

SSL Certificates

Verify

openssl verify cert.pem
openssl verify -untrusted ca-bundle cert.pem

Certbot

WildCard Certificates

AMI2 Certificates Automation

Issue - No module named cryptography

Folders

  • Create Multiple Folders
mkdir -p {networking,compute,storage}
  • Create Multiple Files in Multiple Folders
touch {networking,compute,storage}/{main.tf,variables.tf,outputs.tf}

Services

Journalctl

journalctl -u kubelet.service
journalctl # All
journalctl -b # Last Boot
journalctl -b 1 # Before Last Boot
journalctl --since "2 days ago"
vi /etc/system.d/journald.conf # Config Files

Inodes

  • Get File Inode
ls -i /etc/passwd
  • Find File by Inode
find / -inum 55116 /etc/passwd
  • Get Inodes Available
df -i

Disk Space

du -h

du -s # To sum the total

du -s /

du -h --max-depth=1 # Show the disk usage by folder, and not the sub dirs because of Depth = 1

Tar

# List files without extract
tar -tvf etcd-v3.3.13-linux-amd64.tar.gz

# Extract only one file
tar -xvf etcd-v3.3.13-linux-amd64.tar.gz etcd-v3.3.13-linux-amd64/etcdctl

Filesystem

fsck (filesystem check)

  • To check errors from filesystem
  • Don't do in mounted filesystem
sudo fsck /dev/sdb1
sudo umount /dev/sdb1

dumpe2fs

  • Get info about filesystem
sudo dumpe2fs -h /dev/sdb1

tune2fs

  • To get info and tune filesystem
tune2fs -l /dev/xvda1
  • Set Volume Name
tune2fs -L Photos /dev/xvda1
  • Set mount counts will be filesystem checked
tune2fs -c 10 /dev/xvda1

fuser

  • Show which process is using the directory
# fuser /mount/Photos
/mount/Photos:              3157c

# ps aux | grep 3157
-- Will see the process, probably /bin/bash

# ps auxf  -> Show which command executed and the login session called

Kernel Modules

# To view who use the modules
lsmod

# To remove
sudo rmmod video

# To enable
sudo modprobe video

Libs

# Get Shared libs location
cat /etc/ld.so.conf

# To load new lib
ldconfig

# Change Library Path temporary
export LD_LIBRARY_PATH=/home/nick/lib

# Print shared libs from app
ldd /bin/ls

Hardware

  • List pci Devices
lspci
lspci -v
lspci -vvv

Syslog

  • Config Files
cd /etc/rsyslog.d/
  • Rotate Files Conf
vi /etc/logrotate.conf