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

Tricksyhobbit1 - White Hat Commands in Linux

This document provides a cheat sheet of common Linux commands organized into categories such as navigation, file manipulation, permissions, processes and networking. It includes brief descriptions and examples of commands like ls, grep, chmod, killall, ifconfig and netcat.

Uploaded by

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

Tricksyhobbit1 - White Hat Commands in Linux

This document provides a cheat sheet of common Linux commands organized into categories such as navigation, file manipulation, permissions, processes and networking. It includes brief descriptions and examples of commands like ls, grep, chmod, killall, ifconfig and netcat.

Uploaded by

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

White Hat Commands in Linux Cheat Sheet

by Tricksyhobbit1 via cheatography.com/202578/cs/43236/

General Navigation and Bash Commands grep File Manipu​lation (cont)

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 insens​itive file2

rmdir Remove directory search cp - Backup (doesn't support argument)


directory -r Recursive search b

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 direct​ories recurs​ively
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 distro​bution u newer than destin​ation file or when
whereis Find binary source manual
/etc/issue destin​ation file is missing
command for command
man Show manual​/in​for​mation for
locate file Find file with quick search
command specified command Permis​sions (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 Manipu​lation
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 direct​ories
chmod Adds the "​rea​d" ability to "​oth​er"
-1 One file per line rm -f Ignore nonexi​stent files
o+r file users
-m Comma-​sep​arated output rm -i Prompt before every removal
chmod Removes the "​rea​d" ability from
-Q Quoted output rm -I Prompt once before removing more
o-r file "​oth​er" users
than 3 files
rm -r Remove direct​ories and their
contents recurs​ively

By Tricksyhobbit1 Published 17th May, 2024. Sponsored by ApolloPad.com


Last updated 17th May, 2024. Everyone has a novel in them. Finish
Page 1 of 2. Yours!
https://apollopad.com
cheatography.com/tricksyhobbit1/
White Hat Commands in Linux Cheat Sheet
by Tricksyhobbit1 via cheatography.com/202578/cs/43236/

Permis​sions (chmod) (cont) Processes (cont) Netcat (nc) (cont)

chmod Adds rwx permis​sions to all killall Kill all process with names -n Numeri​c-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
exp​lai​nation for any help unders​tanding 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 namese​rvers and IP
owner of file to Addresses tcpdump
newowner
traceroute Shows routing inform​ation 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/m​ani​pulate IP routing line
file.txt owner of file
table -F file Use file as filter expression
-f Suppress most
arp Show/m​ani​pulate 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
recurs​ively
nc Show various network info -p Don't capture in promis​cuous
-H If cmd argument is
symbolic link, tcpdump Capture network traffic mode
traverse it dig Show various IP inform​ation -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 connec​tions
-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​-ro​uting hop point(s)
top Show realtime processes
up to 8
kill pid Kill process with ID pid
pkill Kill process with name name
name

By Tricksyhobbit1 Published 17th May, 2024. Sponsored by ApolloPad.com


Last updated 17th May, 2024. Everyone has a novel in them. Finish
Page 2 of 2. Yours!
https://apollopad.com
cheatography.com/tricksyhobbit1/

You might also like