[go: up one dir, main page]

0% found this document useful (0 votes)
84 views7 pages

Ubuntu Terminal Basics - A Beginner's Guide - Medium

Uploaded by

rastechethiopia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views7 pages

Ubuntu Terminal Basics - A Beginner's Guide - Medium

Uploaded by

rastechethiopia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Mastering the Basics of the Ubuntu

Terminal — A Beginner’s Guide


Alexander Obregon · Follow
5 min read · Jun 23, 2023

Image Source

Introduction
In the world of computing, command-line interfaces (CLIs) often hold a
sense of mystery for beginners. Yet, these interfaces, like Ubuntu’s Terminal,
are some of the most powerful tools in a user’s arsenal. The goal of this
article is to explain the Ubuntu Terminal for beginners by walking through
its basic operations, and showcasing how its proper use can drastically
improve your efficiency as a user.

What is the Ubuntu Terminal?


The Ubuntu Terminal, also known as the command-line interface or shell, is
a text-based environment that allows users to interact with their computer’s
operating system. Unlike graphical user interfaces (GUIs) which rely on
visual elements like windows, icons, and buttons, the Terminal
communicates through typed commands.

Why Use the Terminal?


The Terminal might initially seem complex, especially for users accustomed
to GUIs. So why use it? Simple — it offers unparalleled efficiency and control.
With the Terminal, you can navigate your computer’s file system, install
software, manage network settings, and even write scripts for automating
tasks, all much faster than using a GUI.

Starting the Terminal


To open the Terminal on Ubuntu, simply press Ctrl + Alt + T . Alternatively,
you can click on the 'Show Applications' button at the bottom left of your
screen, then type "Terminal" in the search bar and click on the Terminal
application.
Basic Commands
Now that we’ve opened the Terminal, let’s get our feet wet with some basic
commands.

pwd (Print Working Directory)


The pwd command displays the path of the current directory (folder) you're
in. When you first open the Terminal, you're in your home directory by
default. Type pwd and press enter to see its path.

$ pwd
/home/yourusername

cd (Change Directory)
To navigate to a different directory, use the cd command followed by the
path of the desired directory. For example, to change to the Desktop
Open in app directory, you would type: Sign up Sign in

Search Write

$ cd /home/yourusername/Desktop

You can also use relative paths with cd . For example, if you're in
/home/yourusername , you can simply type cd Desktop to switch to the Desktop
directory.

ls (List)
The ls command lists all files and directories in the current directory. To
see the contents of your Desktop, navigate there using cd as described
above, then type ls :

$ ls
file1.txt file2.txt subdir1 subdir2

touch (Create File)


The touch command creates a new file. For example, to create a file named
'example.txt' on your Desktop, you would type:

$ touch example.txt

Then, if you run ls , you will see 'example.txt' listed as a file in the Desktop
directory.

File Manipulation Commands


Apart from creating files, Ubuntu Terminal provides commands to
manipulate them. Let’s look at a few of these commands:

cp (Copy)
The cp command is used to copy files or directories. For instance, to copy a
file named 'file1.txt' from your Desktop to the Documents directory, you
would use:

$ cp /home/yourusername/Desktop/file1.txt /home/yourusername/Documents

mv (Move)
The mv command is used to move or rename files and directories. To move
the same file 'file1.txt' from the Documents directory back to the Desktop,
you would use:

$ mv /home/yourusername/Documents/file1.txt /home/yourusername/Desktop

To rename ‘file1.txt’ to ‘file_renamed.txt’, you would use:

$ mv file1.txt file_renamed.txt

rm (Remove)
The rm command is used to delete files. To remove 'file_renamed.txt', you
would use:

$ rm file_renamed.txt

Understanding Permissions
One of the significant aspects of Unix-like systems (including Ubuntu) is
their file permission system. Every file and directory has a set of
permissions that determine who can read, write, or execute it.

You can view the permissions of a file or directory using the ls -l


command:

$ ls -l
total 0
-rw-r--r-- 1 yourusername yourusername 0 Jun 14 11:40 example.txt

In this example, ‘-rw-r — r — ‘ represents the permissions. The first character


(‘-’) indicates the type of file (a ‘-’ means it’s a regular file). The next nine
characters are divided into three sets: user (owner) permissions, group
permissions, and others permissions. ‘r’ stands for read, ‘w’ for write, and ‘x’
for execute.

Editing Files with Nano


Ubuntu Terminal even allows you to edit files directly through a command-
line text editor like Nano. To open a file in Nano, use the nano command
followed by the file name:

$ nano example.txt

This command opens ‘example.txt’ in the Nano editor. You can then type to
add text, and use Ctrl + X to exit, which will then prompt you to save any
changes.

Networking Commands
Terminal can also help you troubleshoot network issues. Here are a couple of
common network-related commands:

ping (Check Connectivity)


ping is a basic command used to test the reachability of a host on an
Internet Protocol (IP) network. For example, to check your connection to
Google's servers, you would use:

$ ping www.google.com

ifconfig/ip a (Interface Configuration)


ifconfig or ip a (for newer systems) is used to display or configure network
interfaces. It's helpful for checking the IP addresses of your interfaces:

$ ifconfig
or
$ ip a

Process Control
The Terminal also offers commands to control processes (running instances
of programs). For example:

ps (Process Status)
The ps command is used to provide information about the currently
running processes, including their process identification numbers (PIDs).

$ ps

kill (Terminate Process)


If a process is unresponsive, you can forcefully stop it using the kill
command followed by the process's PID, which you can get from the ps
command.
$ kill PID

Conclusion
We’ve only scratched the surface of what you can achieve with the Ubuntu
Terminal. However, mastering these foundational commands will provide a
strong base for your future explorations.

The power of the Terminal lies in its versatility and efficiency. As you gain
proficiency, you’ll find that tasks which are tedious and time-consuming via
GUIs can be accomplished swiftly and elegantly in the Terminal.

So, take your time to practice and explore these commands. As with any new
skill, patience and practice are key. Happy coding!

1. Ubuntu Documentation
2. Ubuntu Forums
3. Ubuntu Command Cheat Sheet

Image Source

Ubuntu Linux Commands Basic Linux Commands Command Line Interface

Terminal Basics

Written by Alexander Obregon Follow


25K Followers · 15 Following

Software Engineer, fervent coder & writer. Devoted to learning & assisting
others. Connect on LinkedIn: https://www.linkedin.com/in/alexander-obregon-
97849b229/

No responses yet

What are your thoughts?


Respond

More from Alexander Obregon

Alexander Obregon Alexander Obregon

Enhancing Logging with @Log and Using Spring’s @Retryable


@Slf4j in Spring Boot Applications Annotation for Automatic Retries
Introduction Introduction

Sep 22, 2023 263 5 Sep 17, 2023 380 6

Alexander Obregon Alexander Obregon

Optimizing Queries with @Query Navigating Client-Server


Annotation in Spring Data JPA Communication with Spring’s…
Introduction Introduction

Aug 29, 2023 532 6 Sep 4, 2023 182 4

See all from Alexander Obregon

Recommended from Medium

Harendra Saquib Khan

How I Am Using a Lifetime 100% NGINX - Zero To Hero: Your


Free Server Ultimate Guide from Beginner to…
Get a server with 24 GB RAM + 4 CPU + 200 Introduction to Nginx
GB Storage + Always Free
Aug 4 520 5
Oct 26 7.9K 122

Lists

Staff picks Stories to Help You Level-Up


790 stories · 1517 saves at Work
19 stories · 895 saves

Self-Improvement 101 Productivity 101


20 stories · 3152 saves 20 stories · 2666 saves

In Django Unleashed by Joel Wembo In Stackademic by Crafting-Code

Technical Guide: End-to-End CI/CD I Stopped Using Kubernetes. Our


DevOps with Jenkins, Docker,… DevOps Team Is Happier Than Ever
Building an end-to-end CI/CD pipeline for Why Letting Go of Kubernetes Worked for Us
Django applications using Jenkins, Docker,…

Apr 12 972 21 Nov 19 4.5K 131

In The Pythoneers by Abhay Parashar Andrey Byhalenko

18 Insanely Useful Python Why you should NOT choose


Automation Scripts I Use Everyday DevOps as a career.
Scripts That Increased My Productivity and While there are many benefits to being a
Performance Even More DevOps engineer, there are also many…

4d ago 863 4 Dec 2 264 11

See more recommendations

You might also like