Windows
Common Commands
cd <directory> enter directory use %userprofile% to enter your own directory
dir <directory> displays a list of a directory's files and subdirectories
md <directory> create directory use "" if directory has space
rd <directory> remove directory (must be empty); use /s to remove non-empty directory
move <file> <directory> move a file into a subdirectory
move <file> .. move a file into the parent directory
del <file> delete a file
copy <from_file> <to_file> copy a file
ren <from_file> <to_file> rename a file
type <text_file> view text file
attrib <file>+<attribute> add attribute
attrib <file> -<attribute> remove attribute
dir /A:H list hidden file
tasklist show tasklist
taskkill kill a process
ipconfig displays network configuration; use /all to get more details
netstat
ping <ip/dns> test conectivity
tracert <ip/dns>
echo <text> > <file> write text to text file
Alternate Data Streams (ADS)
dir /r
Users
net user <name> /add add user
net user <name> <password> add user and assign password
net user <name> * add user and prompt password
net user <name> /delete delete user
net user <name> /active:no disable user
net user <name> /active:yes enable user
net accounts
Groups
Administrators
Network Configuration Operators
Users
net localgroup <name> list the contents of a group
net localgroup <name> /add create a group
net localgroup <name> /del delete a group
net localgroup <name> <user_name> /add add a user to a group
net localgroup <name> <user_name> /del remove a user to a group
runas /user:<user_name> <app_name> run the app using a certain person credential
Discretionary Access Control Lists (DACLs)
Linux
Common Commands
| (piping) send output as input to another command
cd <directory> enter directory use ~ for home directory
ls list directory contents
-a show hidden file
-l show additional information
-la show hidden file and additional information
pwd print current working directory
mkdir make directory
rm remove file or empty directory; use -r to remove non-empty directory
cp copy files or directories
mv move or rename files or directories
stat view detailed information of a file
ps display renning processes
netstat display TCP and UDP connections on the system [Cancel with Control + C]
ifconfig interface config, such as IP address
su temporarily switch to a different user.
ping test conectivity
whoami return the username of the current user
echo display a string
expr integer math calculation (must seperate each term by space)
find <directory> Find didrectories and files that meet specified conditions
-name <condition> case-sensitive; use * for wilecard
-iname <condition> not case-sensitive
Files
cat <file> displays the content of a file
head <file> displays just the beginning of a file, by default 10 lines.
tail <file> displays just the last few lines of a file, by default 10 lines.
less <file> displays the content of a file one page at a time.
grep <string> <file> displays all lines containing a specific string in a file.
touch <file> create a file
>> redirect output to file
cmp find the first difference of two files
Advanced Package Tool (APT)
sudo apt install <app_name> Install an application
sudo apt remove <app_name> remove an application
apt list --installed list all installed application
tcpdump
networksetup -listallhardwareports
other
tr characters mapping
Extra
sha256 hashing algorithm
Mandatory Integrity Controls (MIC)
System
High
Medium
Low