nginx is typically located at /usr/bin/nginx
nginx configuration is at /etc/nginx
nginx
nginx -s stop
nginx -s reload
nginx -t
As of NOOBS 2.9.0 the raspberry pi does not offer SMB as a choice in the Type
menu at File Manager
> Go
> Connect to Server
.
Try instead entering directly into the address bar smb://wherever/
.
This may or may not be needed first:
sudo apt-get install samba-common smbclient samba-common-bin smbclient cifs-utils
ln -s file1 link1
e.g.
ln -s /etc/nginx/sites-available/mysite /etc/nginx/sites-enabled/mysite
sudo reboot now
sudo shutdown now
hostname -I
df
- Shows the amount of disk space used and available on Linux file systems.
du
- Display the amount of disk space used by the specified files and for each subdirectory.
du -cha --max-depth=1 / | grep -E "M|G"
- Find large folders.
du -cha --max-depth=1 /lib | grep -E "M|G"
- Find large folders in /lib.
sudo du -ahx / | sort -rh | head -n 20
- Find largest directories/files.
watch -n1 "lscpu | grep 'MHz' | awk '{print $1}'"
watch -n1 "cat /proc/cpuinfo | grep 'MHz' | awk '{print $1}'"
top
for basic info, htop
for much more detail
In top
, there is a line beginning with %Cpu(s)
. The meaning of the numbers is as follows:
us - Time spent in user space
sy - Time spent in kernel space
ni - Time spent running niced user processes (User defined priority)
id - Time spent in idle operations
wa - Time spent on waiting on IO peripherals (eg. disk)
hi - Time spent handling hardware interrupt routines. (Whenever a peripheral unit want attention form the CPU, it literally pulls a line, to signal the CPU to service it)
si - Time spent handling software interrupt routines. (a piece of code, calls an interrupt routine...)
st - Time spent on involuntary waits by virtual cpu while hypervisor is servicing another processor (stolen from a virtual machine)
An easier alternative is to just use the built-in RealVNC server, but that doesn't work with a TightVNC client.
x11vnc available for raspberry pi as of May 25, 2018 (and for months earlier at least) crashes often. So to get the fix WHICH WAS FOUND IN 2016 AT LEAST we have to build from source.
sudo apt-get install autoconf libssl-dev xorg-dev libvncserver-dev
sudo apt-get build-dep x11vnc
git clone https://github.com/LibVNC/x11vnc.git
cd x11vnc
./autogen.sh
make
The built x11vnc executable will be in the src directory because why not. The x11vnc.program file in this folder runs x11vnc out of here.
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
add these lines if they do not already exist:
@xset s noblank
@xset s off
@xset -dpms
ALSO the pi apparently has a screensaver enabled by default but no way to configure it.
sudo apt-get install xscreensaver
Then in Menu
> Preferences
> Screensaver
, disable the screensaver.
Edit /etc/dhcpcd.conf
via sudo nano /etc/dhcpcd.conf
and follow the templates provided within.
Example:
interface eth0
static ip_address=192.168.0.2/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1 8.8.8.8
Add a single static IP address via the method above.
Run sudo nano /etc/dhcpcd.exit-hook
In this file, insert a line like this to add your second static IP address:
ip address add 192.168.1.2/24 dev eth0
I haven't tested the methods here, but:
interface eth0
arping 192.168.2.1
arping 192.168.4.50
profile 192.168.2.1
static ip_address=192.168.2.44/24
static routers=192.168.2.1
static domain_name_servers=192.168.2.1
profile 192.168.4.50
static ip_address=192.168.0.44/24
static routers=192.168.4.50
static domain_name_servers=192.168.4.50
ip address list
or
ip address show dev eth0
This typically affects my Ubuntu VMs after a while.
When the boot partition is full, as indicated by df
, it is probably necessary to remove old kernels.
sudo dpkg --list 'linux-image*'|awk '{ if ($1=="ii") print $2}'|grep -v `uname -r` | while read -r line; do sudo apt-get -y purge $line;done;sudo apt-get autoremove; sudo update-grub
https://askubuntu.com/questions/345588/what-is-the-safest-way-to-clean-up-boot-partition
First check your kernel version, so you won't delete the in-use kernel image, running:
uname -r
Now run this command for a list of installed kernels:
dpkg --list 'linux-image*' | grep ^ii
and delete the kernels you don't want/need anymore by running this:
sudo apt-get remove linux-image-VERSION
Replace VERSION with the version of the kernel you want to remove.
If you can't remove any because of the boot partition being full, try running this:
sudo rm -rf /boot/*-3.2.0-{23,45,49,51,52,53,54,55}-*
replacing 3.2.0
and the numbers in curly braces with appropriate numbers from the list of installed kernels.
When you're done removing the older kernels, you can run this to remove ever packages you won't need anymore:
sudo apt-get autoremove
And finally you can run this to update grub kernel list:
sudo update-grub
Alternate Commands: https://gist.github.com/ipbastola/2760cfc28be62a5ee10036851c654600
To prevent this happening, it is supposed to be possible to remove old crap automatically.
See UbuntuServerSetup Script for a simple script to setup new Ubuntu Server VMs.
sudo dpkg-reconfigure --priority=low unattended-upgrades
sudo nano /etc/apt/apt.conf.d/50unattended-upgrades
Enable the setting Unattended-Upgrade::Remove-Unused-Dependencies
and reboot the machine.
lsb_release -a
Use the commands kill
if you know the process ID, or killall
if you don't. Run each of these without arguments to see usage.
Example: killall -i mono
will prompt before killing any process matching "mono".
To find "mono":
ps aux | grep -i mono
From: https://www.cyberciti.biz/faq/unix-linux-check-if-port-is-in-use-command/
Run any one of the following command on Linux to see open ports:
sudo lsof -i -P -n | grep LISTEN
sudo netstat -tulpn | grep LISTEN
sudo lsof -i:22 ## see a specific port such as 22 ##
sudo nmap -sTU -O IP-address-Here
For the latest version of Linux use the ss
command. For example, ss -tulw