In this chapter, we focus on the essentials of Linux that every beginner needs to understand. You will learn how to:
- Install Kali Linux on VirtualBox.
- Use fundamental Linux commands.
- Navigate the Linux filesystem.
- Access manual pages and built-in help commands.
-
Download VirtualBox:
- Visit VirtualBox's official website.
- Download and install VirtualBox for your operating system.
-
Download Kali Linux:
- Visit Kali Linux Downloads.
- Choose the appropriate ISO image for VirtualBox.
-
Create a New Virtual Machine:
- Open VirtualBox and click
New. - Provide a name (e.g., "Kali Linux") and select
Linuxas the type. - Allocate at least 2GB of RAM and 20GB of storage.
- Open VirtualBox and click
-
Attach ISO Image:
- Go to
Settings > Storageand attach the downloaded Kali ISO file as a virtual optical disk.
- Go to
-
Start Installation:
- Boot the virtual machine and follow the on-screen instructions to complete the installation.
| Command | Description |
|---|---|
pwd |
Prints the current working directory |
ls |
Lists files and directories |
cd <path> |
Changes the current directory |
whoami |
Displays the current logged-in user |
man <cmd> |
Displays the manual for a command |
mkdir <name> |
Creates a new directory |
rm <file> |
Deletes a file |
touch <file> |
Creates an empty file |
-
View current directory:
pwd -
List all files (including hidden ones):
ls -a
-
Navigate to a directory:
cd /home -
Create and delete files:
touch example.txt rm example.txt
The Linux filesystem is hierarchical, starting at the root directory /.
/home: User home directories./etc: Configuration files./var: Logs and variable data./bin: Essential binaries./usr: User-installed applications.
-
View directory contents:
ls -l /etc
-
Check disk usage:
df -h
Linux includes comprehensive documentation for commands. Use the following to access it:
- Manual pages:
man <command>
- Help option:
<command> --help
- View the manual for
ls:man ls
- Get a summary of
lsoptions:ls --help
By the end of this chapter, you should be able to:
- Set up a Linux environment using VirtualBox.
- Execute basic Linux commands for everyday tasks.
- Navigate and understand the Linux filesystem.
- Use manual pages to explore advanced options for commands.
- Move to Chapter 2: Text Manipulation to learn about processing and analyzing text files in Linux.
- Create a directory named
practicein your home directory. - Create an empty file named
notes.txtin thepracticedirectory. - Navigate to
/etcand list all files starting witha. - Find the manual for the
grepcommand and identify its-ioption.