6 July 2015

Linux – Databases

To use databases in Linux it is easiest to use mysql which can be installed using:

sudo apt-get install mysql

To configure the setup go to /etc/mysql/ and open my.cnf. As default only local access are allowed to the databases. This is specified as bind-adress = in the my.cnf file.

To launch mysql simply type sudo mysql. Some basic commands you can use:


6 July 2015

Linux – Network tools

Netstat is used to check which ports are open on the local system. There is also a tool called nmap which scans a remote system for open ports. For example

nmap hostaddress -p0-65535

checks all the possible ports on the specified address.

Tcpdump is a tool that sniffs data from the network traffic. To record data from a specific host type:

tcpdump dst host <hostaddress>

You can also filter out specific protocols like http:

tcpdump tcp port http.

6 July 2015

Linux – Scheduling & Startup

To be able to schedule activities to run in intervals is a important part in the administration of a Linux system. The system that handles scheduling is called cron and makes it possible to set the interval from years to minutes. The scheduling is configured in so called crontab files which are placed in the /etc directory. An example on how to run a script every 5:th minute:

First make the script executeable using chmod +x scriptname.
Launch crontab as a local user using crontab -e.
To make the script run every 5:th minut input:
*/5 * * * * ~/path/to/scriptfile


6 July 2015

Linux – Basic commands

When logged in into a Linux system you get access to a shell where applications and commands can be executed. When an application is called by its name the system searches for it in the current folder and the directories specified in “PATH”. To list all the environment variables and their values type env l less.

The shell provides us with some tricks to make working with it a little easier:


3 July 2015

Basic Linux

Users and access levels

The user with the highest level of access is called root and is able to control every process and access every file on the system. Other users can also be given root privileges but this should be done with care.

To create a new user with the name testuser, create a home directory and assign a password:

useradd -m testuser
passwd testuser <insert password>

You can change to the newly created user by using, ask the system who is the current user and return using:

su testuser

To delete the user and the home directory type: