Markdown testing

2020-02-11

Those are some really old notes i use as markdown content for testing, don't judge me based on this.

tr

"translate" Tr -d ":" Removes the : in "192.168.1.1:"

For loop

For ip in `seq 1 254`, do <commands> Done Loop in one line: For ip in $(cat iplist.txt); do nmap -sS -p 80 -T4 $ip & done

If

If ["$1" == ""] then Echo "first argument is empty, this is an error message" else [script you want to execute, like the loop above] Fi

&

  • Start in background
  • Find: find/search for stuff
    • find / -name id_rsa 2> /dev/null
      • 2> means only show matches (or rather redirect standard-error to /dev/null)
    • find / -perm -u=s -type f 2>/dev/null
      • Search for files (-type f) with SUID set

Id

  • print real and effective user and group IDs

cut

extract sections from lines by cutting strings into columns based on delimiter cut -d ' ' -f1,3,6 access.log use space as delimiter, return fields 1,3 and 6.

sort

-n numeric sort -r reverse (descending) order

uniq

filter and display unique lines (needs a sorted list, as it only compares ajacent lines) -c show the count for each value

wc

word-count -l count lines

logs

Logs are usually in /var/log/

Purpose Source Process CentOS Location Ubuntu Location
Authentication sudo, sshd, etc. secure auth.log
Web Server apache httpd/ apache2/
System Logs systemd,kernel, rsyslogd messages syslog
Package management Logs dpkg dpkg.log yum.log