# Linux Basics for Beginners

Linux Basics for Beginners – Server administration and Linux knowledge from NexoraHost.

This guide explains the most important Linux basics you need to manage your VPS or root server. Don't worry – you don't need to be an expert. With these basics you can move around your server confidently.

**Note:** Detailed guides on individual topics can be found in the left navigation.

## What is Linux?

Linux is an operating system – just like Windows or macOS. The difference: Linux is open source, free and runs on most servers worldwide. For servers, the distributions Ubuntu, Debian or CentOS are usually used. At NexoraHost we recommend Ubuntu or Debian for beginners.

## Connecting via SSH

SSH is your gateway to the server. With it you execute commands as if you were sitting right in front of it.

### On Windows (PowerShell or CMD)

`ssh root@your-server-ip`

### On Linux/macOS (Terminal)

`ssh root@your-server-ip`

On first connection you'll be asked if you trust the fingerprint. Type `yes` and enter your password.

## The most important commands at a glance

### Navigating the file system

    
        Command
        Function
    

    
        `pwd`
        Shows the current directory (print working directory)
    

    
        `ls`
        Lists files and folders in the current directory
    

    
        `ls -la`
        Detailed view with hidden files and permissions
    

    
        `cd directory`
        Changes to the specified directory
    

    
        `cd ..`
        Go up one level
    

    
        `cd ~`
        Back to the home directory
    

    
        `cd /`
        To the root directory (top level)
    

### Managing files and folders

    
        Command
        Function
    

    
        `mkdir name`
        Creates a new folder
    

    
        `rm file`
        Deletes a file
    

    
        `rm -r folder`
        Deletes a folder and all its contents
    

    
        `cp source destination`
        Copies a file or folder
    

    
        `mv source destination`
        Moves or renames a file
    

    
        `nano file`
        Opens a file in the text editor (CTRL+X to close)
    

    
        `cat file`
        Displays the content of a file
    

### System information

    
        Command
        Function
    

    
        `htop`
        Shows CPU, RAM and running processes in real time
    

    
        `df -h`
        Shows free disk space on all partitions
    

    
        `free -h`
        Shows RAM usage
    

    
        `uptime`
        Shows how long the server has been running
    

    
        `uname -a`
        Shows kernel version and system information
    

### Network

    
        Command
        Function
    

    
        `ip a`
        Shows all network interfaces and IP addresses
    

    
        `ping domain.com`
        Tests the connection to a domain or IP
    

    
        `ss -tlnp`
        Shows all open ports and listening services
    

## Package management – installing software

On Ubuntu and Debian you install software with `apt`:

`# Update package list
sudo apt update

# Update installed packages
sudo apt upgrade -y

# Install a new program
sudo apt install programname -y

# Uninstall a program
sudo apt remove programname -y`

## Users and permissions

### Who am I?

`whoami        # Shows your current user
id            # Shows user ID and group membership`

### root vs. normal user

    - **root:** The administrator with all permissions. Only use for system administration
- **Normal user:** For everyday use – can only write in their own directory
- **sudo:** Runs a command as root. Put before a command: `sudo apt update`

### Understanding file permissions

With `ls -la` you see the permissions as a string:

`-rwxr-xr-- 1 user group 1024 May 10 12:00 file.txt`

    - **r** = Read
- **w** = Write
- **x** = Execute
- **First three:** Owner permissions
- **Middle three:** Group permissions
- **Last three:** Permissions for everyone else

### Changing permissions

`# Make file executable (for scripts)
chmod +x script.sh

# Make folder readable for everyone
chmod 755 folder

# Change owner
chown user:group file`

## Managing processes

`# Show all running processes
ps aux

# Find a process by name
ps aux | grep processname

# End a process
kill PID         # Read PID from "ps aux"
kill -9 PID      # Force quit`

## Viewing logs

`# Last 50 lines of system logs
journalctl -n 50

# Logs of a specific service
journalctl -u nginx

# Follow logs in real time
tail -f /var/log/syslog`

## The most important directories

    
        Directory
        Content
    

    
        `/`
        Root directory – top level of the system
    

    
        `/home`
        User directories (your personal files)
    

    
        `/var/log`
        Log files of all services
    

    
        `/var/www`
        Web server files (HTML, PHP)
    

    
        `/etc`
        Configuration files of all programs
    

    
        `/var/lib/mysql`
        MySQL/MariaDB databases
    

## 3 golden rules for beginners

    - **Don't be afraid of the command line:** There is no undo – but also no problem that can't be fixed. Create backups
- **Think twice before every `rm` command:** Deleted files are really gone – there is no recycle bin
- **Don't do everything as root:** A normal user with sudo is enough for everyday use. Root only for system updates and configuration

*Detailed guides on each topic can be found in the articles in the left navigation.*
