cd [directory] : change directorycd !$ : change directory to last argls [directory] : list files & directoriescp [src] [dst] : copy src to dstrm [file or directory] : remove file or directorymkdir [directory] : create directoryln -s [target] [symlink] : create a symlinkln [target] [hardlink] : create a hardlink (same inode)touch [file] : create empty file, mark file as newly editedsource [file] : execute a .sh file within the current shellcat [file] : print file to the screentree -a : print directory hierarchytail -n [num of lines] [file] : show last N lines of a filefile [file] : get file typestat [file] : get file info (modified, access, creation time)man [cmd] : show manual for cmdtldr [cmd]` : show short help for cmdpwd : show current directorywhich [cmd] : show where cmd is locatedfind : find filesfind [directory] -name [file] : find file in directoryfind [directory] -name *.[ext] : find all files of a given typefind [directory] -type f -exec grep "[text]" '{}' \; -print : find text in filesfind / -name "[pattern]" 2>/dev/null : find all and ignore errorssudo [cmd] : run a cmd as rootchmod [file] : change file permissionschown [owner]:[group] [file] : change the owner of a filegroups [user] : list groups of a usercat /etc/group : list all groupsexport [var]=[name] : set an env variableecho $[var] : print env variableecho $PATH : show system PATHexport PATH=$PATH:[directory path] : add directory to system PATHecho "export PATH=$PATH:[directory path]" >> ~/.bashrc : change the system PATH permanentlyssh -p [port] [user]@[ip] : login to SSHscp [src path] [user]@[ip]:[dst path] : copy file to remotescp [user]@[ip]:[src path] [dst path] : copy file from remotereboot : reboot systempoweroff : shutdown systemwget : ?tar -czvf [output file] [input dir] : create tar file (tar.gz)tar -xvf [input file] -C [output dir] : extract tar filezip : ?unzip : ?hexdump : dump file as hexafind . -name [file] | entr [cmd] : run a cmd whenever a file changestime [cmd] : time execution of cmdlsblk : list diskfdisk -l : disk infofdisk [disk] : partition diskmount [disk name] [directory] : mount diskumount [directory] : unmount diskcat /proc/mounts : mount infocat /etc/fstab : list mounted disksfastfetch : system infouname -a : show kernel versionlscpu : list CPU infolspci : list PCI devices (Bus:Device.Function)lsusb : list USB devicesnvidia-smi : show GPU infoifconfig : show network infosudo iftop -P : list TCP socketsnetstat -nat : list TCP socketsdu -shc * | sort -rh : show size of files in directorydu -sh [directory] : show size of directorydf : show disks usagefree -h --si : show how much RAMhtop : list process, kill processbtop : list process, kill processsensors : show temperaturewatch -t -n 1 "sensors | grep 'Core 0:'" : show CPU temperaturenmap -Pn -p- -v [ip] : find open portsstrace : trace syscallscat /proc/[pid] : procfs, running processescat /proc/meminfo : memory infocat /proc/cpuinfo : CPU info (CPUID)cat /proc/interrupts : interrupts incat /proc/ioports : IO portscat /proc/iomem : MMIOcat /proc/driver/nvidia/ : GPU infocat /proc/stat : all process statscat /proc/[pid]/stat : process statslsmod : list kernel modulescat /proc/modulesmodprobe [module] : load kernel module and dependenciesinsmod [module].ko : install kernel modulermmod [module] : remove kernel modulemodinfo -F [info] [module]: get info about kernel moduledmesg | tail -n 5 : show kernel logls -l /dev : list device filescat /proc/devices : list assigned device numbersmknod [device] c [major] [minor] : create character devicermnod [device]head -c 1 [file] : output the first byte of a file. : current directory.. : parent directory~ : home directory../relative/path : relative path/absolute/path : absolute pathA | B : run A and transfer its output to BA & B : run A then BA && B : run A then B only if A succeeds| grep [some string] : filter out stdout> : stdout< : stdin&> : stdout + stderr0> : stdin1> : stdout2> : stderr2>&1 : stderr to stdout, can use cmd | tee out.txt to also print on screen~/.bashrc~/.bash_profile~/.bashrc/proc : procfs, running processes/dev : udev, devices files/sys : sysfs, devices/bus/drivers/kernel/sys/bus/pci/devicesstat [file]1 2 3 4 5 6 7 | |
docker images : list imagesdocker ps -a : list containersdocker pull [image] : download image from docker registry (docker hub)docker rmi [image] : remove imagedocker image prune : remove untagged imagesdocker build -t [image] . : build image from Dockerfile--nocache : don't use cache--build-arg [var]=[value] : pass env varsdocker run -d --name [container] [image] : start container from image-d : run container in background-it : run container interactively-p [host_port]:[container_port] : open ports--restart=unless-stopped : start container when docker startsdocker rm -f [container] : stop and remove containerdocker logs -f [container] : check container stdoutdocker exec -it [container] /bin/bash : explore containerdocker inspect [container] : inspect containerdocker network ls : list docker networksdocker network prune : remove unused docker networksdocker scan [image] : check image for vulnerabilitiessudo systemctl status docker : check docker statussudo systemctl enable docker : start docker at boot