Linux
Processes
Listing processes
ps
- user processesps aux
- all processestop
- real time list of processeshtop
- top but colored
Killing processes
kill {id}
- kill process by process id (PID)
Signals
SIGTERM
- kill process with clean up tasks (kinda soft)SIGKILL
- more like force killSIGSTOP
- pausing / suspending process
Start on Boot
systemtcl
- system control can be used to start and
stop services. Options:
- Start
- Stop
- Enable - in boot
- Disable - in boot
Background vs Foreground
Processes can run in two stages: background and foreground. Common commands are run in foreground, such as ipconfig or grep. But running webserver, vpn or sqlserver, it is better to do on background because then you don’t need to keep terminal open and can do other things too.
using background
- put
&
after command to run it at background or - press
ctrl
+z
.
foregrounding background process
Foreground bg commans with fg {PID}
.
Automation
cron
With rcon jobs we can automate things like running commands, doing backups and launching programs by certain time.
crontabs
command syntax:
0 8 */2 * 1 echo "Happy Monday, bää bää ;)"
this would
echo “Happy Monday, bää bää ;)” every first day of week (but only
every second month) at 8 am. asterisk *
means that the
field does not matter e.g. all values for that field for example
every month of the year would be *
.
link for online rcon generator.
Package Management Systems
APT
APT is packet manager for debian systems introduced by Ubuntu 16. It is meant to be simpler and better for end users.
apt
apt install {package-name}
- installing…apt remove {package-name}
- removing…apt update
- download package information from configured reposotories.apt upgrade
- install avaible upgrades from information updated by apt update.add-apt-repository
- Adding additional reposotories.
apt-get
Older and Lower-level tool that does pretty much all the same things than apt. Apt is said to be more simpler for end user than apt-get.
DNF
DNF or Dandifier YOU is successor to YUM (Yellow-Dog Updater Modified). DNF is default package manager of Fedora and RedHat.
Logs
Logs are located at /var/log
folder. Logs are very
important for defensive cyber security.
Access Logs
What people do?
Error Logs
What errors are generated?
Firewall
UFW
UFW or Uncomplicated FireWall is default firewall in Ubuntu 8+ and many other distributions. Note that it is not always enabled by default.
IP Tables
TODO: