This is the list of basic commands of the Command Line Interface (CLI) that you need to familiarize yourself with, in order to comfortably work on your server.
RaspbianOS is a fork of GNU/Linux Debian, which means that commands are compatible between those systems, excluding Raspberry specific like vcgenmod. If you need more help and examples of those commands then you can search for Debian topics as well, not only Raspbian. Moreover, one of the most popular distributions, Ubuntu, is also a fork of Debian which means that you can also search for help looking through Ubuntu tutorials. Although make sure the solution is applicable in your case, as it might be OS specific.
In general, you should be able to use all tutorials on this site on a normal PC running Debian or Ubuntu. Who knows, maybe after learning a thing or two you will set up a more powerful home server runnung pure Debian?
List of basic commands
To the best of my abilities I will try to guide you so that you will not have to research commands on your own, but just in case here is the list so that you know what said commands actually do. Sidenote, they all come with the system so you do not have to install additional packages.
- man – shows manual entry for a given command, your most important command!
- sudo – act as root, needed for most work
sudo apt update
- apt – used to install, remove or upgrade packages, either from repository or from a local directory, has other uses as well
sudo apt upgrade
- ls – lists the contents of a directory
- touch – create an empty file, can be used to alter save time of the file
- cp – copy files or folders
cp /home/username/mypage.html /var/www/mypage.html
- mv – move, used for renaming as well
mv ~/my_file.txt ~/my_file_with_new_name.txt
- wget – download a file to the current directory
- chmod – change read, write and execute permissions of a file or folder
sudo chmod -R 775 /var/www/mypage
- chown – change owner of a file or folder
sudo chown -R www-data:www-data /var/www/mypage
- adduser – add a user, creates home directory as well
sudo adduser my_new_user
- removeuser – removes user, home directory remains
sudo removeuser my_new_user
- reboot – reboots the system, requires root or sudo
- shutdown – shuts down the system so that it is safe to unplug power, do NOT just unplug the power supply as it may damage the SD card!
sudo shutdown now
- dhclient – connect to network using DHCP (not useful on RPi as it automatically connects, keeping it here for myself)
- netstat -lntp – check ports on which active services are listening
sudo netstat -lntp
- ping – test if a host can be reached, target has to have a ping client installed
- Ctrl+C – keyboard shortcut to stop the current command, some commands will run until you tell them to stop, like ping for example, this will abort the command
My tutorials will assume you are using NANO text editor. It is installed with your system. Familiarize yourself with the following shortcuts, that are used in the editor. You will not be prompted to save and close files.
- Ctrl+x – Close file
- Ctrl+o – Save file
- Ctrl+k – Cut a line
- Ctrl+u – Paste the cut line
- Ctrl+SHIFT+v – Paste
For more information about basic commands visit Official Debian Wiki