linux intro

/bin contains basic programs

/sbin contains system programs

/etc config files

/tmp temp files deleted on

/usr/bin application files

/usr/share/ application support and data files

man -k '^passwd$'

using -k flag, we can set regular expressions

Creating sub directories

mkdir -p test/{recon,exploit,report}

creates test directory that contains three subdirectories

finding files

  1. which

    1. finds a full path

  2. locate

    1. finds files based on locate.db which the system updates via a cronjob

    2. to manually update the database, type "sudo updatedb"

  3. find

    1. The best!

      1. e.g.) sudo find / -name sbd*

SSH service:

To start it, type:

"sudo systemctl start ssh"

To confirm that the service is running type:

"sudo ss -antlp | grep sshd"


ss command is the newer netstat command(shows TCP sockets connections)

To automatically run the ssh after booting, type:

sudo systemctl enable ssh


To see all the services that are running on kali, type:

systemctl list-unit-files


To completely remove application and its related files, type:

sudo apt remove --purge APP_NAME


dpkg -i ./nano_3.2-3~~~.deb

install packages offline; it may not download everything

AWK Tutorial: 25 Practical Examples of AWK Command in Linux (linuxhandbook.com)

Removing white-space only lines:

awk 'NF' sample.txt


Extracting fields

awk 'NF{ print $1, $3}' FS=, OFS=, file

FS= sets a delimiter ","

OFS = sets a output delimiter of ","

GREP

Ony shows matched portion (not the whole sentence)

grep -o $USER /etc/passwd

($USER = current user)

-i =case unmatching

Negative lookahead-like function

grep -v findthis sample_text.txt

(shows only the lines do not contain "findthis")

Using regex

grep -e a -e e work/*

matches "a" or "e"

grep -E '(green|blue)' text

matches green or blue from the text --> better

Last updated