Skip to content

Setup and Terminal

AndreQuimper edited this page May 8, 2024 · 1 revision

Welcome to the Setup Page!

Getting a terminal

Why? The terminal is a crucial tool in computing. Whether you are doing security or general software development, learning how to use the terminal is crucial. This tutorial will show how to get a UNIX terminal.

Windows

WSL

Windows Subsystem for Linux (WSL) is a windows feature that allows you to run a linux environment on your windows computer.
To install:

  1. Open Microsoft Store
  2. Search Ubuntu
  3. Install Ubuntu (the one without numbers)

If you get an error try this:

  1. Open cmd as administrator
  2. run wsl --install
  3. restart your computer

Mac

Mac has a built in terminal, but there are a few programs you can get to make it better.

Homebrew

"brew" is a package manager. A package manager is a program that allows you to easily download and manage software.
To install tools with brew, use brew install <package>.

VM

A virtual machine allows you to emulate a different operating system. This way you can have a Linux Operating system, while your main machine is a different operating system.
I recommend downloading VMware Fusion (MacOS) or VMware Workstation Player (Windows). If you are a student you can get a license for free!.
You can then install a Ubuntu (Linux) image on your Hypervisor.

Using the Terminal

The Filesystem

the most important skill you have to learn is how to traverse the filesystem.
The cd or Change Directory command allows you to change your current working directory.

Your filesystem might look like this:

/
├── dirA
│   ├── dirC
│   │   └── file1.txt
│   └── file1.txt
└── dirB
    ├── file1.txt
    └── file2.txt

In the following example

|
v

represents your current working directory.


cd /

|
v
/
├── dirA
│   ├── dirC
│   │   └── file1.txt
│   └── file1.txt
└── dirB
    ├── file1.txt
    └── file2.txt

cd dirB

     
/    
├── dirA
│   ├── dirC
│   │   └── file1.txt
│   └── file1.txt
|    |
|    v
└── dirB
    ├── file1.txt
    └── file2.txt

cd ..

|
v
/
├── dirA
│   ├── dirC
│   │   └── file1.txt
│   └── file1.txt
└── dirB
    ├── file1.txt
    └── file2.txt

cd dirA/dirC

/
├── dirA  |
|   |     v
│   ├── dirC
│   │   └── file1.txt
│   └── file1.txt
└── dirB
    ├── file1.txt
    └── file2.txt

There are some special things you need to know.

  • .. represents your parent directory.
  • . represents your current directory.

Paths

Absolute Paths

The absolute path always starts at /.
ex: /dirA/dirC/file1.txt

Relative Path

relative paths start at your current workind directory
ex: dirC/file1.txt (starting at dirA)

Useful Commands

ls <directory>: lists files in your current or specified directory
mv <source> <dest>: move file from source to destination
rm <file>: remove file. Not Reversible.
cat <file>: print contents of file
./file: execute a file
man <command>: show the manual pages of a command
nc <ip> <port>: connect to ip on port
ssh <user@ip> <port>: secure remote shell. connect to ip as user
ping <ip>: see if an IP address is up using ICMP
curl <url>: network access tool to access websites through the terminal
wget <url>: download file at url.

Next Steps

Play the bandit wargame at overthewire.
You can connect to the first level by:
ssh bandit0@bandit.labs.overthewire.org -p 2220