2026-07-16 13:54 Tags: Windows Commands Linux Commands Bash Powershell Scripting Command Line Docker Directory Services Important Reference User Management Filesystems Guide Git Version Control
Command Line Reference
🪟 Windows (PowerShell)
Navigation & Directory Basics
| Command | Fields / Flags | Description |
|---|---|---|
cd | path (same as Linux) | Change directory. Also works with cd ..\Desktop or cd ~Desktop |
pwd | none | Print working directory |
ls | path (optional), same flags as Linux | List directories/files inside the current directory |
Get-ChildItem | directory | Same as ls shorthand |
mkdir | directory name | Make a new folder in the current directory |
clear | none | Clear the current terminal screen |
history | none | List of every command you’ve run |
Files & Content
| Command | Fields / Flags | Description |
|---|---|---|
cp | copied path, pasting path, -Recurse (copy inner contents), -Verbose (confirm copy) | Copy a file/folder to another directory. Supports wildcards like *.jpg |
mv | copied path/filename, pasting path | Move a file/folder to another location |
rm | path of item, -Force (bypass permission prompts) | Remove/delete the specified item |
cat | path of file, -Head (first x lines), -Tail (last x lines) | Dump the contents of a file to the screen |
more | path of file | Dump file contents one screen at a time — good for large files |
echo (Write-Output) | echo woof > dog.txt (new file) echo woofTwice >> dog.txt (append) | Create files, write content to them, or print to terminal |
sls (Select-String) | search string, directory, -Filter (narrow results, supports *.txt) | Search for file names, file contents, or other items in the filesystem |
Compress-Archive | path to directory, path to new zipped, -path | Used in order to compress documents via the command line |
Expand-Archive | Expand-Archive -Path C:\Data\Archive.zip -DestinationPath C:\Data\Extracted | Used to extract the given data in zip file |
Help & Info
| Command | Fields / Flags | Description |
|---|---|---|
Get-Help | command name, -Full (more detail), -Force (show hidden) | General help/direction for a given command |
Get-Alias | command name | Show the full PowerShell name for a shorthand command |
Diskpart & Managing Disks
| Command | Fields / Flags | Description |
|---|---|---|
Diskpart | none | Opens another CLI window that lets you use diskpart and it’s commands |
list disk | none | lists your current disks connected to that OS |
select disk x | none | Lets you select the disk you are working in |
clean | none | Cleans / empties out the disk for you |
create partition primary | none | Creates a primary partition on your disk current disk |
select partition x | none | This allows you to go into the partition that you just created or went into |
active | none | marks your partition as active |
format | FS=<filesystem, label=<name>, quick | This basically formats your partition on that drive with the filesystem you want |
chkdisk | /F, disk | Basically, without the /F flag, it will run only in read only mode and report what is wrong on the disk, otherwise it will try and fix the issue |
Users, Groups & Permissions
| Command | Fields / Flags | Description |
|---|---|---|
Get-LocalUser | none | List every account on the machine, with enabled/disabled status |
Get-LocalGroup | none | List all groups on the local machine |
Get-LocalGroupMember | group name | List all users belonging to a given group |
Remove-LocalUser | username | Remove a user from the computer/group |
net user | net user <username> 'password' | Change a user’s password |
net user | net user <username> /logonpasswordchg:yes | Force password change at next logon |
net user | net user <username> * /add or /del | Add or remove a user |
icacls | path to file/directory | Show user permissions for that item. Use icacls /? for a key |
icacls | icacls 'Path\To\Dir' /grant 'Everyone:(OI)(CI)(R)' | Grant permissions (use /remove to revoke) |
Networking
| Command | Fields / Flags | Description |
|---|---|---|
Test-NetConnection | host, port | Netcat equivalent for Windows |
| Telnet lookup | varies — search for your specific use case | Go-to tool for diagnosing internet issues on Win11 |
pscp.exe | pscp.exe <filepath> user@IPAddress | Allows for the use of the Secure Copy Protocol to copy files remotely between desktops |
net share | net share ShareMe=<filepath> /grant:everyone,full | This creates a shared folder that everyone on the network can access |
Windows Update / Package Install Switches
| Switch | Description |
|---|---|
/extract <path> | Extract package contents to the given folder |
/log <path> | Enable verbose logging to a log file |
/lang:lcid | Set UI to a specified locale when multiple are available |
/quiet | Run the package in silent mode |
/passive | Run the update with no user interaction |
/norestart | Prevent prompting the user to restart |
/forcerestart | Force a restart as soon as the update finishes |
Installing & Managing Packages
| Command | Fields / Flags | Description |
|---|---|---|
Find-Package | Find-Package sysinternals -IncludeDependencies | Basically helps you to find the given package that you are looking for, and the include dependencies flag also then lets you see the dependencies for that package |
Install-Package | Install-Package -Name sysinternals -Source <sourcename> | Used to install a piece of software and it’s given dependencies |
Get-Package | Get-Package -name sysinternals | This basically verifies that the package that you installed is actually on your system |
Uninstall-Package | Uninstall-Package -Name sysinternals | This would then uninstall the package |
Active Directory Administrative Center Commands
| Command | Fields / Flags | Description |
|---|---|---|
New-ADGroup | -Description:"desc" -GroupCategory:"Text" -GroupScope"Text" -GroupSamName | This creates a new group inside of the current domain you are in inside of the ADAC for a given admin account, see SAIIS - Module 4 - Directory Services for more details about this service |
Add-Computer | -DomainName 'example.com -Server 'dc1' | This will connect a computer to the Active Directory service, which will give it it’s own computer account and configure the computer for AD authentication |
Get-AdForest | none | Tells you a lot of the information about your Active Directory, including your current version |
Get-AdDomain | none | Gets information about your domain, including a LOT of its like inner domains, names, and much more, this way you can see what AD features you support |
Resolve-DNSName | -Type SRV -Name _ldap._tcp.dc._msdcs.DOMAIN | This is basically a way to make sure that the current computer that is having trouble logging on to the AD is in fact able to get the needed SRV record to connect to the domain controller |
Senv:LOGONSERVER | none | contains the name of the domain controller variable to see what domain controller a given computer is attached to AD by |
gpresult | /R, /H test.html /s /u /p /r /z | Prints out a log of a report that deals with the heal of your AD and whether or not they might be in sync and other information |
gpedit | none | The Group Policy Editor, which is a robust tool for changing Registry settings related to the Control Panel, Settings, user profiles, system configurations, third-party software, and more. |
gpupdate | Command that can be used to force a new or edited GPO to be applied immediately using the /force switch. |
Managing Windows Processes
| Command | Fields / Flags | Description |
|---|---|---|
taskkill | taskkill /pid <processID#> | This stops a given process that may be running, can be used if a process is not responding or the ‘x’ button for it is not working. Windows Documentation |
tasklist | none (or name probably) | shows all of the running processes and their process identification number on your current system |
Get-Process | none (or name probably) | Does the same thing as tasklist but just inside of Powershell and not the cmd |
Get-Process | Get-Process \| Sort CPU -descending \| select -first 3 -Property ID, ProcessName, CPU | Basically a way for you to look for specific items inside of the command line that might be taking up whatever resource you are looking for. You get all the process info, pipe it into Sort with the flags, then with Select you get the first 3, and dictate the data you want displayed |
Get-Service | Get-Service <OptionalServiceName> | This would print out the given status, name, and display name of the windows service that you wish to view |
Get-Service | Get-Service <serviceName> \| Format-List * | This will showcase more information about any service that you are trying to look for |
Stop-Service | the service name | This would then obviously stop the service |
Start-Service | the service name | This starts the service back up again |
Set-Service |
Miscellaneous
| Command | Fields / Flags | Description |
|---|---|---|
Start-Transcript | Start-Transcript -Path C:\path\to\dir | This will start a recording of your current terminal session, and record all of the commands you put in, useful for recording logs of what you are doing |
Stop-Transcript | none | Ends the recording of your CLI for that given session |
🐧 Linux (Bash)
Navigation & Directory Basics
| Command | Fields / Flags | Description |
|---|---|---|
cd | path | Change directory, or cd .. to go back |
pwd | none | Print working directory |
ls | -l, -a, or none | List directory contents in a given format, or include hidden files |
dir | none | List all current directories |
mkdir | directory path/name | Make a new directory |
clear | none | Clear the current terminal screen |
history | none | List of every command you’ve run |
Files & Content
| Command | Fields / Flags | Description |
|---|---|---|
cp | copied path, pasting path, -r (recursive) | Copy a file/folder to another directory. Supports wildcards like *.jpg |
mv | copied path/filename, pasting path | Move a file/folder to another location |
touch | filename | Create a new file in the current directory |
rm | path of item | Remove/delete the specified item |
nano | filename/path | Open the file in the terminal text editor |
cat | path of file | Dump the contents of a file to the screen |
less | path of file | View file contents one page at a time (Windows’ more equivalent) |
head | path of file | Show the first 10 lines of a file by default |
tail | path of file | Show the last 10 lines of a file by default |
echo | path (optional) | Write to a file (echo "hello" >> file.txt) or print to terminal. Also prints file contents, and can pipe output into another command with \|, e.g. ls -la /etc \| grep bluetooth |
dpkg | path of file | Used to install .deb packages, use -i flag for installation, -r flag for removing, -l for listing all installed packages |
7z | 7z x "nameOfZipped" -o"FolderToBeCreated" | used to extract files with the 7-Zip software, note for extraction you use just e not -e, the -o also creates the directory you want to extract to |
| 7 z | 7z a -sdel archive.7z /path/to/file_or_folder | The a tag lets you archive the given file, the -sdel lets you delete the archiving file while it is being compressed, there is also a -mx=9 which is a maximum compression alg that is better but takes longer |
tar | path of file | used to also extract files, check Here for more information |
uname | -r (kernel version) | tells you the current kernel you have |
ln | -s, filepath, new filepath of link | This creates a hard or soft link to a given file in basically another file, the -s flag can be used to create a softlink, or it can be left out to create a hardlink |
a2ensite | sudo an2ensite 001-websitename.conf | This is basically just a short cut to manage the available website configurations inside of the /etc/apache2/sites-enabled portion of the apache 2 web service. It also has a2dissite |
unrar | unrar x archive.rar "/path/to/destination" | used for .rar files |
Search
| Command | Fields / Flags | Description |
|---|---|---|
grep | search term, location | Search for file names, directory names, or file contents |
man | command name | Manual page for a given command |
wc | grep -o "text" file.txt \| wc -l | Count occurrences of a word/pattern in a file |
Linux Management of Processes
| Command | Fields / Flags | Description |
|---|---|---|
htop | none | The fucking goat, basically gives you a lot of system information about your current proccesses, and allows you to view information about them. Also great for searching through proccesses and killing them |
ps | -x | It shows you a current snapshot of the processes that you have running on your system, the first thing is the PID, TTY is the terminal associated with the process, next is the process status, cpu time it takes it up |
ps | -ef | Gets all of the processes from all users, it gives a lot of process details as well, such as PID, PPID, the time, the STIME, and more |
kill | PID, -KILL, -TSTP, -CONT | terminates whatever given process you pointed it to with the PID, the -KILL flag is used to terminate the process without giving it time to release it’s resources, the -TSTP flag suspends the process, -Cont then continues that same stopped process |
lsof | none | Lists all of the open files on the OS and what processes are using them |
service | service <name> status | This command allows you to check which background daemons are running on your device |
systemctl | status, start, stop, restart, reload, enable | This i believe is the more modern version of the service command, and is used like this systemctl status <service> |
systemctl | systemctl list-units | This basically showcases all of the active and inactive services |
systemctl list-units --type=service --all |
Users, Groups & Permissions
| Command | Fields / Flags | Description |
|---|---|---|
sudo | any command | Run a command as root/admin |
su | account name | Switch to that account (sudo su -i switches to root) |
passwd | username, -e (expire password, forces change at next login) | Change a user’s password |
useradd / userdel | username (requires root) | Add or delete a user; often paired with -e to expire the password |
chmod | u/g/o + perms (r, w, x) | Change read/write/execute permissions for owner, group, or others |
chmod | numeric, e.g. chmod 754 <filepath> | Set permissions numerically — 4=read, 2=write, 1=execute (add together, e.g. rwx = 7) |
chown | username, filepath | Change the owner of a file |
chgrp | group name, filepath | Change which group a file belongs to |
usermod | -h for help bro,theres a lot | change the user that a group is in, their given perms maybe, as well as their given information on the system |
cat | cat /etc/passwd | Shows all of the given users on a system |
Networking
| Command | Fields / Flags | Description |
|---|---|---|
ping | IP address | Test connectivity with a given address |
nc (netcat) | host, port | Scan ports on a network |
nslookup | DNS site name | Test DNS servers |
traceroute | IP address | Show every hop your IP datagram makes |
scp | scrp <filepath> user@IPAddress | Transfers files between computers on the same network |
ssh | <username>@<IPAddress> | Allows you to log into a desktop’s CLI remotely given you have the proper credentials and both devices have SSH installed |
dig | dig www.example.com localhost | Basically lets you see more information about DNS queries to your own DNS server? I am not entirely sure what this does |
speedtest-cli | none | tests your download and upload speeds to see your internet metrics |
sftp | username@IP | Basically lets you transfer files over a network as long as both machines have openssh-server installed, use put sourcepath destinationpath or the same but with get, -r flag for directories DON’T USE QUOTES |
tcpdump | sudo tcpdump -i eth0 | Allows you to monitor given packets on your network, ones incoming to your computer at least. See ISDADDA - Module 4 -Securing Your Networks for more information. For more detailed analysis, use the -v & -n flags, for verbose output and not replacing ip addresses with DNS names |
tcpdump | sudo tcpdump -i eth0 -vn host 100.1.4.3 and port 8080 & | This would be if you want to retrieve specific packets as the source or destination IP address, so if you want to only get specific packets from that IP |
Disks And Partitioning
| Command | Fields / Flags | Description |
|---|---|---|
parted | -l | used to showcase what disks/partitions you might currently have on your system, it also tells you your type of partition table |
parted /dev/sdx | none | This opens up the parted tool for you to be able to manage your disks |
print | none | shows you the data for your current drive inside of the parted tool |
mklabel | gpt | This labels your drive with the GPT partition table label |
mkpart | type of partition, filesystem, start of disk, end of disk | This basically makes a partition on your drive given the following fields typed in |
mkfs | sudo mkfs -t ext4 /dev/sda | Basically make it that specific filesystem |
mount | filepath of drive, file of directory to mount | Mounts a given drive file onto a folder so that way you can start reading and writing data over to those drives |
umount | filepath of drive, filepath of directory to unmount | Unmounts a given drive file away from a folder |
blkid | none | gives you the UUID for each of the block / hard drive devices that you have on your computer |
mkswap | your swap partition | basically, since swap is not a file-type system, you have to specifically tell the OS to make it different |
swapon | swap parition | this enables this partition as your swap memory |
du -h | directory | shows the disk usage of a given directory |
df -h | directory | used to see how much space you have available on your entire system |
fsck | -n (no to all), -p (no minor issues), -y (yes to all), -f (fast), | make sure that the partition you are trying to run this for is NOT mounted, it might damage the filesystem |
wipefs | -a | clears your drive, overriding it all with unallocated space |
HOW TO SET UP A DRIVE
1. sudo wipefs -a /dev/sdb
2. sudo parted /dev/sdb mklabel gpt
3. sudo parted /dev/sdb mkpart primary ext4 0% 100%
4. sudo mkfs.ext4 /dev/sdb1
Proxmox and VM management
| Command | Fields / Flags | Description |
|---|---|---|
qm set | qm set <VMID> -scsi1 /dev/disk/by-id/<your-disk-id> | Points over the id of the HDD that you have plugged into your host hypervisor over to the given ID, letting it be seen by that guest |
qm config | qm config <VMID> | Shows the configurations for that vm |
qm -help | none | shows all of the given inputs for the qm command |
| none | ls -l /dev/disk/by-id/ | The directory in which the disk id values live, these are used above to mount the disk to a given drive |
qm stop | qm stop <VMID> | stops a vm, also has things like reset start reboot and more |
| none | qm set 101 -delete scsi1 | Deletes that given drive entry inside of that vm’s configuration |
qm list | none | shows that computers virtual machines, if they’re running, and their ID |
smartctl -a /dev/sdb \| grep -i temperature | smartctl -a /dev/sdb \| grep -i temperature | Check Drive them, use lsblk to see what the sdx of a drive is |
OpenLDAP for Directory Services
| Command | Fields / Flags | Description |
|---|---|---|
sudo apt install slapd ldap-utils | none | Basically installs the ldap services on your given device, you will need to type in an admin password |
sudo dpkg-reconfigure slpad | none | This will let you reconfigure your given settings for LDAP, openldap. org. |
ldapadd | something | Takes in the input of an LDIF file, see SAIIS - Module 4 - Directory Services, and adds the context of the files |
ldapmodify | something | modifies an existing LDAP object |
ldapdelete | something | removes the object that the LDIF file refers to |
ldapsearch | something | will search for entries in your directory database |
Miscellaneous
| Command | Fields / Flags | Description |
|---|---|---|
script | script session.log | This will start a recording of your current terminal session, and record all of the commands you put in, useful for recording logs of what you are doing |
ansi2txt | cat session.log \| ansi2txt clean_log.txt | Basically, the script command stores the data in ANSI format, for a readable format, you can use this to convert the log file to ASCII |
| ansi 2 html | ansi2html < log > outputfile | Basically the same as ansi2txt but instead of ASCII, it converts the ANSI format to html data |
😸 Git / Github (CLI)
| Command | Fields / Flags | Description |
|---|---|---|
git add | git add . & git add -A | This basically adds all unrecognized files in your current repository to the staging area |
git reset | git reset --hard HEAD | this basically resets ANY changes in current working directory and can be used to “un-add file(s)” The head one permanently deletes all uncommitted changes in both staging area and working directory |
git branch | git branch git branch <newBranch> git branch -d <branchName> | This one allows you to mess with branches, the first one lets you see your current list of branches, the second lets you make a new branch, the first deletes a branch |
git checkout | git checkout <branchName> | Lets you switch between current branches |
git clone | git clone <repoURL> | Allows you to copy and online repository over to your local machine |
git pull | git pull origin main | This basically fetches any changes from a remote repository and merges them into your local branch, so you switch to the branch you want to merge with with git checkout and then run this there |
git push | git push origin <branchname> | Basically lets you upload your local repository code into the remote repository. generally, the longer way is only done on a first commit connection, you can use git push as long as you’re in the same branch |
git version | NONE | Shows the version of git installed on your machine |
git diff | git diff git diff HEAD-1 HEAD git diff <branch1> <branch2> | This one shows the different and changes between commits. The first one is between working dir and last commit. The second between last and second-last commit. The last compares specific branches |
git revert | git revert HEAD | This basically reverts a commit by applying a new commit, and this is a commit that undoes the changes made by the last commit |
git config | git config -global user.emal <yourEmail> | This basically sets your global email configuration for github which needs to be done before you connect yourself over to the github site for your account |
git config | git config -global user.name <yourUser> | This, like the email, basically lets you set your username for your github |
git remote | git remote -v | This lists the name of all remote repositories associated with your local repository, the -v flag basically gives you the links |
git remote | git remote add origin <URL> | This allows you to connect over a remote repository to your current local repository, so you can upload changes over to it |
git remote rename | git remote rename origin upstream | The remote rename command is followed by the name of the remote repository you want to rename an the new name (upstream) you want to give it |
git remote rm | git remote rm <name> | It removes a remote repository with the specified name |
git format-patch | git format-patch HEAD-3 | This generates patches for email submission. These patches can be used for submitting changes via email or sharing them with others |
git request-pull | git request-pull origin/main <myFork or BranchName> | This basically generates a summary of pending changes for an email request. It helps communicate the changes made in a branch or fork to the upstream repository maintainer |
git send-email | git send-email *.patch | It sends a collection of patches as emails, and allows you to send multiple files to different people via email. |
git am | git am <patchfile.patch> | This applies patches to the repository, it takes the patch file as input and applies the changes it requires |
git daemon | git daemon -base-path=/path/to/repos | This exposes repositories with the Git://protocol which is a lightweight protocol designed for efficient communication between Git clients and servers |
git instaweb | git instaweb -httpd=webrick | This instantly launches a web server to browser repositories. it provides a simple way to view repo contents through a web interface without the need for configuration of a full web-server |
git rerere | NONE | It resuses recorded resolution of previously resolved merge conflics. You need to enable it using git config --global rerere.enabled true |
git switch | git switch <branchName> | Allows you to move between branches or even create and switch to a new branch in a simple and easy way |
git restore | git restore <file>, git restore -staged <file>, git restore -source <commit> <file> | This discards/resets changes in files by restoring them from the staging area or a specific commit |
gh auth login | gh | This is used to authenticate your Github account inside of the Github CLI, it lets you log in with either the web browser or a token so you can SECURELY use github features |
🐳 Docker & Docker-Compose
| Command | Fields / Flags | Description |
|---|---|---|
| installation | curl -fsSL https://get.docker.com -o get-docker. sh | Downloads docker into your current directory, basically lets you run the .sh script to get docker up and running |
docker | --version, compose version | check to see if the installation was correct by checking to see your docker versions |
docker run | hello-world | Sets up a small container to test that docker is actually working and can run containers, also showcases sort of how docker works |
docker compose | docker compose up -d | This will run the docker image after editing the yaml |
docker ps | none | This will verify if a container is running :3 |
docker restart | the given docker container name or id | Restarts the container (obviously) |
docker stats --no-stream obsidian-natan | Basically a way to see the CPU and RAM usage of a given container | |
read | read -s -p "Enter CouchDB admin password: " COUCHDB_PASS | Basically a way to set up variable values in bash |
docker restart | docker restart $(docker ps -a -q) | restart all containers running at once |
docker images | none | Lists all of the given images made from DockerFiles in your computer |
docker push | dockr push <yourappname> | This stores images in a configured registry, letting you pull them later on other devices |
docker pull | docker pull nginx | This lets you pull images from that exact registry |
docker build | docker build -t <appname> /path/to/dockerfile | This here builds an image from a DockerFile in a specific directory |
docker container rm | docker container rm <containername> | Removes a given container from your system |
| see | Docker Compose and yaml Setups | for more reference on containers and configs |
| see | CDKO - Module 1- Containers and Containerization | For how to set up something like a DockerFile and how they work and play and all of the good stuff |
Kubectl / Kubernetes
| Command | Fields / Flags | Description |
|---|---|---|
