Linux komandu saraksts
Linux komandu saraksts ar argumentiem un kategoriju filtru.
| Komanda | Kategorija | Līmenis | Apraksts | Galvenie argumenti |
|---|---|---|---|---|
| ls | Faili | core | List directory contents with metadata | -l long format with permissions -a include hidden files -h human-readable sizes -R recursive listing -t sort by modification time -S sort by file size |
| find | Faili | core | Search files by name, type, size, or mtime | -name match by filename pattern -type f=file d=dir l=link -size +/-N[k/M/G] -mtime N days ago modified -exec run command on result -maxdepth limit recursion |
| cp | Faili | core | Copy files and directories | -r recursive copy -p preserve timestamps and mode -u copy only if newer -i prompt before overwrite -v verbose output |
| mv | Faili | core | Move or rename files and directories | -i prompt before overwrite -u move only if newer -f force without prompt -v verbose output |
| rm | Faili | core | Remove files or directories permanently | -r recursive removal -f force, ignore missing -i prompt before each removal -v verbose output |
| ln | Faili | core | Create hard or symbolic links | -s create symbolic link -f force overwrite existing -v verbose output -r make relative symlink |
| stat | Faili | core | Display detailed file and filesystem metadata | -f show filesystem status -c custom format string -t terse machine-readable output |
| file | Faili | core | Determine file type regardless of extension | -i output MIME type -z look inside compressed files -b brief output without filename |
| rsync | Faili | modern | Fast incremental file transfer - local or remote | -a archive mode (recursive + preserve) -v verbose output -z compress data during transfer -P show progress + keep partial files --delete remove files not in source --dry-run simulate without changes --exclude skip pattern |
| fzf | Faili | modern | Interactive fuzzy finder for files, history, and pipes | --preview pipe to preview command --multi allow multiple selections -q start with initial query --height use % of terminal height --bind customize key bindings |
| cat | Teksts | core | Concatenate and print file content to stdout | -n number all output lines -A show all non-printing chars -s suppress repeated blank lines |
| less | Teksts | core | Interactively page through file content | -N show line numbers -S disable line wrapping -i case-insensitive search -F exit if content fits one screen |
| head | Teksts | core | Output the first N lines of a file | -n number of lines (default 10) -c number of bytes -q suppress filename headers |
| tail | Teksts | core | Output the last N lines of a file | -n number of lines (default 10) -f follow file for new content -c number of bytes -q suppress filename headers |
| grep | Teksts | core | Search text using patterns and regular expressions | -i case-insensitive match -r recursive directory search -n prefix output with line number -v invert match (exclude pattern) -E use extended regex (ERE) -P use Perl-compatible regex -l print matching filenames only -c count matching lines -A/-B lines of context after/before |
| sed | Teksts | core | Stream editor - filter and transform text in-place or piped | -i edit files in-place -n suppress default output -e add script expression -r use extended regex s/old/new/g substitute pattern |
| awk | Teksts | core | Pattern scanning and structured text processing | -F set field separator -v assign variable before run -f read program from file NR current record number $1..$N access fields |
| sort | Teksts | core | Sort lines of text files | -n numeric sort -r reverse sort order -u output unique lines only -k sort by key/field column -t set field delimiter -h human-numeric sort (1K, 2M) |
| cut | Teksts | core | Remove sections from each line of input | -d set field delimiter -f select field numbers -c select character positions -b select byte positions |
| wc | Teksts | core | Count lines, words, and bytes in files | -l count lines only -w count words only -c count bytes -m count characters |
| diff | Teksts | core | Compare files line by line and show differences | -u unified diff format -r compare directories recursively -i ignore case differences -w ignore all whitespace |
| tr | Teksts | core | Translate or delete characters from input | -d delete specified characters -s squeeze repeated characters -c complement the character set |
| bat | Teksts | modern | cat replacement with syntax highlighting and git markers | --style header, grid, numbers, changes --language force syntax language -n show line numbers --diff show only changed lines --pager override pager (never to disable) |
| ripgrep (rg) | Teksts | modern | Extremely fast grep - respects .gitignore by default | -i case-insensitive -n show line numbers -l list matching files only --type filter by file type -A/-B lines of context --hidden include hidden files --no-ignore override .gitignore |
| jq | Teksts | modern | JSON processor - slice, filter, map, and transform | '.key' extract object field '.[]' iterate over array -r raw string output (no quotes) --arg pass shell variable into filter 'select()' conditional filter 'keys' list all keys of object |
| ps | Procesi | core | Report a snapshot of current running processes | -e show all processes -f full-format listing aux BSD-style all processes --forest show process tree -o custom output format |
| top | Procesi | core | Interactive real-time process and resource monitor | -d update delay in seconds -u filter by username -n number of iterations then exit -b batch (non-interactive) mode k kill process interactively |
| htop | Procesi | modern | Enhanced interactive process viewer with tree view and meters | -u filter by user -p watch specific PIDs -d delay in tenths of seconds --no-color force plain text F5 toggle tree view F9 send signal to process |
| kill | Procesi | core | Send a signal to a process by PID | -9 SIGKILL - force terminate immediately -15 SIGTERM - graceful shutdown (default) -1 SIGHUP - reload configuration -l list all available signals |
| killall | Procesi | core | Send a signal to all processes matching a name | -9 force kill -15 graceful terminate -i interactive confirm -u kill only processes of user -v verbose output |
| nice | Procesi | core | Launch a command with adjusted CPU scheduling priority | -n niceness value from -20 (highest) to 19 |
| renice | Procesi | core | Change the priority of a running process | -n new niceness value -p apply to PID -u apply to all processes of user -g apply to process group |
| nohup | Procesi | core | Run command immune to terminal hangup (SIGHUP) | nohup cmd & run in background output goes to nohup.out by default |
| strace | Procesi | modern | Trace system calls and signals made by a process | -p attach to running PID -e filter by syscall name or category -o write output to file -f follow child processes (forks) -c print summary statistics on exit -T show time spent per syscall |
| lsof | Procesi | modern | List open files, network sockets, and device handles | -p list files for PID -u list files for user -i network connections (optionally :port) -t output PIDs only for scripting lsof /path what has this file open |
| systemctl | Sistēma | core | Control and query the systemd service manager | start / stop / restart manage service status show unit current state enable / disable set boot behaviour list-units --type=service all services daemon-reload reload unit files is-active / is-enabled check state |
| journalctl | Sistēma | core | Query and display systemd journal logs | -u filter by unit name -f follow log in real time -n show last N lines --since / --until time range -p filter by priority level (err, warn…) -o json structured JSON output --disk-usage show journal size |
| uname | Sistēma | core | Print system kernel and OS information | -a print all information -r kernel release version -m machine hardware architecture -n network hostname -s kernel name |
| uptime | Sistēma | core | Show how long the system has been running | -p pretty human-readable format -s show since date and time |
| dmesg | Sistēma | core | Print or control the kernel ring buffer message log | -T human-readable timestamps -l filter by log level -f filter by facility --follow live stream new messages -H colorized human output |
| sysctl | Sistēma | modern | Read and modify kernel parameters at runtime | -a list all current parameters -w write param=value -p load settings from file (default /etc/sysctl.conf) net.ipv4.ip_forward=1 enable routing |
| timedatectl | Sistēma | modern | Query and change system clock, timezone, and NTP | status show current time settings set-timezone Region/City set-time 'YYYY-MM-DD HH:MM:SS' set-ntp true enable NTP sync |
| env / export | Sistēma | core | Display, set, or export environment variables | export VAR=value set and export env list all current variables printenv VAR print specific variable unset VAR remove variable env -i cmd run with empty environment |
| crontab | Sistēma | core | Schedule recurring tasks via the cron daemon | -e edit current user's crontab -l list current user's crontab -r remove current user's crontab -u user operate on another user's crontab format: min hr dom mon dow command |
| git | Sistēma | modern | Distributed version control - track and collaborate on code | status show working tree state log --oneline --graph compact history diff HEAD changes since last commit stash push/pop shelve and restore changes rebase -i interactive squash/reorder bisect start/good/bad find bug commit blame show line-by-line authorship |
| ansible | Sistēma | modern | Agentless IT automation and configuration management | -i inventory file path --check dry-run (no changes) -v / -vvv verbosity level --tags run only tagged tasks --limit restrict to host subset --vault-id decrypt vault secrets -m specify module for ad-hoc task |
| terraform | Sistēma | modern | Infrastructure as Code - provision cloud and on-prem resources | init initialize working directory plan preview changes apply apply changes to infra destroy tear down resources state list show tracked resources import bring existing resource under management |
| chmod | Tiesības | core | Change file mode bits and permission flags | -R apply recursively u/g/o/a user/group/other/all +/-/= add / remove / set exactly 755 rwxr-xr-x common executable 644 rw-r--r-- common file chmod +x make executable |
| chown | Tiesības | core | Change file owner and/or group ownership | -R recursive -v verbose, print each file user:group change both owner and group --from=user change only if current owner matches |
| chgrp | Tiesības | core | Change the group ownership of files | -R recursive -v verbose output -h change symlinks themselves |
| sudo | Tiesības | core | Execute a command as root or another user | -u user run as specified user -i start root login shell -l list allowed commands -s run shell as target user -v validate and extend timestamp -k invalidate cached credentials |
| umask | Tiesības | core | Set the default permission mask for new files | 022 files 644, dirs 755 (typical server) 027 files 640, dirs 750 (stricter) -S display in symbolic form -p print as umask command for reuse |
| getfacl / setfacl | Tiesības | modern | Get and set POSIX Access Control Lists on files | -m modify or add ACL entry -x remove specific ACL entry -R apply recursively -b remove all extended ACL entries -d set default ACL (for new files in dir) getfacl display all ACL entries |
| auditctl | Tiesības | modern | Configure the Linux Audit subsystem with watch rules | -w add filesystem watch on path -p permission filter: r w x a -l list all current rules -D delete all audit rules ausearch -f search logs by file aureport generate audit reports |
| passwd | Tiesības | core | Change user password and manage account locks | -l lock user account -u unlock user account -e force password expiry on next login -d delete password (enable passwordless login) --stdin read password from stdin (RHEL) |
| ip | Tīkls | core | Manage network interfaces, addresses, routes, and ARP | addr show display all IP addresses addr add/del add/remove address route show display routing table link set up/down bring interface up or down neigh show display ARP table rule list show policy routing rules |
| ss | Tīkls | core | Socket statistics - modern replacement for netstat | -t TCP sockets -u UDP sockets -l listening sockets only -n numeric (no hostname resolution) -p show process using socket -s print summary statistics -4/-6 IPv4 or IPv6 only |
| ping | Tīkls | core | Test network host reachability using ICMP echo | -c number of packets to send -i interval between packets -t set IP TTL value -s packet payload size -W timeout for reply in seconds |
| traceroute | Tīkls | core | Trace the network path packets take to a host | -n numeric output, skip DNS lookup -m set maximum TTL (hops) -w wait timeout per probe -I use ICMP echo requests -T use TCP SYN packets |
| dig | Tīkls | core | DNS query tool - lookup and troubleshoot records | +short terse answer only +trace follow full delegation chain @server query specific resolver ANY request all record types AAAA request IPv6 address record +noall +answer clean output |
| nslookup | Tīkls | core | Interactive and non-interactive DNS lookup | nslookup domain basic lookup nslookup domain server use specific resolver set type=MX change query type |
| ssh | Tīkls | core | Secure Shell - remote login, execution, and tunneling | -i identity (private key) file -p remote port number -L local port forwarding -R remote port forwarding -J jump through bastion host -N do not execute remote command -X enable X11 forwarding -v verbose debug output |
| nftables (nft) | Tīkls | modern | Modern kernel packet filtering - replaces iptables | list ruleset show all rules add table ip create table add chain add chain to table add rule append filtering rule flush ruleset delete all rules -f file load from rules file |
| iptables | Tīkls | core | Kernel IPv4 packet filtering and NAT firewall | -A append rule to chain -D delete specific rule -L list chain rules -F flush / clear chain -P set default chain policy -j jump to target: ACCEPT DROP REJECT |
| firewall-cmd | Tīkls | modern | Management tool for firewalld (used on RHEL/CentOS/Rocky) | --list-all show zone config --add-port=80/tcp open port --add-service=https allow service --remove-port close port --permanent persist across reboots --reload apply permanent rules |
| curl | Pārsūtīšana | core | Transfer data over HTTP, HTTPS, FTP, and many other protocols | -o write output to file -X specify HTTP method (GET POST PUT…) -H add custom request header -d send POST body data -L follow 3xx redirects -k skip TLS certificate verification --retry N retry on transient failure --compressed request and handle gzip --data-binary send raw binary data -u user:pass HTTP basic authentication --form send multipart/form-data -s silent mode (no progress bar) |
| wget | Pārsūtīšana | core | Non-interactive network file downloader | -r recursive download -O save to specified filename -q quiet mode -c continue interrupted download -P set local directory prefix --spider check URL without downloading --limit-rate throttle download speed --user / --password authentication |
| scp | Pārsūtīšana | core | Securely copy files between hosts over SSH | -r recursive copy of directories -P specify remote port -i identity (private key) file -p preserve timestamps and modes -v verbose debug output |
| sftp | Pārsūtīšana | core | Interactive secure file transfer over SSH | -P specify port -i identity file get / put download / upload file ls / lls list remote / local files mget / mput batch transfer |
| tcpdump | Monitorings | modern | Capture and analyze raw network traffic packets | -i specify interface -w write packets to pcap file -r read from pcap file -n no hostname/port resolution host X filter by IP address port N filter by port number -A print payload in ASCII -c N capture N packets then exit 'tcp and port 443' BPF filter example |
| nethogs | Monitorings | modern | Per-process real-time network bandwidth monitor | -d refresh delay in seconds -t run in trace (non-interactive) mode -p enable promiscuous mode device specify interface to monitor |
| iftop | Monitorings | modern | Display real-time bandwidth usage per network connection | -i network interface to listen on -n suppress DNS hostname lookups -P show port numbers in output -B display in bytes (not bits) |
| iostat | Monitorings | modern | Report CPU utilization and I/O statistics for devices | -x extended device statistics -d display device I/O only -c display CPU statistics only -k display stats in kilobytes -m display stats in megabytes interval count repeat sampling |
| vmstat | Monitorings | modern | Report virtual memory, CPU, and disk I/O statistics | -s display memory statistics table -d display disk statistics -w wide output format interval count periodic sampling |
| sar | Monitorings | modern | Collect, report, and save system activity data | -u CPU utilization -r memory statistics -n DEV network interface stats -d disk activity -f read from data file -s specify start time 1 5 sample every second, 5 times |
| glances | Monitorings | modern | Cross-platform curses system monitor with export plugins | -w start as web server --port web server port -1 per-CPU core display -t refresh interval --export csv/json output data --browser discover remote glances |
| netstat | Monitorings | core | Network statistics - legacy tool (use ss on modern systems) | -t TCP connections -u UDP sockets -l listening ports only -n numeric IPs and ports -p show program using socket -r show routing table |
| df | Diski | core | Report file system disk space usage | -h human-readable sizes -T show filesystem type -i show inode usage -a include all filesystems -x exclude filesystem type |
| du | Diski | core | Estimate file and directory space on disk | -h human-readable output -s display summary total only -a report for all files -d N limit depth to N levels --exclude skip matching pattern du -sh ./* size of each item in CWD |
| lsblk | Diski | core | List block devices and partitions in tree format | -a show all including empty devices -f show filesystem and UUID -o specify output columns -d do not show device children -p print full device path |
| fdisk | Diski | core | Manipulate MBR partition tables interactively | -l list all partition tables -u use sectors as units p print table n new d delete w write and exit q quit no save |
| parted | Diski | core | Partition manipulation - supports GPT and large disks | -l list all disks and partitions mkpart create new partition resizepart resize existing partition print show partition table rm N remove partition N |
| mount / umount | Diski | core | Attach or detach filesystems to the directory tree | -t specify filesystem type -o mount options (rw, ro, noexec…) -a mount all entries in /etc/fstab -r mount as read-only --bind bind-mount a directory umount -l lazy unmount |
| lvm (pvs/vgs/lvs) | Diski | modern | Logical Volume Manager - flexible disk abstraction layer | pvcreate initialize physical volume vgcreate create volume group lvcreate -L -n create logical volume lvextend -L +size grow LV lvreduce -L -size shrink LV vgdisplay / lvdisplay inspect |
| smartctl | Diski | modern | Monitor disk health using S.M.A.R.T. diagnostics | -a print all SMART information -H check health summary only -t short/long run self-test -l selftest view test results --scan find all SMART-capable drives |
| tar | core | Create and extract archives; compose with compressors | -c create new archive -x extract archive contents -z filter through gzip (.tar.gz) -j filter through bzip2 (.tar.bz2) --zstd filter through zstd (.tar.zst) -v verbose - list files processed -f specify archive filename -t list archive contents without extract --strip-components N strip N path levels |
|
| gzip / gunzip | core | Compress or decompress files in .gz format | -d decompress file -k keep original file -v verbose output -9 maximum compression level -1 fastest compression -l list compression statistics |
|
| zip / unzip | core | Create or extract ZIP archives | zip -r recursive add directory -e encrypt with password -9 maximum compression unzip -l list archive contents unzip -d dir extract to directory -v verbose listing |
|
| zstd | modern | Fast modern compression - high speed at good ratios | -d decompress file -k keep original -T0 use all CPU threads -19 high compression level --fast alias for level 1 --progress show progress during compress |
|
| nmap | Ielaušanās tests | security | Network scanner - host discovery, port scan, service detection | -sV detect service versions -sC run default NSE scripts -O enable OS fingerprinting -p specify port range (e.g. 1-65535) -A aggressive: OS+version+scripts+traceroute --script run specific NSE script name -oN / -oX output to file (normal/XML) -Pn skip host discovery (assume up) -sS TCP SYN stealth scan |
| netcat (nc) | Ielaušanās tests | security | TCP/UDP multipurpose tool - banner grab, file pipe, reverse shell | -l listen mode (server side) -v verbose output -z zero-I/O scan mode (port check) -u use UDP instead of TCP -e execute command on connect -p specify source port nc -lvnp 4444 listener for reverse shell |
| openssl | Ielaušanās tests | security | TLS/SSL toolkit - certificates, keys, encryption, and testing | s_client -connect host:443 test TLS x509 -in cert.pem -text inspect cert genrsa -out key.pem 4096 generate RSA key req -new generate CSR enc -aes-256-cbc encrypt/decrypt file verify -CAfile validate certificate chain speed benchmark cipher performance |
| ssh-keygen | Ielaušanās tests | security | Generate, manage, and convert SSH authentication keys | -t ed25519 modern key type (recommended) -b 4096 key bit length (for RSA) -C 'comment' add identifying comment -f output file path -p change or remove passphrase -l print key fingerprint -A generate all default host key types |
| gpg | Ielaušanās tests | security | GNU Privacy Guard - encrypt, decrypt, sign, and verify data | --gen-key generate new key pair -e -r recipient encrypt file --decrypt decrypt .gpg file -s create detached signature --verify verify signature file --armor output in ASCII armor format --export / --import key management |
| lynis | Ielaušanās tests | security | Security auditing tool - scan and harden Linux systems | audit system run full system audit --tests-from-group auth focus on group --quiet suppress informational output --no-colors plain text output --pentest pentest-oriented mode --report-file write report to file |
| fail2ban-client | Ielaušanās tests | security | Manage fail2ban - auto-ban IPs on repeated failures | status list all active jails status sshd show ssh jail details set sshd unbanip IP manually unban reload reload configuration start / stop control service banned list currently banned IPs |
| hashcat | Ielaušanās tests | security | GPU-accelerated password hash cracking tool | -m hash type (0=MD5, 1800=sha512crypt) -a attack mode (0=dict, 3=bruteforce) -w workload profile (1–4) -r apply rules file --show show already cracked hashes --status live progress update |
| john (JtR) | Ielaušanās tests | security | CPU-based password hash cracker with auto-detection | --wordlist dictionary file path --rules apply mangling rules --format specify hash type --show display cracked passwords --fork N run N parallel processes unshadow merge passwd and shadow |
| docker | Konteineri | modern | Build, ship, and run application containers | run -d run container detached run --rm auto-remove on exit exec -it open shell in running container logs -f follow container log stream inspect detailed JSON metadata ps -a list all containers (including stopped) build -t build image with tag network ls / inspect manage networks volume ls / inspect manage volumes system prune remove unused resources |
| kubectl | Konteineri | modern | CLI to manage Kubernetes clusters and workloads | get pods/svc/nodes list resources describe pod name detailed event log apply -f manifest.yaml deploy/update resource exec -it pod -- bash shell into pod logs -f pod follow pod log stream top node / top pod resource usage rollout status/undo deployment control port-forward forward local port to pod config use-context switch cluster |
| podman | Konteineri | modern | Rootless daemonless OCI container engine - docker-compatible | run --rm auto-remove after exit --user 1000 run as non-root UID --pod attach to pod group -v bind mount host volume generate kube export as Kubernetes YAML play kube run from Kubernetes YAML pod create / start / stop manage pods |
| helm | Konteineri | modern | Kubernetes package manager for templated chart deployments | install release chart deploy chart upgrade --install upsert deploy rollback release N revert to revision list show all deployed releases values chart show default values repo add / update manage chart repos template render manifests locally |