Gratis omformer

Linux / Bash Kommando Cheat Sheet

Omfattende Linux og Bash kommando jukseark. Søk i 80+ viktige kommandoer med eksempler, beskrivelser og ett-klikks kopi.

ls
List directory contents
Eksempel:ls -la /home/user
ls -la
List all files including hidden, with details
Eksempel:ls -la ~/Documents
cd
Change directory
Eksempel:cd /var/log
pwd
Print working directory path
Eksempel:pwd
mkdir
Create a new directory
Eksempel:mkdir -p /tmp/mydir/subdir
rm
Remove files or directories
Eksempel:rm -rf /tmp/oldfiles
cp
Copy files or directories
Eksempel:cp -r /src/dir /dst/dir
mv
Move or rename files/directories
Eksempel:mv oldname.txt newname.txt
touch
Create an empty file or update timestamp
Eksempel:touch newfile.txt
find
Search for files in a directory hierarchy
Eksempel:find /home -name '*.log' -mtime -7
locate
Find files by name using a prebuilt database
Eksempel:locate nginx.conf
ln
Create hard or symbolic links
Eksempel:ln -s /path/to/target /path/to/link
df
Report disk space usage of file systems
Eksempel:df -h
du
Estimate file space usage
Eksempel:du -sh /var/log/*
stat
Display file or file system status
Eksempel:stat /etc/passwd
file
Determine file type
Eksempel:file /usr/bin/bash
cat
Concatenate and display file contents
Eksempel:cat /etc/hosts
less
View file content one screen at a time
Eksempel:less /var/log/syslog
more
View file content page by page
Eksempel:more /etc/passwd
head
Output the first part of a file
Eksempel:head -n 20 /var/log/auth.log
tail
Output the last part of a file
Eksempel:tail -f /var/log/syslog
grep
Search text using patterns
Eksempel:grep -rn 'error' /var/log/
sed
Stream editor for filtering and transforming text
Eksempel:sed 's/old/new/g' file.txt
awk
Pattern scanning and text processing language
Eksempel:awk '{print $1, $3}' access.log
sort
Sort lines of text files
Eksempel:sort -k2 -n data.txt
uniq
Report or omit repeated lines
Eksempel:sort file.txt | uniq -c
wc
Print newline, word, and byte counts
Eksempel:wc -l /etc/passwd
cut
Remove sections from each line of files
Eksempel:cut -d: -f1 /etc/passwd
tr
Translate or delete characters
Eksempel:echo 'hello' | tr 'a-z' 'A-Z'
echo
Display a line of text
Eksempel:echo "Hello, World!"
printf
Format and print data
Eksempel:printf "%s\t%d\n" name 42
diff
Compare files line by line
Eksempel:diff file1.txt file2.txt
tee
Read from stdin and write to stdout and files
Eksempel:ls | tee output.txt
ps
Report a snapshot of current processes
Eksempel:ps aux | grep nginx
top
Display Linux processes in real time
Eksempel:top -u www-data
htop
Interactive process viewer (ncurses-based)
Eksempel:htop
kill
Send a signal to a process
Eksempel:kill -9 1234
killall
Kill processes by name
Eksempel:killall firefox
bg
Resume a suspended job in the background
Eksempel:bg %1
fg
Bring a job to the foreground
Eksempel:fg %1
jobs
List active jobs in the current shell
Eksempel:jobs -l
nohup
Run a command immune to hangups
Eksempel:nohup ./script.sh &
nice
Run a command with modified scheduling priority
Eksempel:nice -n 10 ./heavy_task.sh
systemctl
Control the systemd system and service manager
Eksempel:systemctl restart nginx
service
Run a System V init script
Eksempel:service apache2 status
ping
Send ICMP ECHO_REQUEST to network hosts
Eksempel:ping -c 4 google.com
curl
Transfer data from or to a server
Eksempel:curl -L -o file.zip https://example.com/file.zip
wget
Non-interactive network downloader
Eksempel:wget -q https://example.com/file.tar.gz
ssh
OpenSSH remote login client
Eksempel:ssh -i ~/.ssh/key.pem user@host
scp
Secure copy files between hosts
Eksempel:scp user@host:/path/file.txt ./local/
rsync
Remote file copying tool with delta transfer
Eksempel:rsync -avz /src/ user@host:/dst/
netstat
Print network connections and routing tables
Eksempel:netstat -tulpn
ss
Utility to investigate sockets
Eksempel:ss -tulwn
ifconfig
Configure a network interface
Eksempel:ifconfig eth0
ip
Show and manipulate routing, devices, and tunnels
Eksempel:ip addr show
nmap
Network exploration tool and port scanner
Eksempel:nmap -sV 192.168.1.0/24
dig
DNS lookup utility
Eksempel:dig +short A google.com
nslookup
Query Internet name servers interactively
Eksempel:nslookup example.com
chmod
Change file mode bits (permissions)
Eksempel:chmod 755 script.sh
chown
Change file owner and group
Eksempel:chown -R www-data:www-data /var/www
chgrp
Change group ownership
Eksempel:chgrp developers project/
sudo
Execute a command as another user (superuser)
Eksempel:sudo systemctl restart nginx
su
Change user ID or become superuser
Eksempel:su - postgres
passwd
Change user password
Eksempel:passwd username
umask
Set or display the file mode creation mask
Eksempel:umask 022
id
Print user and group information
Eksempel:id username
whoami
Print the current effective user name
Eksempel:whoami
groups
Print the groups a user is in
Eksempel:groups username
tar
Archive files using tape archive format
Eksempel:tar -czvf archive.tar.gz /path/to/dir
tar -x
Extract files from a tar archive
Eksempel:tar -xzvf archive.tar.gz -C /target/
gzip
Compress files using GNU zip
Eksempel:gzip -9 large_file.log
gunzip
Decompress gzip compressed files
Eksempel:gunzip archive.tar.gz
zip
Package and compress files into a ZIP archive
Eksempel:zip -r output.zip /path/to/dir
unzip
Extract files from a ZIP archive
Eksempel:unzip archive.zip -d /target/
bzip2
Compress files using bzip2 algorithm
Eksempel:bzip2 -z large_file.txt
xz
Compress files using the XZ algorithm
Eksempel:xz -z -9 file.txt
uname
Print system information
Eksempel:uname -a
uptime
Tell how long the system has been running
Eksempel:uptime
free
Display amount of free and used memory
Eksempel:free -h
lscpu
Display information about the CPU architecture
Eksempel:lscpu
lsblk
List information about block devices
Eksempel:lsblk -o NAME,SIZE,TYPE,MOUNTPOINT
lspci
List all PCI devices
Eksempel:lspci -v | grep VGA
dmesg
Print or control the kernel ring buffer
Eksempel:dmesg | tail -50
journalctl
Query and display messages from the journal
Eksempel:journalctl -u nginx --since '1 hour ago'
history
Display the command history list
Eksempel:history | grep docker
env
Print environment variables
Eksempel:env | grep PATH
if / then / fi
Conditional execution in shell scripts
Eksempel:if [ -f file.txt ]; then echo exists; fi
for
Loop over a list of items
Eksempel:for i in 1 2 3; do echo $i; done
while
Execute commands while a condition is true
Eksempel:while read line; do echo $line; done < file
case
Multi-branch conditional matching pattern
Eksempel:case "$var" in a) echo A;; b) echo B;; esac
function
Define a shell function
Eksempel:greet() { echo "Hello, $1!"; }; greet World
export
Set environment variables for child processes
Eksempel:export MY_VAR=value
source
Execute commands from a file in current shell
Eksempel:source ~/.bashrc
alias
Create an alias for a command
Eksempel:alias ll='ls -la'
cron / crontab
Schedule commands to run periodically
Eksempel:crontab -e # 0 * * * * /path/to/script.sh
at
Execute commands at a specified time
Eksempel:echo 'ls /tmp' | at 14:30

Om dette verktøyet

En omfattende hurtigreferanse for linux bash. Bla gjennom ofte brukte kommandoer, syntaks og eksempler organisert etter kategori. Søkbar og mobilvennlig – bokmerk denne siden for umiddelbar tilgang når du trenger en rask påminnelse.

Slik bruker du det

  1. Bla gjennom de kategoriserte referanseseksjonene.
  2. Bruk søkefeltet for å finne bestemte kommandoer eller syntaks.
  3. Klikk på en oppføring for å se brukseksempler og forklaringer.
  4. Kopier kommandoer direkte for bruk i terminalen eller editoren.

Ofte stilte spørsmål

Er denne referansen oppdatert?
Referansen dekker mye brukte kommandoer og syntaks som er stabile på tvers av versjoner. For de siste tilleggene eller versjonsspesifikke funksjonene, sjekk den offisielle dokumentasjonen.
Kan jeg bruke dette offline?
Når den er lastet inn, fungerer siden uten internettforbindelse. Bokmerk det for rask tilgang - alt innhold gjengis i nettleseren uten ytterligere nettverksforespørsler.
Er dette omfattende eller bare det grunnleggende?
Den dekker de mest brukte kommandoene og mønstrene som håndterer 90 % av daglige gjøremål. For nisje eller avanserte funksjoner, se den offisielle dokumentasjonen.
Kan jeg foreslå tillegg?
Vi oppdaterer referansene våre jevnlig. Hvis du oppdager manglende kommandoer eller har forslag, gi oss beskjed via kontaktsiden vår.