Basic Commands

Prompt

Learn the common basic commands used on the Linux command line.

Walk-Through

This challenge will give you experience running basic Linux commands. To solve these challenges, you will be using a Linux Command Line Interface (aka terminal or shell).

Background

When running a Linux command, different options can be provided to get a specific behavior. One of these is arguments. Arguments always follow the name of the program and could provide information such as the file you wish to run the program on. You may also see arguments referred to as “options” or “flags”.

The syntax for arguments is set by the author of the program. You can often type in the name of the command followed by --help to get information on how to use the program.

For some programs, you can use the man (manual) program to pull up the instructions. If a program has a manual entry, you can open the manual by typing man followed by the name of the program.

Below is the man page for the ls command. You can view it by entering man ls into the command line:

Enter
Enter man followed by the command name to get the manual page for a specific command.

If the -a argument is used with the ls command, all of the files, even the hidden ones which start with . , will be listed.

The output of
The output of ls -a

Multiple arguments can be added together. The -l argument will list the read, write, execute permissions, the users who can access the file, the file size, and the date modified.

The output of
The output of ls -la Some common Linux commands are listed in a table below . Read the manual pages to learn more about different arguments. Understanding how commands can be used is a key part of using Linux.

Please note that within the terminals provided by Cyber Skyline, you will only have access to the tools that are pre-installed. You are not able to install tools that are not given in the terminal.

Guide

Standard Streams

The output of one program can be used as the input to another program. This utilizes a system in Linux called standard streams. There are three standard streams in Linux:

standard input (stdin) - data going into a program

standard output (stdout) - data coming out of a program

standard error (stderr) - errors coming out of a program

The greater than symbol is used to redirect stdout data of a command to a file. For example, echo “I Love Linux” > linux.txt will create a file named “linux.txt” (if it doesn’t already exist) and add “I Love Linux” to it.

Entering echo “Penguins are Cool” > linux.txt will overwrite the pre-existing linux.txt file with the new contents.

Using two greater than symbols will allow contents to be added to the current file contents. echo “I Love Linux” >> linux.txt

The use of the greater than symbol is important to how output is written to files.
The use of the greater than symbol is important to how output is written to files.

The less than symbol can be used in a variety of ways. One is to redirect contents of a file (or stdin) to a certain command. Shown below is the stdout of names.csv using the cat command. But the contents of the names.csv file can be re-directed to the cut command. cut -d ',' -f 1 is used below to show the contents of the first column of a file which is determined by using a comma and the separator, or delimiter, of the columns.

This screenshot shows the stout of the cat command on the names.csv file.
This screenshot shows the stout of the cat command on the names.csv file.
This screenshot shows the names.csv file used as stdin for the cut command. Only the first names in the file are shown as a result of the command.
This screenshot shows the names.csv file used as stdin for the cut command. Only the first names in the file are shown as a result of the command.

Stringing Commands

The stdout of one program can be made into the stdin of another program. This is done by using the pipe operator ( | ), which is represented with the vertical bar, and allows you string commands together.

For example, to find the number of people with the first name of “Jordan” from the names.csv file, try using cut -d "," -f 1 < names.csv | grep Jordan. Here, the grep command takes the output from the first portion of the command and only outputs strings that match “Jordan”:

image

It would be easier if a number was given as an output instead of needing to count. What if there were thousands of people named Jordan in the file? The number of lines that are output can be counted using wc -l:

The output of
The output of cut -d ‘,’ -f1 <names.csv | grep Jordan | wc -l is hidden

Chaining multiple Linux commands can become useful in manipulating and analyzing data. Practice running different commands using these different customization tools. Below is a table of common Linux commands.

You should become comfortable and will be expected to search online for command line tools that can help you accomplish a task from the terminal. You can also use the built-in help or manual pages to learn how to use a tool.

Expand this toggle to see a list of common Linux commands you should be expected to use or be comfortable using

Useful tools for this challenge and learning Linux:

Tutorial Video

Watch our full Tutorial Video to learn more specifics about the Linux command line.

Questions

1. What character can you use to redirect the output of one program as the input to another program

Search online for this question as-is. Make sure to find an answer that is specific to redirecting from output from one program to another program (and not to a file)

2. What character can you use the redirect the output of a program to a file?

Search online for this question as-is. Make sure to find an answer that is specific to redirecting from output from one program to a file (and not to another program)

3. How many people have a first name of Jordan in names.csv?

cut -d "," -f 1 < names.csv | grep Jordan | wc -l

©️ 2026 Cyber Skyline. All Rights Reserved. Unauthorized reproduction or distribution of this copyrighted work is illegal.