Practical Ubuntu linux commands
sudo apt update
sudo apt upgarde
sudo apt autoremove
//or
sudo apt auto-remove
sudo apt autoclean
//or
sudo apt auto-clean
//install
sudo apt install app_name
//remove
sudo apt remove app_name
//remove completely
sudo apt remove --purge app_name
//install
sudo dpkg -i /path/to/package.deb
//remove
sudo dpkg -r /path/to/package.deb
ln -s /path/to/file /path/to/link_name
//example in laravel
ln -s /var/www/html/laravel/storage/app/public /var/www/html/laravel/public/storage
//unlink to remove the link and not where it is pointing at
unlink /path/to/link_name
sudo nano ~/.bashrc
//add your alias
alias alias_name = "original command"
//example
alias art = "php artisan"
alias gp = "git push origin master"
source ~/.bashrc
Problem:
E: The repository 'http://ppa.launchpad.net/armagetronad-dev/ppa/ubuntu bionic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Solve:
sudo apt-add-repository -r ppa:armagetronad-dev/ppa
sudo apt update -q
sudo systemctl restart network-manager.service
//upload
scp [source file] [username]@[destination server]
//download
scp [username]@[destination server]:[local path]
//example
scp -P 3031 /home/projects/project.zip [email protected]:/var/www/html
scp -P 3031 [email protected]:/var/www/storage/app/Laravel/2018-04-25-20-45-22.zip /home/hashem/
//simple file
rsync /home/simple.txt [email protected]:/home
//with directory
rsync -rt /home/transfer_me [email protected]:/home
sudo apt-get update
sudo apt-get install cron
crontab -e
//add your command
* * * * * /usr/bin/php /var/www/domain.com/backup.php > /dev/null 2>&1
sudo apt-get install unzip
unzip file.zip -d destination_folder
sudo adduser username www-data
sudo chown -R username:www-data /var/www/html
//enable mod_rewrite
sudo a2enmod rewrite
sudo nano /etc/apache2/sites-available/000-default.conf
//append end of file
<Directory /var/www/html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
//restart apache
sudo systemctl restart apache2
sudo nano /etc/apache2/sites-available/000-default.conf
//Append and save:
<VirtualHost *:80>
ServerName myapp.dev
DocumentRoot "/var/www/html/myapp/public"
<Directory "/var/www/html/myapp/public">
AllowOverride all
</Directory>
</VirtualHost>
sudo nano /etc/hosts
//Add
127.0.0.1 myapp.dev
sudo service apache2 restart
sudo chown -R $USER:www-data storage
chmod -R 775 storage
composer global require laravel/installer
sudo nano .bashrc
//append
export PATH="$HOME/.composer/vendor/bin:$PATH"
sudo apt-get update
sudo /sbin/modprobe tun
sudo apt-get install openconnect
sudo openconnect SERVER_ADDRESS
sudo update-alternatives --config php
//disable current php version
sudo a2dismod php8.1
//enable new php version
sudo a2enmod php8.0
sudo systemctl restart apache2
//export
mysqldump -u username -p database_name > data-dump.sql
//import
mysql -u username -p new_database < data-dump.sql
//WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!
ssh-keygen -R <server_ip>
//Edit the PHP.ini File
memory_limit = 256M
upload_max_filesize = 12M
post_max_size = 13M
file_uploads = On
max_execution_time = 180