Ubuntu and SSH

Ubuntu and SSH

Web Stuff 22.02.2016 3403


Ubuntu and SSH

Today we will give you a few important comand lines for your next SSH session you will need one day when you run your own server. Let's cut the text and get straight to work.

Run updates for Ubuntu

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

Clean updates for Ubuntu

sudo apt-get clean
sudo apt-get autoclean
sudo apt-get autoremove

The lines above will keep your Ubuntu server update, very important to keep your server up to date and safe.

Get current directory

pwd

Content from directory

ls

Will give you the folders and files from the directory.

ls -l

Will give you content and more information about each folder and file.

Check disk space

df -h

Get folder/file size

du -h --max-depth=1 /home/ | sort -h -r

This will give you the folders inside home in a human readable way.

Folder permissions

sudo chown -R admin:www-data /var/www/html/files

This will set the owner:group for the files directory recursive.

sudo chmod -R 2755 /var/www/html/files

Set permission for the files directory recursive.

sudo chmod -R g+s /var/www/html/files

This will set files and everything inside to be owned by the group set above.

Create directory

mkdir directory_name

Delete directory

rm -rf directory_name

Be careful that will delete the directory and everything inside.

Check PHP Modules

php -m

That should help you for your next SSH session with your linux server. Like to learn how to install your own web server based on ubuntu and virtualmin?

Thanks for reading and if you have something to say, please do so below.