Bash & server commands

install library to add/remove apt repositories

sudo apt install -y software-properties-common

add-apt-repository ‘deb http://archive.ubuntu.com/ubuntu xenial main restricted universe multiverse’

intall packages/libraries

apt install -y nginx

apt install -y nginx=10.3

apt install mysql-server

apt install php7.4 php7.4-fpm php7.4-mysql

get the available versions of a package

apt-cache policy php

or

apt list -a php

get list of installed packages

apt list –installed

apt list –installed | grep php

or

dpkg -l 

dpkg -l | grep php

zip command with excluding updraft and cache directories as example

zip -r content.zip -x “wp-content/updraft/*” -x “wp-content/cache/*”

unzip command with exclude wordpress wp-content directory

unzip latest.zip -x “wordpress/wp-content/*”

get running processes and the users associated with them

ps aux

ps aux | grep nginx

force stopping specific server process

kill {process id number}

or

htop

file system commands

create new direcotry

mkdir test

mkdir -p /test/test1/{test2,test3}

create new file

touch test_file.php

or

nano test_file.php

nginx commands

check if nginx configs are correct

nginx -t

get nginx version

nginx -v

enable site by crating symbolic link in sites-enabled linking to site conf file in sites-available

ln -s /etc/nginx/sites-available/dev.conf /etc/nginx/sites-enabled

mysql commands

secure mysql after installing mysql-server

mysql_secure_installation

get mysql version

mysql –version

php commands

get php version

php -v

get all php modules enabled

php -m | grep xml

install php modules

apt install php7.4-mbstring php7.4-xml php7.4-curl

Scroll to top
Index