Tricksyhobbit1 - White Hat Commands in Linux
Tricksyhobbit1 - White Hat Commands in Linux
pwd Show current directory grep option Search for string in files cp Copy file1 to file2
mkdir Make directory directory string files file1
directory -i Case insensitive file2
cd Change to directory directory -v Inverted search cp - If file cannot be opened remove and
directory f try again
-c Print count of matching
cd .. Go up a directory (the parent lines cp - Hard link files instead of copying
directory) l
-o Show matched part of
cd Change to home directory file only cp - Do not overwrite existing file
n
ls list files (in current directory)
More Search Commands cp - Make symbolic link instead of
cat file Display contents of file
s copying
find /dir/ - Find files starting with
ls directory list files in specified directory
name name name in dir cp - Copy directories recursively
whoami Show your username
r
find /dir/ - Find files owned by name
uname -a Show system and kernel
user name in dir cp - Copy only when SOURCE file is
head -n1 Show distrobution u newer than destination file or when
whereis Find binary source manual
/etc/issue destination file is missing
command for command
man Show manual/information for
locate file Find file with quick search
command specified command Permissions (chmod)
of system index
uptime Show uptime chmod u Change owner permission of
which file Shows path to file
date Show system date file file
Add 2>/dev/null at the end to discard error
mount Show mounted file systems chmod g Change group permission of file
messages
file
ls Options chmod o Change all others' permission
File Manipulation
file of file
-a Show all plus hidden files
touch Create, change, modify timestamps
chmod a Change everyone's permission
-R Recursive list of a file
file of file
-r Reverse order echo Print specified text
r permission to read symbol
-t Sort by last modified mv Move source to directory; Rename
w permission to write symbol
-S Sort by file size Old to New
x permission to execute symbol
-l Long listing format rm Remove files or directories
chmod Adds the "read" ability to "other"
-1 One file per line rm -f Ignore nonexistent files
o+r file users
-m Comma-separated output rm -i Prompt before every removal
chmod Removes the "read" ability from
-Q Quoted output rm -I Prompt once before removing more
o-r file "other" users
than 3 files
rm -r Remove directories and their
contents recursively
chmod Adds rwx permissions to all killall Kill all process with names -n Numeric-only IP addresses
777 file users using octal notations name beginning with name -s local source address
I advise looking up an octal notations table/‐ address
Basic Networking Commands
explaination for any help understanding the -c string specify shell cmds to execute
numbers and their placement, this is just for ifconfig Show details of Network after connect
a quick reference. settings (IP, version, etc)
-e Specify filename to execute
whois Shows site owner and DNS filename after connect (if no working
Ownership (chown) name server /bin/sh)
chown newowner file Change user nslookup Shows nameservers and IP
owner of file to Addresses tcpdump
newowner
traceroute Shows routing information to -A Print in ASCII
chown :groupname Change group host -c Exit after capturing count packets
file.txt owner of file.txt to
nmap Port scanning (TCP, UDP) count
groupname
ping/ping6 Send ICMP pings; Also -D Show available interfaces
chown Change user
checks latency -e Print link-level header on each
newowner:groupname owner and group
route Show/manipulate IP routing line
file.txt owner of file
table -F file Use file as filter expression
-f Suppress most
arp Show/manipulate ARP cache -L List data link types for interface
error messages
ip See ARP cache, neighbor -n Don't convert addresses to
-R Make changes
table, add routes names
recursively
nc Show various network info -p Don't capture in promiscuous
-H If cmd argument is
symbolic link, tcpdump Capture network traffic mode
traverse it dig Show various IP information -q Quick Output
-L Traverse every website -r file Read packets from file
symbolic link to a -s len Capture up to len bytes per
directory encoun‐ Netcat (nc)
packet
tered nc host port Connect to remote server(s)
-S Print absolute TCP seq numbers
-h Affect each nc -l Listen mode; listen for
-t Don't print timestamps
symbolic link IPaddress incoming connections
-w file Write captured packets to file
instead of any port
referenced file -y type Specify data-link type
-p Specify port number
Make note of the : -Z user Drop privileges from root to user
-v Verbose mode
-z Scan for open ports
Processes
-q Specify delay before closing
ps Show snapshot of current
connection
processes
-g Source-routing hop point(s)
top Show realtime processes
up to 8
kill pid Kill process with ID pid
pkill Kill process with name name
name