Terminal commands and tools
Commands#
-
lsb_release -a- distro info -
printenv- list all environment variables -
where- Reports all known instances of a command. It could be an executable in the PATH environment variable, an alias, or a shell builtin. -
whereis- Locate the binary, source, and manual page files for a command. -
which- Locate a program in the user’s path. -
whatis- Display one-line descriptions from manual pages. -
locate- find files by name, quickly -
stat: Displays file or file system status, providing detailed information.stat <filename>stat -f <path_to_filesystem_mount_point>
-
file: show file information -
lsof(List Open Files): Lists information about files opened by processes. https://linux.die.net/man/8/lsof ↗lsofsudo lsof -i :<port_number>(e.g.,sudo lsof -i :22)
Disk Info#
lsblk- disk/partition infodf- shows storage info
HW info#
-
lshw: List Hardware. Provides detailed information about the machine’s hardware configuration. https://linux.die.net/man/1/lshw ↗sudo lshwsudo lshw -c <class>(e.g.,sudo lshw -c cpu,sudo lshw -c memory,sudo lshw -c network,sudo lshw -c disk)
-
lspciandlsusbto list PCI and USB devices, respectively. -
dmidecodeto retrieve information from the DMI/BIOS
System Management#
-
top- display linux processes -
journalctl- view logs -
journalctl -u [service]- view logs of a specific service
-
journalctl -fu [service]- follow mode. (live)’
-
watch: Executes a program periodically, showing its output and errors. https://linux.die.net/man/1/watch ↗watch [options] <command>(e.g.,watch -n 0.5 nvidia-smi)
-
systemd-analyze blame: Prints a list of all running units, ordered by the time they took to initialize during boot. https://www.freedesktop.org/software/systemd/man/systemd-analyze.html ↗systemd-analyze blame
-
systemd-analyze critical-chain: Prints a tree of the time-critical chain of units during boot. https://www.freedesktop.org/software/systemd/man/systemd-analyze.html ↗systemd-analyze critical-chain [unit_name...]
Tools#
z(zoxide): A smarter cd command that learns your frequently and recently used directories. https://github.com/ajeetdsouza/zoxide ↗z <partial_directory_name>zi(Interactive selection)
fzf(Fuzzy Finder): A command-line fuzzy finder for interactively filtering lists. https://github.com/junegunn/fzf ↗history | fzf(Search command history)ls | fzf(Find a file in the current directory)
exa: A modern replacement for ls with more features like colors, tree view, Git integration, and icons. https://github.com/ogham/exa ↗exaexa -l(Long format)exa -T(Tree view)
bat: https://github.com/sharkdp/bat ↗eza: https://github.com/eza-community/eza ↗ncdu: Disk usage analyzer with an ncurses interface. It helps you see which directories and files are consuming the most space. https://dev.yorhel.nl/ncdu/man ↗ncdu(Navigate with arrow keys, see sizes, delete files/directories)
duf: Disk Usage/Free utility. Provides a user-friendly, colorized overview of mounted filesystems and their usage. https://github.com/muesli/duf ↗duf
rsync- transfer and sync filesrg(ripgrep): A very fast, line-oriented search tool that recursively searches your current directory for a regex pattern. https://github.com/BurntSushi/ripgrep ↗rg <pattern> [path](e.g.,rg "my_function",rg "def ",rg "API key")
fd: A simple, fast, and user-friendly alternative to find. https://github.com/sharkdp/fd ↗fd <pattern>(Searches recursively and case-insensitively by default)
glances: A cross-platform system monitoring tool displaying a large amount of system information. https://nicolargo.github.io/glances/ ↗glances
iotop: A top-like utility for displaying I/O usage by processes. https://github.com/dgibson/iotop ↗sudo iotop
dstat: A versatile replacement for vmstat, iostat, netstat, and ifstat for viewing system resources. https://github.com/dstat-team/dstat ↗dstatdstat -tcmsdn(Time, cpu, memory, swap, disk, network)dstat --top-cpu
progress: Monitors the progress of coreutils basic commands like cp, mv, dd, tar, etc. https://github.com/Xfennec/progress ↗progress(Run in a separate terminal while another command is active)
direnv: https://direnv.net/ ↗- kubectx and kubens: https://github.com/ahmetb/kubectx ↗
- iperf3: https://iperf.fr/ ↗
Networking#
tcpdump: https://www.tcpdump.org/ ↗termshark: A terminal user interface for tshark (Wireshark’s command-line version) to analyze network traffic. https://github.com/gcla/termshark ↗sudo termsharksudo termshark -Y "dns"(Filter for DNS traffic)
dog: A command-line DNS client, often user-friendly and feature-rich. https://github.com/ogham/dog ↗dog <domain_name> [record_type]
ipcalc: Performs IP subnet calculations. https://github.com/border/ipcalc ↗ipcalc <IP_address>[/CIDR_or_netmask](e.g.,ipcalc 10.7.8.94/18)
mtr(My Traceroute): Network diagnostic tool combining ping and traceroute functionality, showing route and performance. https://www.bitwizard.nl/mtr/ ↗mtr <hostname_or_IP>
misc#
jq: https://jqlang.github.io/jq/ ↗cmatrix: https://github.com/abishekvashok/cmatrix ↗wormhole(magic-wormhole): A tool to securely transfer files and directories between computers using a “wormhole code”. https://github.com/magic-wormhole/magic-wormhole ↗- Sender:
wormhole send <filename> - Receiver:
wormhole receive <code>
- Sender:
mosh(Mobile Shell): A remote terminal application for robust connections, supporting roaming and intermittent connectivity. https://mosh.org ↗mosh [user@]hostname(Requires Mosh on client and server)
- we can use the tool pimpmykali ↗ to update and setup our kali instance