UPqJb




Pay Notebook Creator: Tembelihle Moyo0
Set Container: Numerical CPU with TINY Memory for 10 Minutes 0
Total0

Introduction to the Terminal

Familiarity with and mastery of the command-line terminal is important for developers at all skill levels.

You can run the shell commands in this notebook, but we recommend that you open a terminal and type the shell commands directly.

Start a New Terminal

In the notebook file tree, look for the buttons on the upper right and click New > Terminal.

title

In [ ]:
# List files in this folder
ls
In [ ]:
# List files with more information
ls -l
In [ ]:
# Show help for the ls command
ls --help
In [ ]:
# Reveal current folder
pwd
In [ ]:
# Change to root folder
cd /
In [ ]:
# Autocomplete folder names
# Type cd /home/u and press TAB

Run Commands

In [ ]:
# Save text to a file
ls > /tmp/files.txt
In [ ]:
# Append text to a file
ls >> /tmp/files.txt
In [ ]:
# Show command history
history
In [ ]:
# Save command history to a file
history > /tmp/history.txt

Edit Files

Though it has a steep learning curve, we strongly recommend learning a powerful editor called Vim.

Here is a good beginner's tutorial.

In [ ]:
# Start the vim editor
# vim

Install Packages

Each Linux distribution has its own package manager. Fedora uses the dnf package manager.

In [ ]:
# Install the git package
# sudo dnf -y install git

Manage Processes

You can suspend, resume and stop processes that are taking too long.

In [ ]:
# Suspend current process
# Press CTRL-Z
In [ ]:
# Resume process in background
# bg
In [ ]:
# Resume process in foreground
# fg
In [ ]:
# Stop current process
# Press CTRL-C

Learn Shortcuts

If you are using the terminal (and not running commands in this notebook), you can take advantage of time-saving keyboard shortcuts.

Learn Together

We often find that people teach each other and learn cool tricks when working together in the same terminal.