Sunday, February 27, 2022

Linux Commands

 

  FILE COMMANDS

                               
                          
nano - command line text editor  
tee - writes to standard output file w/o opening   
echo - used to read/write strings to files
grep - filters strings within a file within a directory
whereis - locates binary files
which - find path variable for binary

find - '/ -type f -name apache' - will look through '/root' directory for files with apache in the name

wildcard - 'find /etc -type f --name apache2.*' will search for any file name with apache2 with any extension preceding within '/etc' folder

cat >> - will append a 'string' to an already existing file

touch - displays file modification date & can also create files

head & tail - view first 10 (optional) or last 10 (optional) lines of text from a file

nl - will display a file with number lines 

sed - 'stream editor' and will replace a string in a file with a new string mysql -> MySQL globally or specifically

less - find specific string within file

ln - creates a hardlink to a file

diff - difference of strings between two files

       

SYS ADMIN 

at - schedule process(es) to run at specific time 
history - displays history of .bash_history 
env - will show environment variables for current user
nice + renice - goes based off of -20 to +19. going lower means more priority of the chosen program
ps - 'ps aux' will display all processes running on system
piping - 'ps aux | grep apache2' - will search for all running processes for apache2 
PATH=$PATH:/root/newhackingtool - change $PATH so you can call w/o working directory
export - will save variables and other changes to the shell instance and make them persist
umask- shows permissions of files/dirs
dmesg - will show boot info from kernel 
top - view cpu usage by PID / -p specific process
lsof - display open files by users // specific dir's 
strace - to find system calls - maybe a system call can be exploited from vuln program??
ltrace - for shared libraries
free - view total free memory
lsb_release -a - to view information about OS
dpkg -l - show version of software package
file - will show info about executable. elf-32bit etc
time - will show you processing time stats
chmod - choose what permissions over files
links -- text mode WWW browser 
useradd - to create users
usermod - add/change user groups 
visudo - access sudoers file 
passwd -l/-u - to lock/unlock a user - also to change password 
stat -c %a - view numerical permission #s 
lastlog - shows last login of users 
systemctl --type=service --state=running - view running services    
systemctl is-enabled service - view if specific service is running 
 

HDD MANAGEMENT / FORENSICS 

gzip - gunzip to compress files // archives together || uncompress them
fdisk - to view mounted partitions // flash drives
lsblk -  will show block devices (harddrives) in /dev
df - disk free and will display info on mounted devices
fsck - filesystem check will check an UNMOUNTED device for errors(bad sectors)
sync - will force kernel to write changes to HDD while filesytem is mounted
shred - delete a file and overwrite it a # of timez you choose (useful for deleting logs // sensitive data)
dd - capability to copy deleted files and entire harddrive
mkfs.ext2 - /dev/sda1 - to make partition ext2 filesystem 
mkswap - /dev/sda2 - to make partition swap
swapon - /dev/sda2 - to turn swap on
mount - /dev/sda3 /mnt/gentoo - to mount the root partition  

NETWORK COMMANDZ  

ifconfig - check network interfaces and change ip address (broadcast) to change broadcasted
dhclient eth0 - to get assigned a new ip address by the dhcp client on eth0 interface
curl - relay to http servers

No comments:

Post a Comment

HTML Smuggling for Data Infiltration