Common Ubuntu

Introduction: Explains setting up Kali in virtual box

Filesystem Structure

  • /root – superusers directory
  • /boot – Kernel image
  • /etc – System config files
  • /home – Users directories
  • /mnt – General purpose mount points
  • /proc – View of internal kernel data
  • /sys – Kernel’s view of hardware
  • /dev – Special devices files
  • /bin – Binaries directory
  • /sbin – Binaries directory
  • /lib – Libraries directory
  • /usr – /sbin, /bin, /lib – User files

Common Commands

$ pwd // check working directory

$ whoami // Who are you?

$ cd // same as windows

// cd .. goes back one level, cd ../.. goes back two levels, cd ../../.. goes back three levels.

$ ls // list files and directories

$ locate aircrack-ng

$ whereis aircrack-ng

$ which aircrack-ng

// find <directory> <option> <expression>

$ find / -type f -name aircrack-ng

$ ps aux // show processes

$ ps aux | grep aircrack-ng

$ touch filename // create file called filename

$ cat > filename // type anything you want to save in the file, CTRL ^ C to exit

$ cat filename // show content

$ cat » filename // type anything to add lines at end of file.

$ mkdir // create directory

$ rmdir // remove directory

$ cp // copy file

$ mv // move file

$ rm // remove file

// I prefer shred

$ shred -u filename

// Install Snort

$ sudo apt-get install snort

$ cat /etc/snort/snort.conf // show file content

$ head /etc/snort/snort.conf // show top content of file

$ tail /etc/snort/snort.conf // shop bottom content of file

$ nl /etc/snort/snort.conf // number lines

$ more /etc/snort/snort.conf

$ less /etc/snort/snort.conf

Common Account Management

$ useradd // adds a user

// $ adduser -D // is better option

$ groupadd // adds a group

$ userdel // deleted a user

$ groupdel // deleted a group

$ usermod // modifies a user

$ chgrp // modifies user / group link

/etc/(file) // file=passwd,group,shadow

$ passwd (user) // change password of user // check shadow file

$ nano /etc/login.def // change UID, PASS_DAYS, UMASK?

$ chage -d day -m mindays -M maxdays -W warndays -I inacive -E expiration (user) // change age

$ su – (username) // change user

$ sudo visudo // changes /etc/sudoers

Ref: https://www.cloudsigma.com/configuring-the-linux-sudoers-file/

Common Networking

$ ifconfig // get networking info

// $ ip addr show // this will do the same as ifconfig but its new

$ iwconfig // get wireless info

$ ifconfig eth0 192.168.111.222 // change IP address

// spoof macaddress

$ ifconfig eth0 down

$ ifconfig eth0 hw ether 00:11:22:33:44:55

$ ifconfig eth0 up

$ dhcpclient eth0

// Change DNS Server

$ nano /etc/resolv.conf // can also use cat

$ cat >> /etc/resolv.conf // can also use echo

$ echo “nameserver 8.8.8.8” > /etc/resolv.conf // > replaces all

$ echo “nameserver 8.8.8.8” >> /etc/resolv.conf // >> Puts at end

// Another important file is /etc/hosts

$ cat /etc/hosts

$ wall // send message to all logged in users

$ write (user) // send message to a user

App Management

$ apt-get install <package name> // install it

$ apt-cache search <package name> // find it

$ apt-get remove <package name> // remove it

$ apt-get purge <package name> // purge it

$ apt autoremove <package name>

$ apt-get update // update resp

$ apt-get upgrade // upgrade pkges

Handy Text Commands

$ ls -at | awk ‘{print $7,$6,$9}’ // show only columns 6,7 and 9

$ wc -l largefile.txt // show how many lines

$ split -l 500 largefile.txt splitfile.txt // split file 500 lines

Handy Commands

$ sort / uniq

$ truncate

Shortcuts

$ ln file file-hardlink // create a hardlink

$ ln -s file file-shortcut // create a softlink

$ alias (name)=’command’ // Temp command

example: alias msf=’msfdb start;msfconsole;msfdb stop’

$ nano ~/.bashrc // and add alias to file for perm

Stupid Shit

$ echo “I like big butts” | tee ‘I can not’ && 2> lie

// This prints “I like big butts” to the terminal and the file “‘I can not’, the tee command pipes the text into the file and still outputs it in terminal. Then I’m asking to print any errors to the file lie. In the terminal you will see

I like bit butts
’I can not’ lie

Published
Categorised as linux