window.pipedriveLeadboosterConfig = { base: 'leadbooster-chat.pipedrive.com', companyId: 11580370, playbookUuid: '22236db1-6d50-40c4-b48f-8b11262155be', version: 2, } ;(function () { var w = window if (w.LeadBooster) { console.warn('LeadBooster already exists') } else { w.LeadBooster = { q: [], on: function (n, h) { this.q.push({ t: 'o', n: n, h: h }) }, trigger: function (n) { this.q.push({ t: 't', n: n }) }, } } })() Ruby programming. Beginner’s terminal - part 1 - The Codest
The Codest
  • About us
  • Services
    • Software Development
      • Frontend Development
      • Backend Development
    • Staff Augmentation
      • Frontend Developers
      • Backend Developers
      • Data Engineers
      • Cloud Engineers
      • QA Engineers
      • Other
    • It Advisory
      • Audit & Consulting
  • Industries
    • Fintech & Banking
    • E-commerce
    • Adtech
    • Healthtech
    • Manufacturing
    • Logistics
    • Automotive
    • IOT
  • Value for
    • CEO
    • CTO
    • Delivery Manager
  • Our team
  • Case Studies
  • Know How
    • Blog
    • Meetups
    • Webinars
    • Resources
Careers Get in touch
  • About us
  • Services
    • Software Development
      • Frontend Development
      • Backend Development
    • Staff Augmentation
      • Frontend Developers
      • Backend Developers
      • Data Engineers
      • Cloud Engineers
      • QA Engineers
      • Other
    • It Advisory
      • Audit & Consulting
  • Value for
    • CEO
    • CTO
    • Delivery Manager
  • Our team
  • Case Studies
  • Know How
    • Blog
    • Meetups
    • Webinars
    • Resources
Careers Get in touch
Back arrow GO BACK
2020-04-07
Software Development

Ruby programming. Beginner’s terminal – part 1

The Codest

Damian Watroba

Software Engineer

It’s time to discuss the second point (Terminal) from the entry How to start programming in Ruby in 7 steps. Without further ado, I invite you to read the content and follow up with some practical exercises that I have prepared for you. Let’s go!

Terminal – theory

The terminal is a basic tool in any operating system, also called a console or a command line. Every time you hear one of these terms, you’ll know it’s about that. It allows for the communication with the system shell, for example, with bass (the default shell for Ubuntu). The shell acts as an intermediary between the operating system or applications and the user. To put it simply, the console enables you to give commands to the system. It doesn’t matter in which language you program – the sooner you master this tool, the better. The terminal will be used to install/run programs on your machine, manage computer resources, navigate through directories, create files or run previously prepared scripts. These skills are necessary when managing a server that does not have a graphical user interface (GUI).

Ruby

The keyboard shortcut that opens the terminal is ctrl + alt + t

A lot of people try to postpone learning the command line, looking for versions of programs with a nice graphical interface. However, if you want to start the adventure with programming, the terminal will be an indispensable element of learning, so it’s time to become friends. The beginnings can be hard, but don’t worry.

Fronented Report for 2020

Terminal – Practice

In the picture above, we have an already open Ubuntu terminal where you can see:

damian@rubydev:~$

The first part, before the colon, is nothing but the username we chose when installing Ubuntu and the name of our computer. However, the tilde ~ means the home directory. The last character $ is the so-called “prompt.” After that commands can be entered.

Where am I?

pwd (Print Working Directory) – it always returns the path to the place where you are at the moment. When you get lost, you can always use the pwd command.

Ruby software

At this point, it is worth noting that immediately after starting the console you are always in your home directory, i.e. / home / USER_NAME, where USER_NAME means your username.

Show me what you’ve got!

ls (List) – it is one of the most commonly used commands to display the contents of the directory in which you are currently.

code

Commands can also take arguments (options) that will modify the behavior of your commands in some way. You can write them together or separately, e.g.:

damian@rubydev:~$ ls -la

or:

damian@rubydev:~$ ls -l -a

-l is an option that prints files and directories in the form of a list with detailed information, while -a or --all also prints hidden files (that is, files with names beginning with a dot).

The options passed are usually preceded by - or --. Another useful trick is to enter the path to the directory the contents of which you want to check right after ls or after the options passed (if you use them). In this way, you will do it without changing your current location.

terminal view 5

In this case, we learned what files we have in the Documents directory without moving from the home directory.

Let’s get on the way!

Time to explore your system a bit and learn how to navigate it. We will use the cd (change directory) command to move.

If you want to go to the Documents directory from your home directory, the command will look like this: cd Documents. To make sure you’re in the right place, you can check it with the already known pwd command:

terminal view 6

If you want to go back, you can use cd .., but remember that .. will take you back to the parent directory, not to the place from which you entered the command. Maybe this screen will illustrate this issue better:

terminal view 7

It is also worth knowing some shortcuts that will help you work more efficiently. The cd or cd ~ itself will take you straight to the home directory, from anywhere in your system.

damian@rubydev:~/Pulpit/Praca$ cd
damian@rubydev:~$ pwd

Choose the / if you need to get to the root directory, the so-called ‘root.” It is the basic directory of the system, containing the directories with configuration files, installed applications and user directories (including your home directory).

 damian@rubydev:~$ cd /
 damian@rubydev:/$ pwd
 /

Another thing that will facilitate your work is using the TAB button. You don’t have to enter the full name of the directory you want to go to every time, or even remember its full name. By entering the first letter of the catalog and pressing TAB, the terminal will suggest the available options or complete the command immediately if there is only one possibility. Let’s try it out:

damian@rubydev:/$ cd P[tab]
 Pobrane/ Publiczny/ Pulpit/
 damian@rubydev:/$ cd P
 damian@rubydev:~$ cd D[tab]
 damian@rubydev:/$ cd Dokumenty/

We will use the tabulator quite often in this training session.

Help?

Did you forget what options the <codecd works? You can use the documentation support that your system offers. The man (manual) command is used for this:

damian@rubydev:/$ man cd

This is not the only way. You can also use the --help or -h option, which will show you a quick help guide, for example:

damian@rubydev:~$ ls --help

Tasks:

1. Find out what other options besides -l -a the ls command can accept, and what details the -l option returns exactly.

2. Since you can navigate through the directories, familiarize yourself with the file structure of your system.

Time to add and change something!

To create new directories in which you will keep your projects, use the mkdir (make directory) command followed by the name of your choice.

 damian@rubydev:~/Pulpit$ mkdir Projekty
 damian@rubydev:~/Pulpit$ ls
 Praca Projekty


If you want to create a file, you can use the touch command:

 damian@rubydev:~/Pulpit/Projekty$ touch rubydev.rb
 damian@rubydev:~/Pulpit/Projekty$ ls
 rubydev.rb

Since you can add new directories and files, you can also copy them! To copy the files, you will use the cp (copy) command, and to copy directories cp add the -r (recursive) option. In copying a file / directory, the command takes two parameters:

  • the file you want to copy, e.g. the previously created rubydev.rb file,
  • the place to which you copy (you can give the copy a new name by inserting it at the end of the destination path).
terminal view 8

I copied the rubydev.rb file to the parent directory, i.e. the Desktop directory

You can also transfer files. Let’s try to move the previously copied file back to the directory in which you are located, changing its name at the same time.

terminal view 9

We move the rubydev_copy.rb file from the parent directory to the directory in which we are currently located

To move files and directories, use the mv (move) command, which – just like cp – takes two input pieces of information: what and where to move.

Unnecessary? Let’s delete!

As it usually happens, after some time, you will have files and directories that you no longer need or use. There are also appropriate commands to delete such files and directories.

rmdir (remove directory) – removes the empty directory that you give as a parameter. If you give more paths to directories, it will delete them all.

rm (remove) – removes the file. To delete a directory with this command, we you the -r -f option. This command accepts one parameter only, namely the path to the file or directory. If you want to delete all files in the directory in which you are located, you can pass the * character as a parameter. The command will then look like this: rm *

 damian@rubydev:~/Pulpit/Projekty$ ls rubydev_move.rb rubydev.rb
 damian@rubydev:~/Pulpit/Projekty$ rm *
 damian@rubydev:~/Pulpit/Projekty$ ls
 damian@rubydev:~/Pulpit/Projekty$

Before using *, make sure (with pwd) that you are in the right place so as not to delete important files.

The previously mentioned options -r (recursive, delete files in subdirectories) and -f (force, delete without confirmation, including files protected against deletion) are used together to remove a directory with all its content. Therefore, before using rm -rf, you need to be sure what you are removing.

Tasks:

1. Using man, read the documentation for the commands discussed above,

2. Create two directories: project_1, project_2

3. Create three files in the project_1 directory (any names), e.g. application.rb, routes.rb, puma.rb

4. Copy all files from project_1 to project_2, and then delete project_1.

Summary

As you can see, handling the terminal is not difficult, it just takes a little practice. To really master it, I recommend using the terminal for all simple operations. In the second part of this tutorial, I will show you some other commands that are worth knowing. Bye!

Read more:

– Top programming languages for fintech companies

– Google Spreadsheets can be even smarter! Let the Google Apps Script save your time

– Quality first! 5 easy steps to lint your code with GitHub workflows in JavaScript project

Related articles

Software Development

Build Future-Proof Web Apps: Insights from The Codest’s Expert Team

Discover how The Codest excels in creating scalable, interactive web applications with cutting-edge technologies, delivering seamless user experiences across all platforms. Learn how our expertise drives digital transformation and business...

THECODEST
Software Development

Top 10 Latvia-Based Software Development Companies

Learn about Latvia's top software development companies and their innovative solutions in our latest article. Discover how these tech leaders can help elevate your business.

thecodest
Enterprise & Scaleups Solutions

Java Software Development Essentials: A Guide to Outsourcing Successfully

Explore this essential guide on successfully outsourcing Java software development to enhance efficiency, access expertise, and drive project success with The Codest.

thecodest
Software Development

The Ultimate Guide to Outsourcing in Poland

The surge in outsourcing in Poland is driven by economic, educational, and technological advancements, fostering IT growth and a business-friendly climate.

TheCodest
Enterprise & Scaleups Solutions

The Complete Guide to IT Audit Tools and Techniques

IT audits ensure secure, efficient, and compliant systems. Learn more about their importance by reading the full article.

The Codest
Jakub Jakubowicz CTO & Co-Founder

Subscribe to our knowledge base and stay up to date on the expertise from the IT sector.

    About us

    The Codest – International software development company with tech hubs in Poland.

    United Kingdom - Headquarters

    • Office 303B, 182-184 High Street North E6 2JA
      London, England

    Poland - Local Tech Hubs

    • Fabryczna Office Park, Aleja
      Pokoju 18, 31-564 Kraków
    • Brain Embassy, Konstruktorska
      11, 02-673 Warsaw, Poland

      The Codest

    • Home
    • About us
    • Services
    • Case Studies
    • Know How
    • Careers
    • Dictionary

      Services

    • It Advisory
    • Software Development
    • Backend Development
    • Frontend Development
    • Staff Augmentation
    • Backend Developers
    • Cloud Engineers
    • Data Engineers
    • Other
    • QA Engineers

      Resources

    • Facts and Myths about Cooperating with External Software Development Partner
    • From the USA to Europe: Why do American startups decide to relocate to Europe
    • Tech Offshore Development Hubs Comparison: Tech Offshore Europe (Poland), ASEAN (Philippines), Eurasia (Turkey)
    • What are the top CTOs and CIOs Challenges?
    • The Codest
    • The Codest
    • The Codest
    • Privacy policy
    • Website terms of use

    Copyright © 2025 by The Codest. All rights reserved.

    en_USEnglish
    de_DEGerman sv_SESwedish da_DKDanish nb_NONorwegian fiFinnish fr_FRFrench pl_PLPolish arArabic it_ITItalian jaJapanese ko_KRKorean es_ESSpanish nl_NLDutch etEstonian elGreek en_USEnglish