disable power button on linux

echo 'HandlePowerKey=ignore' >> /etc/systemd/logind.conf

*you will need to restart the machine for apply changes


adjust sound card volume with amixer

Show all mixer Controls

amixer -c 0 scontrols

Show all mixer Contents

amixer -c 0 scontents

Get only values of Master content

amixer -c 0 sget Master

Set value to Master

amixer -c 0 set Master 30

Mute Internal Mic and Mic

amixer -c 0 set 'Internal Mic' mute
amixer -c 0 set 'Mic' mute

Unmute Internal Mic and Mic

amixer -c 0 set 'Internal Mic' unmute
amixer -c 0 set 'Mic' unmute

Set value to Headphone

amixer -c 0 set 'Headphone' 100

Set value to Speaker and mute it

amixer -c 0 set 'Speaker' 80 mute

history of server load linux

1 – Install the package sysstat

apt-get install sysstat

2 – Enable collection of statistics

sed -i 's/^ENABLED="false"/ENABLED="true"/' /etc/default/sysstat

3 – Change collect interval to 5 minutes (optional step)

vi /etc/cron.d/sysstat

*/5 * * * * root command -v debian-sa1 > /dev/null && debian-sa1 1 1

Most common parameters. See all in manual page

Command Description
-q Report queue length and load averages
-u Report CPU utilization
-r Report memory utilization

To view load report of current day

sar -q

To view load report between time in current day

sar -q -s 13:00:01 -e 17:00:01

To view report of the 7th day of the current month:

sar -q -f /var/log/sysstat/sa07

sqlite3 with php

1 – Install sqlite3 and sqlite module for php

apt-get install sqlite3 php5-sqlite

2 – Create a database file with sqlite command or use sqlitestudio

sqlite3 test.db
sqlite> CREATE TABLE tbl1(name VARCHAR(9), age INT(2));
sqlite> INSERT INTO tbl1 VALUES('nickollas',33);
sqlite> INSERT INTO tbl1 VALUES('carvalho', 20);

3 – Create a php file to access data in database

$db = new SQLite3('test.db');

$rs = $db->query( 'SELECT rowid,name,age FROM tbl1' );

while ( $row = $rs->fetchArray() ) echo $row['rowid'], $row['name'], $row['age'], "\n";

– Some sqlite commands:

sqlite> .tables show all tables
sqlite> .schema show table structure
sqlite> .quit exit of sqlite

clone debian linux

1 – Install debian – example with minimum packages for a end user desktop

apt-get install xfce4 net-tools gpm vim ssh telnet xterm gvfs-backends chromium xserver-xorg-video-intel xserver-xorg-video-vesa gdebi wpasupplicant xpdf resolvconf cifs-utils libreoffice-calc cups 

2 – Download last version of linux-live to /tmp directory

wget https://github.com/Tomas-M/linux-live/archive/master.zip -P /tmp

3 – Uncompress linux-live file in /tmp directory

unzip /tmp/master.zip -d /tmp

4 – Run build in descompress dir


*Install missing packages for the compilation

**(Optional Step) Replace bootlogo.png file with size 640×480

cp /path/to/your/bootlogo.png /tmp/linux-data-*/linux/boot/bootlogo.png

5 – Generate /tmp/linux-x86_64.zip file after build finish


6 – Format USB/HDD

yes | mkfs -t ext4 /dev/pathToUSBOrHDDDeviceBlock

7 – Decompress /tmp/linux-x86_64.zip into USB/HDD Disk

mount /dev/pathToUSBOrHDDDeviceBlock /mnt
unzip /tmp/linux-x86_64.zip -d /mnt

8 – Make USB/HDD bootable

cd /mnt/linux/boot; ./bootinst.sh

9 – sync and umount mount point

cd; sync; umount /mnt

Linux Live Page: https://www.linux-live.org