User Tools

Site Tools


technical:ubuntu_cheat_sheet

Ok.. here is a cheat sheet for all the useful commands you might need.

Login

Open a WSL session on your windows PC

ssh username@hostname.scottworld.net
sudo -s  (to become root/admin)

Reboot

This will reboot the server (only really necessary after a kernel update)

reboot

Shutdown

This will cause the server to shutdown and power off - you will need to press the power on button to restart.

shutdown -h now

Check for updates and upgrade

Occasionally you will need to make sure things are secure and up to date.

apt update   (this will refresh the repositories and look for updates)
apt upgrade   (this will install any new updates)
apt autoremove    (this will remove any old packages that are no longer used)

Show disk space remaining

This will list all disks and their current usage.

df -h

Monitor the system log

This is really handy to see what is going on. Open a 2nd WSL ssh session to the server and run the following to follow the syslog in real time.

tail -f /var/log/syslog

Editing files

Use nano to edit files. Its is recommended you use TAB to predict the path and the file name.

nano /path/to/the/file

Exit the file and save after editing with

ctrl x (then press Y to save, followed by enter)

Changing / navigating directories etc

cd /path/to/location  (change directory)
pwd  (show present working directory)
cd ..  (go up a directory)
rm /path/to/file/or/directory -R   (removes a file or directory the -R removes everything in it and under it)
mkdir directoryname    (makes a directory)
rmdir directoryname     (removes a directory)
ls -l    (lists the directory contents in a nice format)
ls -la   (lists the directory as well as hidden files in a nice format)

There is some useful stuff here

https://ubuntu.com/tutorials/command-line-for-beginners#1-overview

technical/ubuntu_cheat_sheet.txt · Last modified: by mark_scottworld.net

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki