Changing Hostname

Edit below file and change the value to what you need.
Edit below file and replace the old hostname value against to new name.

Fixing "VCHI Initialization failed" error

Add user www-data to video group. Below is the command,
sudo usermod -G video www-data
And then restart web server"

Measuring Raspberry Pi CPU Temperature

/opt/vc/bin/vcgencmd measure_temp

Removing a package using apt-get

sudo apt-get --purge remove


sudo nano /etc/ssh/sshd_config
uncomment Banner and make the line as below,
Banner /etc/ssh/banner
sudo nano /etc/ssh/banner
enter banner text here.
restart shh

Find Largest 20 files

sudo du -ah / | sort -n -r | head -n 20

Youtube command line program intslall

chmod +x youtube-dl
cp youtube-dl /usr/bin/youtube-dl
sudo apt-get install python-setuptools
tar -zxvf whitey-0.1.tar.gz
cp whitey-0.1/src/yt/
cd whitey-0.1
sudo python install
sudo youtube-dl -U

Repeat the last command several times until you see youtube-dl is up-to-date (2012.12.11)

Check Wireless Signal Command Line

cat /proc/net/wireless
To continuously watch signal strenth,
watch -n 1 cat /proc/net/wireless
iwconfig wlan0

What application is using the port

netstat -tlnp | grep 8080

resizing sd card to fill up the size using the pi itself

do df -h to list your partions note down /dev/mmcblk0p1.
do fdisk -uc /dev/mmcblk0
p to print table note down the available partions and start number of second partion
d to delete all partions except 1st.
n to create new partion. p for primary partion. give 2 for creating second partion. use the start number saved as first sector. Simply enter on last sector.
w to write the changes
resize2fs -p /dev/mmcblk0p2

Tar and utar dir

tar -zcvf prog-1-jan-2005.tar.gz /home/jerry/prog
tar -zxvf prog-1-jan-2005.tar.gz

Forceful Unmount

sudo umount -l /mnt/usb-wd/

Check Apache bandwidth in MB

cat /var/log/apache2/access.log | awk '{SUM+=$10}END{print SUM/1024/1024}'
cat * | awk '{SUM+=$10}END{print SUM/1024/1024}'


sudo nano /etc/network/interfaces

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

proto=WPA RSN
pairwise=CCMP TKIP


Package commands

Show packages that are installed
dpkg --get-selections
Find locations for things in a package
dpkg -L transmission

auto mount hdd

ls -l /dev/disk/by-uuid/
get the UUID of HDD
add below line to fstab
UUID=0AC4D607C4D5F543 /media/NASDRIVE ntfs-3g rw,defaults 0 0

Compiling minidlna

sudo apt-get install libexif-dev libsysfs-dev libid3tag0-dev libFLAC-dev libvorbis-dev libsqlite3-dev libavformat-dev autoconf automake autopoint libjpeg62-dev libjpeg62 gettext
cd minidla-1.1.3
sudo make install
sudo minidlnad -R -f /home/pi/minidlna-1.1.2/minidlna.conf

Change Transmission Daemon user

sudo usermod -a -G debian-transmission pi
sudo nano /etc/transmission-daemon/settings.json
"umask": 2

Kodi TV Setup

install raspbian
sudo apt-get install kodi
sudo apt-get install kodi-pvr-demo
Launch Kodi->System->TV-General->Select Enabled You will now see a pop-up saying that you have no PVR Client enabled. Select OK
Scroll down and select PVR IPTV Simple Client->Enable->Configure->In General selec M3U Play List URL
place m3u8 playlist on the local drive .strm file
reboot kodi

plex Media Server

sudo apt-get update && sudo apt-get dist-upgrade
sudo apt-get install apt-transport-https -y --force-yes
wget -O - | sudo apt-key add -
echo "deb jessie main" | sudo tee /etc/apt/sources.list.d/pms.list
sudo apt-get update
sudo apt-get install -t jessie plexmediaserver -y
sudo reboot

mount windows share

sudo mount -t cifs -o,password=xxxxxxxxxx //xxxxxxxxxxx/share /mnt/share

excluder ip range from apache access log

grep -v "`cat /usr/local/etc/goaccess_exclude_list`" /var/log/apache2/access.log > test1.log

virtual host with directory access and password protection

mkdir -p /var/www/
sudo chown -R $USER:$USER /var/www/
sudo chmod -R 755 /var/www/
sudo nano /etc/apache2/sites-available/

cd /etc/apache2/sites-available
sudo a2ensite
sudo htpasswd -c /etc/apache2/.htpasswd user

enabling https or ssl for your site

generate certs from and download your ca_bundle.crt, certificate.crt and private.key
in /etc/apache2/ports.conf add Listen 443
in /etc/apache2/apache2.conf add LoadModule ssl_module /usr/lib/apache2/modules/
in your /etc/apache2/sites-enabled/ change port to 443 and below section,