Here are examples of basic Linux commands and actions we frequently use on the Linux terminal.
Each command is validated with Enter.
From a Windows command prompt, or from a MacOS or Linux terminal, remotely login with the user leguellec
into the server howto.ovh
using ssh
:
ssh leguellec@howto.ovh
Logout:
exit
While logged in, temporarily switch to another user called berthier
:
su - berthier
Collect the latest versions of installed software with apt update
, install these collected updates with apt upgrade
, accept by default the installation of upgrades with -y
and chain the commands one after the other with &&
:
sudo apt update && sudo apt upgrade -y
Immediately reboot the server:
sudo reboot
Immediately shutdown the server:
sudo shutdown -h now
Visual tool to check physical health, memory status, load and services running:
htop
Check disk space used and available on the root directory /
:
df -h /
Detailed check of disk space used by /home
sub-directory:
sudo du -c -h -d 1 /home 2>/dev/null
Search for a file named filename.ext
in /usr
sub-directory, and only display any successful find
result=$(find /usr -name "filename.ext" 2>/dev/null)
if [ -n "$result" ]; then
echo "$result"
fi