Skip to content

RhoBetaEpsilonWPI/LinuxWorkshop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

This repository is a set of challenge problems used for our linux terminal workshop that was hosted in February 2022. It contains a set of fun challenges to test your linux terminal skills, putting your knowledge of folder navigation, file editing, and scripting to the test!

Instructions

If you would like to try these challenges to test your Linux Terminal knowledge follow these steps:

  1. Download the files either as a zip or by cloning the repository with git clone https://github.com/RhoBetaEpsilonWPI/LinuxWorkshop.git
  2. If you downloaded the zip file, make sure to extract it
  3. cd into the newly created folder cd ./LinuxWorkshop/
  4. Make the challenge file executable chmod +x ./challenge
  5. run the executable challenge file with the input argument -h to get useage instructions ./challenge -h
  6. run the executable file again with input arguement 'start' to receive your first instruction ./challenge start
  7. Follow the provided hints to solve each challenge!
  8. Profit

Additional Resources

These challenges require you to know a set of basic terminal commands. A cheat sheet of these common useful commands can be found online here or by viewing the cheatsheet below, also available in the repository as a pdf

Common Commands and Options

This guide lists common useful commands available on the linux terminal. For more information, most commands also have a ‘manual’ page that lists the various flags, inputs and outputs. There are two common ways to access the command’s manual:

  1. man [command]
  2. [command] -h

Inputs / Outputs:

Linux terminal commands use the “standard input” (stdin) and “standard output” (stdout), where the input is the information you pass into the command, and the output is displayed to the terminal once it is run. Operators redirect this input and output.

Flags:

A flag is an option that can be passed into a command. These take the form of a “tick” followed by a letter or “double tick” followed by a whole word. They modify the functionality of the command

Ex: -a or --all makes the ls command also show hidden files

Folder Navigation

ls:  “List” lists all files and folders in a directory

 -a, --all          lists hidden files and directories

 -R, --recursive    lists subfolders and files

 -l                 lists more info about files (permissions, size, owner)

cd [directory]: “Change Directory” navigates user to a new directory

 ~      home directory

 ../    moves up one level

 ./     current directory

 /      root directory

 -      return to previous directory

pwd: “print working directory” prints the path to the current directory of your terminal

nautilus [directory]: opens the visual file manager for gnome at a given directory

 .      opens the file manager at the current directory

File Manipulation

mkdir [folder_name]       “make directory” creates a new folder in the current location

touch [file_name]          makes a new file in the current location

mv [file] [new_location]  “move” moves a file to a new location

cp [file] [new_location]  “copy” copies a file to a new location

rm [file_name]            “remove” deletes a file (WARNING: this is PERMANENT)

 -r, --recursive          “removes” all sub-folders and files (DANGEROUS)

Miscellaneous

echo  [input]                 copies any given input into the output of the terminal

which [command]               returns the path to the program location

cat   [file_1] [file_2] ...   “concatenate” outputs file contents to terminal

grep  [pattern] [file]        scans a file or input for certain string patterns

diff  [file_1] [file_2]       compares two files and outputs their differences

Permissions and Access

sudo [command]   “SuperUser DO” runs the next command as administrator (Root user)

chmod [permissions] [file]  gives a file a specific set of permissions

 +x    “executable”         allows user to run the file as a program

 +r    “readable”           allows user to view the file

 +w    “writable”           allows user to edit the file

 777                        grants ALL permissions

chown [owner] [file]  changes the owner of a file

 root                  changes the owner to the “root” (SuperUser)

APT: The “advanced package tool” is a program that can automatically install and track packages from the internet. These packages extend the functionality of your terminal by adding new commands or installing tools

apt [command]    “advanced package tool” manages the packages on your machine,

                 often used with sudo to install packages with admin privileges

 update           synchronize local package index with most up to date version

 upgrade          downloads and installs any new updates found with update

 remove           removes a package from your computer

Bash Script Commands

These commands can be used in bash to create temporary variables and shortcuts, but are erased upon closing the terminal.

.bashrc is a bash script located in your home directory that is run each time you open a new terminal. This is useful for setting up common variables and aliases for future use.

alias [alias_name]=’[command line]’ creates a custom command that calls other command(s)

export [variable_name]              creates a new environment variable, denoted with a $

Note: these are commands for the ‘Bash’ shell, the default shell for Ubuntu installations. Other shells have different commands and options

Python

python  starts command-line python with your default python version

python3 starts command-line python with python version 3

 [file]  specifying a file runs that file as a python script (should have .py extension)

Operators

|   “pipe” transfers the output of one program into another.

>   “write” writes output of a program into a file (this OVERWRITES any existing file)

>>  “append” adds the output of a program onto the end of a file

&   runs the prior command in the background

About

A set of challenges to test your knowledge of Linux

Resources

Stars

Watchers

Forks

Packages

No packages published