Linux Bash Basics | Cyber Security Tutorial - Learn with VOKS
Back Next

Linux Bash Basics


What Is Bash?

Bash stands for:

Bourne Again Shell

It is a program that lets you control Linux by typing commands.

It is a shell, which means:

  • It takes your typed commands
  • Sends them to the operating system
  • Shows you the results

You interact with Bash using a program called the Terminal.

Instead of clicking with a mouse, you type instructions.

Opening the Terminal

On most Linux systems:

  • Press Ctrl + Alt + T
  • OR
  • Search for "Terminal" in the applications menu

You’ll see something like:

user@computer:~$

This is called the prompt.

  • user = your username
  • computer = your system name
  • ~ = your home directory
  • $ = regular user

If you see #, that means you are the root (administrator) user.

Understanding the Filesystem

Linux organizes files in a tree structure.

The top of the tree is:

/

This is called the root directory.

Important directories:

  • /home → user files
  • /etc → system configuration
  • /bin → essential programs
  • /usr → installed software

Your personal files are usually in:

/home/yourname

Shortcut:

~

means your home directory.

Basic Navigation Commands

Show Files

ls

List with details:

ls -l

List hidden files:

ls -a

Change Directory

cd foldername

Go back one level:

cd ..

Go to home directory:

cd ~

Go to root directory:

cd /

Creating and Deleting

Create a Folder

mkdir MyFolder

Remove a Folder

rmdir MyFolder

If the folder contains files:

rm -r MyFolder

Create a File

touch file.txt

Delete a File

rm file.txt

Viewing File Contents

Show file content:

cat file.txt

View long files page by page:

less file.txt

Copying and Moving Files

Copy a file:

cp file.txt backup.txt

Move or rename a file:

mv file.txt newname.txt

Permissions Basics

Linux uses read, write, and execute permissions.

View permissions:

ls -l

Change permissions:

chmod 755 file.txt

Running Programs

Run a program:

programname

Run a script:

bash script.sh

Make a script executable:

chmod +x script.sh
./script.sh

Getting Help

Most commands have built-in help.

man ls

Or shorter help:

ls --help

A Simple Practice Session

ls
mkdir TestFolder
cd TestFolder
touch hello.txt
ls
cat hello.txt
cd ..
rm -r TestFolder

What this does:

  1. Lists files
  2. Creates a folder
  3. Enters the folder
  4. Creates a file
  5. Lists contents
  6. Displays file content
  7. Goes back
  8. Deletes the folder

Important Concepts

1. Case Sensitivity

Linux IS case-sensitive.

These are different:

file.txt
File.txt
FILE.txt

2. Command Structure

Most Bash commands follow this pattern:

command [options] [target]

Example:

ls -l
  • command = ls
  • option = -l

3. Everything Is a File

In Linux:

  • Regular files are files
  • Folders are files
  • Devices are files
  • Processes are treated like files internally

This is a very important Linux concept.

Example Code:
ls
ls -l
ls -a

cd foldername
cd ..
cd ~
cd /

mkdir MyFolder
rmdir MyFolder
rm -r MyFolder

touch file.txt
rm file.txt

cat file.txt
less file.txt

cp file.txt backup.txt
mv file.txt newname.txt

ls -l
chmod 755 file.txt

programname
bash script.sh
chmod +x script.sh
./script.sh

man ls
ls --help

ls
mkdir TestFolder
cd TestFolder
touch hello.txt
ls
cat hello.txt
cd ..
rm -r TestFolder
Cyber Security
Introduction Types of Cyber Threats Cyber Security Domains CIA Triad (Confidentiality Integrity Availability) Career paths in Cyber Security Certifications Ethics and Responsible Disclosure Laws and Regulation (e.g. GDPR, NDPR) What is an OS? Types: Window, Linus, macOS Command-line vs GUI OS Internals Overview (filesystems, processes, permissions) Windows command prompt basics Linux Bash Basics File System Navigation Basic Scripting IP Addressing DNS, DHCP Mac Address OSI VS TCP/IP Models Ports and Protocols (TCP, UDP) Common Protocols (HTTPS, FTP, SSH, etc.) Packet structure Firewalls, IDS/IPS, VPNs Common attacks: MITM, Sniffing Secure Network Practices How the Web works HTTP vs HTTPS URLs, Headers, Cookies Client-Server Architecture Introduction To Web Security OWASP Top 10 Overview Common Threats (XSS, SQLi, CSRF) Inpute validation and authentication flow Basic Exploitation demo (e.g. XSS) Burp Suite Introduction Using a Browser For Testing Password security MFA-Antivirus Cyber Hygeine Practice Intro To Tools: Nmap, Wireshark, Netstat
All Courses
Advance AI Bootstrap C C++ Computer Vision Content Writing CSS Cyber Security Data Analysis Deep Learning Email Marketing Excel Figma HTML Java Script Machine Learning MySQLi Node JS PHP Power Bi Python Python for AI Python for Analysis React React Native SEO SMM SQL