Code Done Right!

Basic commands

This is the list of basic commands in Command Line Interface (CLI) commands that you need to familiarize yourself with in order to comfortably work on your server. Raspbian is a fork of Debian which means that commands are compatible between those two, excluding Raspberry specific like vcgenmod. If you need more help and examples of the usage 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 you can also search for help looking through Ubuntu tutorials.

To the best of my abilities I will try to guide you in a way that you will not have to research those commands on your own, but just in case here is the list so that you know what commands I am instructing you to input actually do

  • sudo – act as root, needed for most work
  • ls – lists the contents of a directory
  • touch – create an empty file and open the default editor nano
  • cp – copy
  • mv – move, used for renaming as well
  • wget – download a file to the current directory
  • dd – copy/clone from one place to another, e.g. takes an .img image and flashes it on SD card
  • chmod – change permissions
  • chown – change owner
  • adduser – adds an user, creates home directory as well
  • removeuser – removes user, home directory remains
  • apt – used to (re)install or remove packages, either from repository or local from current directory, has other uses as well
  • reboot – reboots the system
  • shutdown – shuts down the system, do NOT just unplug the power supply as it may damage the card!
  • dhclient – allows a host to contact a central server i.e. connect your computer to router (not useful on raspberry as it automatically connects, but should you install minimalistic Debian with CLI only you will need it)
  • netstat -lntp – check ports on which active services are listening
  • ping – test reachability of a host, you can ping google.com to see if you are connected to internet for example
  • 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

Raspberry tutorials will assume you are using NANO text editor that is a default on Raspbian. Familiarize yourself with the following shortcuts that are used in the editor. I will not prompt you for saving and closing files. If you are looking to set up a server you should know that by now

  • Ctrl+x => Close file
  • Ctrl+o => Save file
  • Ctrl+k => Cut line
  • Ctrl+u => Paste the cut line
  • Ctrl+SHIFT+v => Paste

If you want to feel like a pro you can use vim instead, but since I favor the utilitarian approach we will stick with NANO.

For more about basic commands visit Official Debian Wiki

If I missed a command used in tutorials or you think I should just include something here feel free leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.