Nemokamas konverteris

Linux / Bash Command Cheat Sheet

Išsamus „Linux“ ir „Bash“ komandų apgaulės lapas. Ieškokite daugiau nei 80 pagrindinių komandų su pavyzdžiais, aprašymais ir kopija vienu spustelėjimu.

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

Apie šį įrankį

Išsamus greitas „Linux bash“ vadovas. Naršykite dažniausiai naudojamas komandas, sintaksę ir pavyzdžius, suskirstytus pagal kategorijas. Galima ieškoti ir pritaikyti mobiliesiems – pažymėkite šį puslapį, kad galėtumėte greitai pasiekti, kai jums reikia greito priminimo.

Kaip naudoti

  1. Naršykite į kategorijas suskirstytus nuorodų skyrius.
  2. Norėdami rasti konkrečias komandas arba sintaksę, naudokite paieškos juostą.
  3. Spustelėkite bet kurį įrašą, kad pamatytumėte naudojimo pavyzdžius ir paaiškinimus.
  4. Nukopijuokite komandas tiesiai, kad galėtumėte naudoti savo terminale arba redaktoriuje.

Dažnai užduodami klausimai

Ar ši nuoroda atnaujinta?
Nuoroda apima plačiai naudojamas komandas ir sintaksę, kurios yra stabilios įvairiose versijose. Naujausių priedų ar konkrečios versijos funkcijų ieškokite oficialioje dokumentacijoje.
Ar galiu tai naudoti neprisijungęs?
Įkėlus puslapis veikia be interneto ryšio. Pažymėkite jį, kad galėtumėte greitai pasiekti – visas turinys pateikiamas naršyklėje be papildomų tinklo užklausų.
Ar tai visapusiška, ar tik pagrindai?
Ji apima dažniausiai naudojamas komandas ir šablonus, kurie atlieka 90 % kasdienių užduočių. Dėl nišinių ar išplėstinių funkcijų ieškokite oficialių dokumentų.
Ar galiu pasiūlyti papildymus?
Reguliariai atnaujiname savo nuorodas. Jei pastebėjote trūkstamų komandų arba turite pasiūlymų, praneškite mums per mūsų kontaktų puslapį.