DEV Community

Faith Njenga
Faith Njenga

Posted on

Head On With Linux

WALLPAPER

Introduction

It's not talked about enough: the fear of the terminal window, or in other words, the big black screen.
Where there are no folder icons to double click on, their creation is not just a right-click, no buttons to undo mistakes and a single mistake can trigger an error message that looks like a loud, red alarm. Well, I want you to take a deep breath. The creeping of a sudden wave of imposter syndrome might not be news.
You are not alone in this
I decided to dive into the unknown and become a Data Engineer. If you do not know Linux in this line of Duty is a very crucial tool. Just like you I always thought that the command line was reserved for a certain category that I like call 'Big Boys' also known as cybersecurity experts or people who have memorized every shortcut since 1995. But over the last few weeks I have decided to get my hands dirty with real-world server deployment and yes, I can attest that: The terminal is not a monster. It is just a conversation.
Every time the terminal throws a scary Fatal error to you, it is not judging you but simply pointing out a missing configuration step in plain text. In this article, I am going to take my time and explain the nitty-gritty of what I learned in setting up a remote cloud database from scratch. We will look at my exact real-world configuration, demystify database permissions and show how visual tools like Dbeaver can come to the rescue all these in simple and friendly terms.

Remote Access and Navigating

Because a remote cloud server dos not have a monitor or a keyboard attached to it in a physcal room, we have to access its brain over the internet. The tool w use is SSH(Secure Shell). This of SSH as a secure, encrypted digital tunnel that stretches from your home laptop keyboard straight into the host operating system.
For my recent project, our remote Ubuntu cloud server was hosted at the public IP address 159.65.222.96

The login Banner
When you first connect via SSH using the administrative root user account, the server greets you with a system status banner:

connect via SSH to Ubuntu cloud server
Don't let this numbers overwhelm you. Look at them as a health dashboard for your remote computer.

  • usage of /: 4.2% means your server's storage drive is mostly empty. Your data pipelines have plenty of room to breathe.

  • Memory usage:28% tells you that more that two-thirds of your server's RAM is sitting open and ready to process heavy computational tasks.

Creating an Isolated User & The privilege shift

To practice good security habits and protect our environment, we need to move away from the root account. I created my own isolated user account (faithn) using standard Linux configuration tools.
Here is exactly how I built that user account and gave it administrative sudo privileges while logged in as root:

#1. Create the new user account (The system will prompt you to set a password)
root@assignmentServer:~# adduser faithn

#2. Grant the new user access to administrative powers ('sudo' group)
root@assignmentServer:~# usermod -aG sudo faithn
Enter fullscreen mode Exit fullscreen mode
  1. Securely switch over to the new personal account by nesting a new connection

Logging in my isolated account
Look at that prompt change:
'faithn@assignmentServer:~$'.The dollar sign($) means I am now standing safely inside my personal use sandbox. I have my own room, my own security, and I can't accidentally break the rest of the server.

Finding Your Way Around Without a Mouse

Now that we are inside our isolated faithn user account, how do we look around? Because you cannot see any folders or icons, you have to use your keyboard as your eyes. Here are some commands that helped me navigate my new digital apartment:

  • pwd (Print Working Directory): Tells you exactly where you are standing. The exact location where you are at.

PWD

  • ls -la (List All): This prints out every file and folder in your current directory, including hidden system files that control your settings.

list of files with details

  • mkdir (Make Directory)- This is equivalent of right-clicking on a desktop screen and selecting New> Folder.
    Creating a folder

  • cd (Change Directory)- This is the physical act of walking into a folder.

Navigating inside our new folder

  • touch- This instantly lays blank sheets of paper on your desk. It is a fresh text file ready for configuration details or pipeline scripts. Creating a new file

Unmasking the PostgreSQL Prompt

The next major conceptual hurdle for any beginner data engineer is understanding Context Switching.

Once, I confirmed that our database software is installed by running
Get PostgreSQL version
It was time to log in.

The right way to Login In

Once your user roles and permissions are properly set up the server, logging into your personal database should be clean and direct. You run this command into your regular Linux terminal prompt:

Login to Postgresql
If everything is configured correctly, the server will bypass all administrative barriers and drop you straight into your destination. You will see a clean welcome message and responsive prompt ready for your data queries:

psql (16.14 (Ubuntu 16.14-0ubuntu0.24.04.1))
Type "help" for help.

faithn=#
Enter fullscreen mode Exit fullscreen mode

The First Trap: Getting Stuck in the Prompts

However, when you are first figuring things out, it is incredibly easy to take a wrong turn and find yourself stuck like I was.
I tried to log straight into my database but I instead I fell directly into a classic terminal context trap that puzzles almost every single beginner:

Basic trap
Let's dissect this line by line, because understanding this sequence will instantly remove your fear of database environments.

Decoding the Prompt Symbols ($, #, and -)

The trailing symbols on your prompt lines are visual road signs showing which program is listening to your keyboard :
faithn@assignmentServer:~$ The $ means you are in the Linux Shell. You run standard system commands here like ls or mkdir.
postgres=#The # means you crossed a portal into the PostgreSQL Engine. Linux commands will not work here; the server only accepts SQL code.
postgres-# The dash (-) means PostgreSQL is waiting for you to finish a SQL statement. Typing psql twice triggers this because it isn't a valid SQL command, and the engine thinks you are still typing your sentence.
The Fix: If you ever get trapped on a line with a dash (-#) and your keyboard feels locked, press Ctrl + C. This breaks the waiting loop and returns you to a clean postgres=# prompt.

The Second Trap: The "Role Does Not Exist" Block

Once you exit the prompt loops and confidently try to log into your database using your custom name:

bash/usr/lib/postgresql/16/bin/psql -d faithn
Enter fullscreen mode Exit fullscreen mode

PostgreSQL flatly rejects you with a fatal message:
FATAL: role "faithn" does not exist
This error makes your stomach drop. You think, "But wait, My Linux username is faithn, and I am typing it correctly! Why does it say I don't exist?"

Breaking Down the Trap

This trap happens because Linux users and Database users are completely isolated from each other. Just because the server has a user profile named faithn doesn't mean the PostgreSQL application automatically knows who you are. PostgreSQL tracks its own separate guest list of users, which it calls Roles.
Think of your Linux account as your security badge to get into the main university building. The Database Role is a completely separate guest list held by a second guard standing right outside the locked database room. When you first try to connect, that second guard checks his specific list, doesn't see your name, and locks you out,.
The Clean Solution
To fix this trap, we use the Master Database Admin identity (postgres=#) to officially add your name to the database guest list and create your file storage container:

sql
CREATE ROLE faithn WITH LOGIN SUPERUSER;
CREATE DATABASE faithn OWNER faithn;
Enter fullscreen mode Exit fullscreen mode

By explicitly running these, the two separate systems are perfectly linked. Now when you type sudo -u postgres psql faithn, the database guard sees your name on the list and lets you right in.

Creating the Schema and Importing Data with DBeaver

Now that our database boundaries are unlocked, we can construct our ingestion environment. In data engineering, we use a Schema as a logical container to organize our tables. For this project, we are building a landing bucket called staging.
We log into our database and run a simple, clean SQL script to lay down our structure:
Creating a schema

Bypassing Terminal Fatigue

At this point, a classic beginner trap is trying to write massive INSERT INTO statements directly in the command line for dozens of records. It is a massive waste of time, and a single missing comma will break the entire thing. Real-world data engineers don't do everything the hard way, we balance terminal power with graphical comfort. This is the exact moment where DBeaver becomes your ultimate rescue tool. Because we configured our remote cloud server (159.65.222.96) to allow external network connections on port 5432, we can hook DBeaver directly into our backend using our personal faithn credentials. Instead of typing endless lines of code to force our data into the black box of the terminal, DBeaver peels back the scary layer of the command line and gives us a friendly, visual import wizard. I simply selected the mock student CSV spreadsheet generated on my local desktop, clicked through the visual mapping guide, and let the software automatically parse and load all records into our remote cloud database in seconds.
Connectingdbeaver

It gives you the absolute best of both worlds: your data is safely running on an enterprise Linux server in the cloud, but you get to interact with it using a beautiful, visual, human-friendly application.
To verify that DBeaver successfully uploaded your records from your local PC to your remote cloud database, you can switch back to your Linux server terminal (faithn@assignmentServer) and run this standard SQL query:

SELECT * FROM staging.students LIMIT 10;
Enter fullscreen mode Exit fullscreen mode

What You Will See on Your Screen

Running that command will print your data cleanly inside your terminal layout, showing you the exact rows you just uploaded through DBeaver:

age |      course      | admission_number | grade | student_id |   gender   |    major    
-----+------------------+------------------+-------+------------+------------+-------------
  22 | Computer Science |      4083        | F     |        1   | Male       | Physics     
  22 | Business         |      7444        | F     |        2   | Female     | Physics     
  18 | Biology          |      4103        | C     |        3   | Female     | Physics     
  26 | Biology          |      7590        | B     |        4   | Female     | Chemistry   
  30 | Psychology       |      1978        | F     |        5   | Female     | Chemistry   
  30 | Biology          |      9396        | C     |        6   | Female     | English     
  24 | Biology          |      5989        | C     |        7   | Non-binary | Mathematics 
  25 | Biology          |      8362        | B     |        8   | Non-binary | Physics     
  25 | Business         |      3275        | D     |        9   | Non-binary | Chemistry   
  21 | Business         |      6182        | B     |       10   | Female     | Physics




Enter fullscreen mode Exit fullscreen mode

Top comments (0)