Skip to content

🔐 Karlo Luiten

Think Evil, DO Good

🔐 Karlo Luiten

Think Evil, DO Good

  • Home
  • About me
    • About me
    • LinkedIn
    • Guide to Karlo
  • SELinux cheat sheet
  • CISSP Reference
  • Contact
    • Home
    • Linux
    • CLI and tools
CLI and tools Linux

Friendly (ionice/nice) rsync on remote server

karlo Mar 17, 2023 0 Comments

Add --rsync-path="ionice -c 3 nice rsync" to your rsync command (on sending side)

CLI and tools

jq unix timestamp to datetime

karlo Jan 11, 2023 0 Comments

| todateiso8601

CLI and tools

Bash script template

karlo Oct 28, 2022 0 Comments

#!/usr/bin/env bash set -o errexit set -o nounset set -o pipefail if [[ "${TRACE-0}" == "1" ]]; then set -o xtrace fi if [[ "${1-}" =~ ^-*h(elp)?$ ]]; then echo…

CLI and tools

Bash remove spaces from file names

karlo Jun 4, 2020 0 Comments

find . -depth -name '* *' \ | while IFS= read -r f ; do mv -i "$f" "$(dirname "$f")/$(basename "$f"|tr ' ' _)" ; done

CLI and tools

Upgrade dumb shell to interactive shell (tty)

karlo Jan 29, 2020 0 Comments

python -c 'import pty; pty.spawn("/bin/bash")' yay python

CLI and tools

Bash sort IPs naturally

karlo Nov 12, 2019 0 Comments

sort -t . -k 3,3n -k 4,4n IPs

CLI and tools

bash add IP in PWD to variable for easy reference

karlo Nov 11, 2019 0 Comments

Add to .bashrc: export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ;} ip=\$( echo \$PWD | grep -oE '{1,3}\.{1,3}\.{1,3}\.{1,3}' ) " Now if you browse to/in a directory which has an ipv4 ip, the IP will…

CLI and tools

Easy AutoRecon summary (bash)

karlo Nov 11, 2019 0 Comments

echo "===SUMMARY===";grep . */report/notes.txt| while read line; do IP=$( echo -ne $line|cut -d'/' -f1| tr -d '\n' ); ] && echo; echo -n $IP ; echo -n $line | cut…

CLI and tools

Proxychains on fedora / centos7

karlo Nov 5, 2019 0 Comments

Clone the repo: https://github.com/rofl0r/proxychains-ng ./configure && make && sudo make install cp src/proxychains.conf /etc/proxychains.conf && vi /etc/proxychains.conf echo "alias p='/usr/local/bin/proxychains4'" >> ~/.bashrc && . .bashrc p ssh xx@ip

CLI and tools

Bash while loop input (stdin reading from while-input) fix

karlo Oct 26, 2019 0 Comments

while read line <&3; do echo "==== $line ===="; yes y | sqlmap -u http://$line/ --crawl=1; read -p press\ enter; done 3< webservers.ip Using input 3 to read your list,…

CLI and tools

Bash array operations and examples

karlo Jun 11, 2019 0 Comments

Split to array: while IFS=';' read -ra ADDR; do for i in "${ADDR}"; do # process "$i" done done <<< "$IN" Define: distro=("redhat" "debian" "gentoo") Element: ${ArrayName} Length: echo "${#distro}"…

CLI and tools

Bash color variables

karlo Apr 11, 2019 0 Comments

# Reset Color_Off='\033[0m' # Text Reset # Regular Colors Black='\033[0;30m' # Black Red='\033[0;31m' # Red Green='\033[0;32m' # Green Yellow='\033[0;33m' # Yellow Blue='\033[0;34m' # Blue Purple='\033[0;35m' # Purple Cyan='\033[0;36m' # Cyan…

CLI and tools

Bash add UTF8 (UTF-8) BOM to file

karlo Jan 31, 2019 0 Comments

sed -i '1s/^\(\xef\xbb\xbf\)\?/\xef\xbb\xbf/' foo-*

CLI and tools

Tail: prepend file name to tailing output (bash)

karlo Sep 4, 2018 0 Comments

cd /opt/arcsight/connectors/; tail -f *_con1_rsyslog_paloalto_2500*/current/logs/agent.out.wrapper.log | awk '/^==> / {a=substr($0, 5, length-8); next} {print a":"$0}'

CLI and tools

Personal (manual) template for internal hosts

karlo Jul 20, 2018 0 Comments

This might help someone else, too. These are the things I do for an internal VM (on my hypervisor at home). This document will/might evolve over time. Default OS is…

CLI and tools

Bash suppress all output of script (echo off – style)

karlo Jan 5, 2018 0 Comments

exec 1>/dev/null 2>/dev/null at the top of your script

CLI and tools

Bash compound commands (()){{}}{}[[]]

karlo Nov 1, 2016 0 Comments

Compound Commands A compound command is one of the following. In most cases a list in a command's description may be separated from the rest of the command by one…

CLI and tools

Bash inline number increase (( ++i ))

karlo Nov 1, 2016 0 Comments

i=0 (( ++i )) echo $i Will give 1

CLI and tools

Run programs without execute rights on file

karlo Aug 30, 2016 0 Comments

/bin/bash script.sh /lib64/ld-linux-x86-64.so.2 binary.bin /usr/bin/php file.php

CLI and tools

Bash keyboard shortcuts

karlo Aug 10, 2016 0 Comments

Found here: http://ss64.com/bash/syntax-keyboard.html Bash Keyboard Shortcuts Moving the cursor: Ctrl + a Go to the beginning of the line (Home) Ctrl + e Go to the End of the line…

CLI and tools

Self extracting zipped encrypted linux package

karlo Mar 7, 2016 0 Comments

#!/bin/bash T=`mktemp -d /tmp/$$XXXX`;trap "rm -rf $T" EXIT SIGINT; tail -n+3 $0|openssl enc -d -aes-256-cbc|tar zx -C $T;C=`pwd`; cd $T;./_;cd $C;exit 0 build: #!/bin/bash find . -name "*~" -delete TMP=`mktemp…

CLI and tools

Bash percentage calculate snippet

karlo Sep 5, 2014 0 Comments

MEMLINE=$( tac $MGRBASE/$REL_LOGLOC/server.status.log | egrep -m1 '\*\*.*Memory Status:' ) USED=$( echo "$MEMLINE" | egrep -o '+ MB Used' | sed 's/\..*//;s/,//' ) MAX=$( echo "$MEMLINE" | egrep -o '+ MB…

CLI and tools

Bash file age check snippet

karlo Sep 5, 2014 0 Comments

if ]; then #Check age if ]; then echo "Backup takes too long" else echo "Doing backup" fi fi

CLI and tools

[FIX] Clean up old puppet reports and reclaim mysql space (ibdata)

karlo Nov 13, 2013 0 Comments

MySQL for puppet dashboard gets BIG. You can make this smaller by deleting old records. Source for this article is here. To get the size in GB of the dashboard:…

CLI and tools

Bash get full path of file

karlo Oct 14, 2013 0 Comments

Get the full path of a file via: $ readlink -f ./file Tip: make an alias: alias fullpath='readlink -f'

CLI and tools

Dell Linux Dock display switcher script

karlo Oct 10, 2013 0 Comments

This might be helpful for someone. A quick script I made for changing output modes on my Dell laptop. There are different configurations. laptop: laptop screen only vga: vga output…

CLI and tools

Script: Puppet module create template

karlo Sep 2, 2013 0 Comments

Adjust to your needs ;) #!/bin/bash # Create puppet module layout if ];then echo "$0 modulename" exit 1 fi if ]; then echo "Dir already exists" exit 1 fi #…

CLI and tools

A better todo.txt repeated task inserter

karlo Jan 2, 2013 0 Comments

I have a scheduled.txt file like this: # Scheduled tasks for todo.txt # Format: # # a dow, Mon,Tue,Wed,... # b moy, Jan,Feb,Mar,... # d dom, 01..31 # D m/d/y…

CLI and tools

Useful ‘command not found’ output for bash

karlo Apr 10, 2012 0 Comments

Add this to your .bashrc: clippy() { echo "I see you're trying to use the terminal …"; echo " v "; echo " ╭─╮"; echo " ⌾ ⌾"; echo "…

CLI and tools

Clear BASH history

karlo Dec 19, 2011 0 Comments

Clear the BASH history easily via: $ >~/.bash_history Remember to log out after doing this.

Posts

  • Add new dmraid to debian11 March 22, 2023
  • Nextcloud / php / apache no error for Internal Server Error March 19, 2023
  • Proxmox LXC container disk shrink March 19, 2023
  • Friendly (ionice/nice) rsync on remote server March 17, 2023
  • LVM commands not found March 17, 2023
  • T-Mobile Thuis werkende SMTP 2023 (Fix Relay access denied) March 14, 2023
  • Upgrade to debian11 from 10 March 10, 2023
  • Simple SSH backup of routeros / mikrotik March 8, 2023
  • Proxmox VLANs ‘on a stick’ March 7, 2023
  • T-Mobile thuis (NL) Routeros/Mikrotik-configuratie (met VLANs) March 3, 2023
  • Mikrotik routeros various findings February 26, 2023
  • jq unix timestamp to datetime January 11, 2023
  • Bash script template October 28, 2022
  • Hash file in windows October 6, 2022
  • Fix: acosh defined in both go and assembly August 4, 2022
  • Indent HTML using tidy June 20, 2022
  • Github what repos have you contributed to (graphql) May 16, 2022
  • Debian VM as GW routing through VPN (tun) with nftables April 7, 2022
  • Guacamole broken (Creation of WebSocket tunnel to guacd failed) January 24, 2022
  • mount LVM2_member September 4, 2021

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Posts

Uncategorized

Add new dmraid to debian11

Uncategorized

Nextcloud / php / apache no error for Internal Server Error

Proxmox

Proxmox LXC container disk shrink

CLI and tools Linux

Friendly (ionice/nice) rsync on remote server

🔐 Karlo Luiten

Think Evil, DO Good

Copyright © All rights reserved | Blogus by Themeansar.