Skip to main content

Kali Linux Basic Commands with FileSystem

Kali Linux  is a distribution of Linux specifically designed for penetration testing. It has hundreds of tools preinstalled, saving you the hours it would take to download and install them yourself.

Directory is the same as a folder in Windows. A directory provides a way of organizing files, usually in a hierarchical manner. 

Home Each user has their own /home directory, and this is generally where files you create will be saved by default. 

root Like nearly every operating system, Linux has an administrator or superuser account, designed for use by a trusted person who can do nearly anything on the system.

Script is a series of commands run in an interpretive environment that converts each line to source code. 

Shell is an environment and interpreter for running commands in Linux.

Terminal is a command line interface (CLI).

The Linux Filesystem

The Linux filesystem structure is somewhat different from that of Windows. Linux doesn’t have a physical drive (such as the C: drive) at the base of the filesystem but uses a logical filesystem instead. At the very top of the filesystem structure is /, which is often referred to as the root of the filesystem.

The FileSystem
The root (/) of the filesystem is at the top of the tree, and the following are the most important subdirectories to know: 
  • /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 filesystem 
  • /bin Where application binaries (the equivalent of executables in Microsoft Windows) reside 
  • /lib Where you’ll find libraries (shared programs that are similar to Windows DLLs)

BASIC COMMANDS IN LINUX

Unlike when you’re working in a graphical user interface (GUI) environment like Windows or macOS, the command line in Linux does not always make it apparent which directory you’re presently in. To navigate to a new directory, you usually need to know where you are currently. The present working directory command, pwd, returns your location within the directory structure.




CHanging Directories with cd

To change directories from the terminal, use the change directory command, cd. For example, here’s how to change to the /etc directory used to store configuration files:


Listing the Contents of a Directory with ls 

To see the contents of a directory (the files and subdirectories), we can use the ls(list) command. This is very similar to the dircommand in Windows. 

This command lists both the files and directories contained in the directory. You can also use this command on any particular directory, not just the one you are currently in, by listing the directory name after the command; for example, ls/etcshows what’s in the /etc directory.


Searching with locate

Probably the easiest command to use is located. Followed by a keyword denoting what it is you want to find, this command will go through your entire filesystem and locate every occurrence of that word. 

To look for aircrack­ng, for example, enter the following:


Finding Binaries with whereis 
If you’re looking for a binary file, you can use the where the command to locate it. This command returns not only the location of the binary but also its source and man page if they are available. 
Here’s an example:





Copying a File

To copy files, we use the cp command. This creates a duplicate of the file in the new location and leaves the old one in place. 
Here, we’ll create the file oldfile in the root directory with touch and copy it to /root/newdirectory, renaming it in the process and leaving the original old file in place.
Removing a File
The command for removing a directory is similar to the rm command for removing files but with dir(for directory) appended, like so:

Removing a Directory 
The command for removing a directory is similar to the rm command for removing files but with dir(for directory) appended, like so: 

It’s important to note that rmdir will not remove a directory that is not empty but will give you a warning message that the “directory is not empty,” as you can see in this example. You must first remove all the contents of the directory before removing it.  
This is to stop you from accidentally deleting objects you didn’t intend to delete. If you do want to remove a directory and its content all in one go,
you can use the -r switch after rm, like so:

Just a word of caution, though: be wary of using the -r option with rm, at least at first, because it’s very easy to remove valuable files and directories by mistake. Using rm-rin your home directory, for instance, would delete every file and directory there—probably not what you were intending.

Comments

Popular posts from this blog

Vulnerability Assessment and Penetration Testing(VAPT)

   What is a Vulnerability Assessment? A vulnerability assessment is a periodic review of security weaknesses in an information system. It estimates if the system is susceptible to any comprehended vulnerabilities, allocates severity levels to those vulnerabilities, and suggests remediation or mitigation , if and whenever required. Also, using  a risk-based method, vulnerability assessments may target different layers of technology and systems, the most common being host-, network, and application-layer, the infrastructure of network reviews. There are several types of vulnerability assessments. These include: Host-based assessment – The review of critical servers, which may be vulnerable to attacks if not adequately tested or not generated from a tested machine image. Network and wireless assessment – The assessment of policies and practices to prevent unauthorized access to private or public networks and network-accessible resources. Database assessment – The assess...

ME AND MY GIRLFRIEND: 1 Walkthrough

  ME AND MY GIRLFRIEND: 1  Walkthrough Description : This VM tells us that there are a couple of lovers, namely Alice and Bob, where the couple was originally very romantic, but since Alice worked at a private company, "Ceban Corp", something has changed from Alice's attitude towards Bob like something is "hidden", And Bob asks for your help to get what Alice is hiding and get full access to the company! Difficulty Level: Beginner Notes : there are 2 flag files Learning : Web Application | Simple Privilege Escalation | uses of Burp Suite | Unix Commands Machine Download Link : https://www.vulnhub.com/entry/me-and-my-girlfriend-1,409/ Tools:  Raccoon Nikto Burp Suite NMAP Dirb After downloading the ova file, I imported in Oracle virtual machine, then started my kali machine and my target machine(ME AND MY GIRLFRIEND: 1). Step 1: At first, search my target machine using this command "sudo arp-scan -l." As we saw the result, I found my target machine...