linux server basics

Today I want to show the basics that everyone should know by using a linux-server. In this case I will use ubuntu – so if you do not use debian you may have some small differences.
I start with the smallest one: “w”
This will give you all user that are currently in use of the server. This can look like this:

21:01:58 up 9:45, 2 users, load average: 0,00, 0,00, 0,00
USER TTY VON ANMELD@ UNTÄ JCPU PCPU WAS
morten tty1 07:56 5:36 0.06 s 0.04 s -bash
morten pts/0 192.168.178.26 20:58 2.00 s 0.06 s 0.00 s w

If you want to update your server you should always go with:

  • sudo apt-get update
  • sudo apt-get upgrade
  • sudo apt-get dist-upgrade
  • sudo do-release-upgrade

The first one (“update”) will fetch the list of available updates. With the second command (“upgrade”) you upgrade all current packages. With the third one (“dist-upgrade”) you will update all new packages. And with the last one (“do-release-upgrade”) you will update the system to the last lts-version that is out.

The following commands help you to get some network and connection information.

  • arp: will show the Ethernet connectivity
  • ifconfig: will give you all information about our IP; as well you can use “IP address”
  • ping: with that one you can ping another server, computer, IP address, …

To set the root password you use “sudo passwd root”. To do this you need admin-rights – not surprisingly. After doing this you can use “su” to run every following command as root. If you do not want to use all following commands as root you have to set a sudo to the start like we did before here. Sudo tells that that single command is executed with admin-rights.

To edit files you have a lot of opportunities. But there are two that are pretty standard and should give you all you need to read and modify files.

  • nano
  • vi
  • cat

With the cat-command you just show the content of file – without opportunities to modify the file.

And two really basic must-haves:

  • cd: will set your current position to the path that you specify
  • ls: will show all files; “ls – l” will give you a better list of all files
Advertisements