Linux Administration

Boot

Boot

Grub

Setting the default runlevel in Ubuntu 16.04

 

Mapping between runlevels and systemd targets

Runlevel / Target

0: poweroff.target
1: rescue.target
2, 3, 4: multi-user.target
5: graphical.target
6: reboot.target

To change runlevel:

sudo systemctl isolate multi-user.target


To set the default runlevel:

sudo systemctl enable multi-user.target
sudo systemctl set-default multi-user.target

 

Adding Operating Systems to Linux grub bootloader

Open a new terminal
Execute the following commands:

sudo os-prober		#this will search for the OSs
sudo update-grub	#this will update your grub bootloader

 

Bibliography

https://askubuntu.com/questions/788323/change-runlevel-on-16-04
http://www.hypexr.org/linux_scp_help.php

File management

Scp file copy examples

Copy the file "foobar.txt" from a remote host to the local host
$ scp your_username@remotehost.edu:foobar.txt /some/local/directory


Copy the file "foobar.txt" from the local host to a remote host
$ scp foobar.txt your_username@remotehost.edu:/some/remote/directory

Services

Enabling ssh on Ubuntu

 

sudo apt-get install openssh-server
sudo service ssh status

 

Removing the CD / DVD install as a source for apt-get

 

sudo nano /etc/apt/sources.list

#comment cdrom line

sudo apt-get update

Scripting

Scripting

Colours on terminal

<?php
/*
Black 0;30
Blue 0;34
Green 0;32
Cyan 0;36
Red 0;31
Purple 0;35
Brown 0;33
Light Gray 0;37 
Dark Gray 1;30
Light Blue 1;34
Light Green 1;32
Light Cyan 1;36
Light Red 1;31
Light Purple 1;35
Yellow 1;33
White 1;37
*/
<?php
  echo "\033[31m some colored text \033[0m some white text \n";
  echo "\033[32m some colored text \033[0m some white text \n";​

http://blog.lenss.nl/2012/05/adding-colors-to-php-cli-script-output/