Kigeuzi cha Bure

Linux / Bash Karatasi ya Kudanganya ya Amri

Laha ya kudanganya ya amri ya Linux na Bash. Tafuta 80+ amri muhimu kwa mifano, maelezo, na nakala ya mbofyo mmoja.

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

Kuhusu zana hii

Mwongozo wa kina wa marejeleo ya haraka kwa linux bash. Vinjari amri, sintaksia na mifano inayotumika sana iliyopangwa kulingana na kategoria. Inaweza kutafutwa na rahisi kutumia simu - alamisha ukurasa huu kwa ufikiaji wa papo hapo unapohitaji kikumbusho cha haraka.

Jinsi ya kutumia

  1. Vinjari sehemu za marejeleo zilizoainishwa.
  2. Tumia upau wa kutafutia ili kupata amri au sintaksia mahususi.
  3. Bofya ingizo lolote ili kuona mifano ya matumizi na maelezo.
  4. Nakili amri moja kwa moja kwa matumizi katika terminal au kihariri chako.

Maswali yanayoulizwa mara kwa mara

Je, rejeleo hili limesasishwa?
Rejea inashughulikia amri na sintaksia zinazotumiwa sana ambazo ni thabiti katika matoleo yote. Kwa nyongeza za hivi punde au vipengele mahususi vya toleo, angalia hati rasmi.
Je, ninaweza kutumia hii nje ya mtandao?
Mara baada ya kupakiwa, ukurasa hufanya kazi bila muunganisho wa mtandao. Alamisha kwa ufikiaji wa haraka - yaliyomo yote hutolewa kwenye kivinjari bila maombi zaidi ya mtandao.
Je, hii ni pana au ni ya msingi tu?
Inashughulikia amri na mifumo inayotumika sana ambayo hushughulikia 90% ya kazi za kila siku. Kwa niche au vipengele vya juu, wasiliana na nyaraka rasmi.
Je, ninaweza kupendekeza nyongeza?
Tunasasisha marejeleo yetu mara kwa mara. Ukiona amri zinazokosekana au una mapendekezo, tujulishe kupitia ukurasa wetu wa mawasiliano.