Changing Hostname
Edit below file and change the value to what you need.
/etc/hostname
Edit below file and replace the old hostname value against 127.0.1.1 to new name.
/etc/hosts
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
Banner
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
wget https://github.com/rg3/youtube-dl/raw/2012.02.27/youtube-dl
chmod +x youtube-dl
cp youtube-dl /usr/bin/youtube-dl
sudo apt-get install python-setuptools
wget http://pypi.python.org/packages/source/w/whitey/whitey-0.1.tar.gz
tar -zxvf whitey-0.1.tar.gz
wget https://dl.dropbox.com/u/33311875/__init__.py
cp __init__.py whitey-0.1/src/yt/__init__.py
cd whitey-0.1
sudo python setup.py 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
reboot
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}'
Wifi DHCP
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
update_config=1
network={
ssid="AndroidAP"
psk="yourkey"
proto=WPA RSN
key_mgmt=WPA-PSK
pairwise=CCMP TKIP
auth_alg=OPEN
}
reboot
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
./autogen.sh
./configure
make
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 - https://dev2day.de/pms/dev2day-pms.gpg.key | sudo apt-key add -
echo "deb https://dev2day.de/pms/ 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
http://:32400
mount windows share
sudo mount -t cifs -o username=xxxxxx@hotmail.com,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/site.com
sudo chown -R $USER:$USER /var/www/site.com
sudo chmod -R 755 /var/www/
sudo nano /etc/apache2/sites-available/site.com.conf
cd /etc/apache2/sites-available
sudo a2ensite site.com.conf
sudo htpasswd -c /etc/apache2/.htpasswd user
enabling https or ssl for your site
generate certs from https://www.sslforfree.com 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/mod_ssl.so
in your /etc/apache2/sites-enabled/sits.com.conf change port to 443 and below section,