terminal
Frequently used shell commands for file navigation, permissions, networking and more.
System Information
Getting information about the system.
Display system details
Output host configuration and kernel version.
uname -asysteminfoMonitor running processes
Open interactive resource usage dashboard.
toptaskmgrList active processes
List running processes with their IDs and resource usage.
ps auxtasklistSearch processes by name
Find process IDs and names matching a search term.
pgrep -ifl <search-term>pgrep -ifl chromeGet-Process | Where-Object { $_.ProcessName -like "*<search-term>*" }Get-Process | Where-Object { $_.ProcessName -like "*chrome*" }Terminate processes by name
Send a termination signal to matching processes.
pkill <process-name>pkill chromeStop-Process -Name <process-name>Stop-Process -Name chromeTerminate processes by command line
Terminate processes whose command lines match a pattern.
pkill -f <search-term>pkill -if chromeGet-CimInstance Win32_Process | Where-Object { $_.CommandLine -like "*<search-term>*" } | ForEach-Object { Stop-Process -Id $_.ProcessId }Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -like "*chrome*" } | ForEach-Object { Stop-Process -Id $_.ProcessId }Force terminate processes
Force-stop processes that do not terminate normally.
pkill -9 <process-name>pkill -9 chromeStop-Process -Name <process-name> -ForceStop-Process -Name chrome -ForceTerminate process by PID
Terminate a specific process using its ID.
kill <PID>kill 1234Stop-Process -Id <PID>Stop-Process -Id 1234Check disk space usage
Display storage volume capacity and availability.
df -hGet-PSDriveMeasure folder size
Calculate total disk space consumed by a directory.
du -sh DocumentsGet-ChildItem Documents -Recurse | Measure-Object Length -SumCheck service status
Query the current operational state of a service.
systemctl status nginxlaunchctl print system/nginxGet-Service nginxRestart system service
Stop and start a system service daemon.
systemctl restart nginxlaunchctl kickstart -k system/nginxRestart-Service nginxFile Permissions and Ownership
Managing file access rights and ownership.
# chmod numeric permissions overview:# Each digit represents permissions for: [Owner][Group][Others]# Add values for read(4), write(2), execute(1)## Examples:# 7 = 4+2+1 = read, write, execute# 6 = 4+2 = read, write# 5 = 4+1 = read, execute# 4 = 4 = read# 3 = 2+1 = write, execute# 2 = 2 = write# 1 = 1 = execute# 0 = none## Common chmod values:# 755 = rwx for owner, rx for group, rx for others# 644 = rw for owner, r for group, r for others# 700 = rwx for owner, none for group/othersModify file permissions
Update numerical or symbolic access mode bits.
chmod 644 myfile.txticacls myfile.txt /setintegritylevel mediumMake file executable
Grant execution rights to a script file.
chmod +x script.shUnblock-File -Path script.ps1Change owner and group
Reassign file ownership to a user and group.
chown user:staff myfile.txticacls myfile.txt /setowner "Domain\User"View detailed file status
Inspect low-level file metadata and status properties.
stat myfile.txtGet-ItemProperty myfile.txtArchiving and Compression
Creating and extracting tarballs and zip files.
# tar common flags overview:# c = create new archive# x = extract archive# v = verbose (show files being processed)# f = specify filename of archive# z = compress with gzip (.tar.gz)# j = compress with bzip2 (.tar.bz2)# J = compress with xz (.tar.xz)## Examples:# tar -cvf archive.tar files/ -> create tar# tar -xvf archive.tar -> extract tar# tar -czvf archive.tar.gz dir/ -> create gzipped tar# tar -xzvf archive.tar.gz -> extract gzipped tarCreate tar archive
Package files into an uncompressed archive container.
tar -cvf archive.tar myfolderExtract tar archive
Unpack files from a tar container.
tar -xvf archive.tarCreate compressed tarball
Package and gzip compress a directory structure.
tar -czvf archive.tar.gz myfolderExtract compressed tarball
Unpack and decompress a gzipped archive file.
tar -xzvf archive.tar.gzCreate zip archive
Compress files into a standard zip format.
zip archive.zip myfile.txt myfolder/*Compress-Archive -Path myfile.txt, myfolder -DestinationPath archive.zipExtract zip archive
Decompress files from a zip archive container.
unzip archive.zipExpand-Archive -Path archive.zip -DestinationPath .