Linux Raspberry PI

Linux miscellaneous

Pertains mostly to Ubuntu 18.04.4 and Apache 2.4.29

Get Ubuntu version

lsb_release -a

Get Apache version

apache2 -v

Get MySql version

mysql --version

Find Files and hide all permission denied messages

find /start_directory -name filename 2>/dev/null

Copy file with ssh from server to localhost

scp user@server:/directory_from/filename.txt /local_directory/

Copy file from localhost to server with ssh

scp file_to_copy.txt user@servername:/directory_to_copy_to/

Copy directory from server recursively with ssh

scp -r user@server:/directory_from /local_directory/

Copy directory to server from localhost recursively with ssh

$ scp -r /local_directory/ user@server:/server_directory/

Copy directory with ftp recursively into current directory

sudo wget -r ftp://user:password@server/folder1/folder2/filename

To use ftp to put files onto a server recursively

ncftpput -R -v -u user -p password -P 21 /directory_to_copy_to /directory_to_copy_from

Import .sql into MySql

mysql -uUser -pPassword Database < sql_file.sql

To export MySql table to .sql file

sudo mysqldump database table -uUsername -pPassword > sql_file.sql