My scratchpad for useful Linux terminal commands, as I hack away at the Raspberry Pi.
sudo apt-get update
sudo apt-get dist-upgrade
uname -a
These tips via eLinux - R-Pi NAS
Make new partition, if brand new drive
fdisk /dev/sdb
Format to ext3
mkfs.ext3 -L "Label" /dev/sdb1
Change drive Label
e2label /dev/sdc1 "Label"
dmesg | tail
sudo nano /etc/fstab
sudo mount -a
Mount by device path
/dev/sdxx /home/shares/public/disk1 auto gid=pi,uid=pi,noatime 0 0 # from elinux
/dev/sda1 /home/shares/public/disk1 ntfs-3g noatime 0 0 # Current
Better yet, auto-mount by Label
LABEL=Media /home/shares/public/media ntfs-3g noatime 0 0
LABEL=Media /home/shares/public/media2 ntfs-3g noatime 0 0
LABEL=Media /home/shares/public/media2 ntfs-3g noatime 0 0
LABEL=Seedbox /home/shares/public/seedbox ntfs-3g noatime 0 0
# Proper fstab entry for exfat, so it can be writable
LABEL=VT16 /home/shares/public/vt16 exfat defaults,auto,umask=000,users,rw 0 0
df -h
ls -l /dev/disk/by-id
sudo fdisk -l
sudo blkid
sudo mount /dev/sda1 /home/shares/public/Media
sudo umount /home/shares/public/disk2
# fuser -m /dev/sdc1
/dev/sdc1: 538
# ps auxw|grep 538
donncha 538 0.4 2.7 219212 56792 ? SLl Feb11 11:25 rhythmbox
blockdev --getbsz /dev/sda1
sudo nano /etc/samba/smb.conf
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.old
sudo mkdir /home/shares
sudo mkdir /home/shares/public
sudo chown -R root:users /home/shares/public
sudo chmod -R ug=rwx,o=rx /home/shares/public
sudo /etc/init.d/samba restart
[usb]
comment = USB Share
path = /mnt/disk1
read only = No
create mask = 0777
directory mask = 0777
guest only = Yes
guest ok = Yes
[public]
comment = Public Storage
path = /home/shares/public
valid users = @users
force group = users
create mask = 0660
directory mask = 0771
read only = no
tail -f /var/log/samba/log.smbd
vncserver :1 -geometry 1280x800 -depth 16 -pixelformat rgb565
- Start VNC Automatically
- Stop VNC Server
vncserver -kill :1
Easiest method:
sudo halt
These work too:
sudo shutdown -h now
sudo shutdown -r now
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
top
Add the command to your ~/.bash_aliases
alias home='cd /home/dave/public_html' // Make an alias
alias // Lists all aliases
ssh pi@raspberrypi
sudo apt-get update
sudo apt-get install ntfs-3g
mount -t ntfs-3g /dev/sda1 /media/USBHDD
sudo apt-get install exfat-fuse
sudo mount -t exfat-fuse /dev/sda1 /media/drive1
LABEL=VT16 /home/shares/public/vt16 exfat defaults,auto,umask=000,users,rw 0 0
sudo rm /etc/ssh/ssh_host_* && sudo dpkg-reconfigure openssh-server
sudo /etc/init.d/transmission-daemon start
sudo /etc/init.d/transmission-daemon stop
Updating settings:
sudo nano /etc/transmission-daemon/settings.json
sudo service transmission-daemon reload
Transmission blocklist:
http://list.iblocklist.com/?list=bt_level1
- How to Install XBMC and Transmission on Raspberry Pi
- Python + Transmission-daemon = Download Easily Your Favorite TV Show
Make sure you have a source repository by editing /etc/apt/sources.list.
$ cat /etc/apt/sources.list
# Default repository
deb http://archive.raspbian.org/raspbian wheezy main contrib non-free rpi
# Source repository to add
deb-src http://archive.raspbian.org/raspbian wheezy main contrib non-free rpi
Sync the apt database.
$ sudo apt-get update
Create a working directory and move into it. The unrar-nonfree command will be built in this directory.
$ mkdir ~/unrar-nonfree && cd ~/unrar-nonfree
Install the dependencies required by unrar-nonfree.
$ sudo apt-get build-dep unrar-nonfree
Download the unrar-nonfree sources and build the .deb package.
$ sudo apt-get source -b unrar-nonfree
Install the generated .deb package. Its name varies depending on the version of unrar-nonfree.
$ sudo dpkg -i unrar*.deb
You can remove the working directory you created in 4.
$ cd && rm -r ~/unrar-nonfree
Once installed, you can use either unrar
or unrar-nonfree
(unrar is a simlink to unrar-nonfree).
Warning: unrar-nonfree
and unrar-free
options are different. For instance, to extract an archive:
$ # with unrar-free
$ unrar -x my_archive.part01.rar
$ # with unrar-nonfree
$ unrar e my_archive.part01.rar
Please man unrar-nonfree
for more details.
unrar e source.rar ../../destination
nohup [command] &
Handy if you run into WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
message on fresh reformat of the Pi
ssh-keyscan raspberrypi >> ~/.ssh/known_hosts
sudo nano /etc/network/interfaces
Ensure that the section about wlan0 (typically found at the end of the file) reads as follows:
allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
Scan for local wireless:
sudo iwlist wlan0 scan | grep ESSID
In:
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
Add:
network={
ssid="YourSSID"
psk="password"
key_mgmt=WPA-PSK
}
Seems to work best without specifying TKIP/WPA stuff.
Go to /etc/ifplugd/action.d/ and rename the ifupdown file to ifupdown.original
Then do: cp /etc/wpa_supplicant/ifupdown.sh ./ifupdown
Finally: sudo reboot
http://raspberrypi.stackexchange.com/a/5341/5454
hdmi_group=1
hdmi_mode=4
Video blackouts? Try:
hdmi_force_hotplug=1
config_hdmi_boost=4
Need to mount the flash as writable before editing /flash/config.txt
mount /flash -o remount,rw
For particularly ornery Raspberry Pi's that seem to corrupt SD card storage... Also, it's supposedly faster and is great when you have small capacity SD cards on hand.
http://kodi.wiki/view/HOW-TO:Install_XBMC_on_Raspberry_Pi_with_USB_drive
To copy a file from B to A while logged into B:
scp /path/to/file username@a:/path/to/destination
To copy a file from B to A while logged into A:
scp username@b:/path/to/file /path/to/destination
https://ubuntuforums.org/showthread.php?t=2372031 https://askubuntu.com/questions/1031890/recovery-of-old-ecryptfs-data-does-not-work