Chapter 1: Getting Started with the Basics
As mentioned in a previous post, I began reading Linux Basics for Hackers by Occupy the Web. I’ll focus on the first nine chapters of this book. Recommended by GPS, I thought this would be a fun way to learn Linux. So without further delay, let’s get started!
Using Parallels as my virtualization software, I downloaded Kali Linux as my virtual machine.
Binaries - files that can be executed
Linux is case-sensitive
Directory- folder
Home-where files created are saved by default
Kali-a distribution of Linux specifically designed for penetration testing.
root - administrator/superuser account; this account can do nearly everything on the system such as re-configuring the system, adding users and changing passwords.
script - series of commands run in an interpretive environment that converts each line into source code.
shell- environment and interpreter for running commands in Linux.
terminal - command line interface (CLI)
The Linux Filesystem
/root The home directory of the all-powerful root user
/etc Generally contains the Linux configuration files-files that control when and how programs start up
/home The user’s home directory
/mnt Where other filesystems are attached or mounted to the filesystem
/media Where CDs and USB devices are usually attached or mounted to the file system
/bin Where application binaries (the equivalent of executables in Microsoft Windows or applications in macOS) reside
/lib Where you’ll find libraries(shared programs that are similar to Windows DLLs)
Navigating the Linux Filesystem
pwd(print working directory) - returns your location within the directory structure
whoami - see which user your logged in as
cd(change directory) - change directories from the terminal
- .. (move up one level)
- ../.. (move up two levels)
- / (move up to root level in the file structure)
ls - lists both files and subdirectories of a directory
ls -l: get more information about files and directories
ls - la: lists all files including hidden files
–help: provides help with commands
man: provides more information about a command or application
locate: goes through your entire filesystem and locate every instance of a keyword (uses a database that is updated once a day)
whereis: used to find location of source/binary file of a command and manuals sections for a specified file in Linux system.
which: only returns the location of the binaries in the PATH variable in Linux.
PATH: holds the directories in which the operating system looks for the commands you execute at the command line.
find: searches for files and directories with various criteria, such as date of creation, owner and size. Only displays exact match names but this is remedied using wildcards.
grep: filter to search for keywords
piping : taking an output from one command and sending it as input to another command. We use the | command to perform piping.
ps: displays information about processes running on the machine.
cat: displays contents of a file. Also can be used to create new files using the “>” command along with the name of the file we want to create.
touch: creates a new file
mkdir: create a directory
cp: copying a file
mv: renaming a file
rm: removing a file
rmdir: removing a directory
rm - r : removes directory and its contents
Here are the exercises I did at the end of the chapter.
Exercises
Use the ls command from the root (/) directory to explore the directory structure of Linux.
I explored all the folders in the root directory including the dev folder shown here.
Use the whoami command to verify which user I am logged in as.
Use the locate command to find the wordlists.
There were many wordlists so I just took a photo of a few.
Use the cat command to create a new file and append to that file.
Create a new directory called hackerdirectory and create a new file int hat directory called hackedfile. Copy that file into the root directory renaming it secretfile.
Though I’m familiar with many of these commands, it was nice to revisit them and try out new commands that I hadn’t seen before.
I’m looking forward to Chapter 2!