SWG7i




Pay Notebook Creator: Karsh Patel0
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

List files in this folder.

In [ ]:
ls

List files with more information.

In [ ]:
ls -l

Show help for the ls command.

In [ ]:
ls --help

Reveal current folder.

In [ ]:
pwd

Change to root folder.

In [ ]:
cd /

Autocomplete folder names.

In [ ]:
# Type cd /home/u and press TAB

Run Commands

Save text to a file.

In [ ]:
ls > /tmp/files.txt

Append text to a file.

In [ ]:
ls >> /tmp/files.txt

Show command history.

In [ ]:
history

Save command history to a file.

In [ ]:
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.