1.linuxåºç¡å½ä»¤
linuxåºç¡å½ä»¤
Linux常ç¨å½ä»¤å¤§å ¨
ç³»ç»ä¿¡æ¯
arch æ¾ç¤ºæºå¨çå¤çå¨æ¶æ(1)
uname -m æ¾ç¤ºæºå¨çå¤çå¨æ¶æ(2)
uname -r æ¾ç¤ºæ£å¨ä½¿ç¨çå æ ¸çæ¬
dmidecode -q æ¾ç¤ºç¡¬ä»¶ç³»ç»é¨ä»¶ - (SMBIOS / DMI)
hdparm -i /dev/hda ç½åä¸ä¸ªç£ççæ¶æç¹æ§
hdparm -tT /dev/sda å¨ç£çä¸æ§è¡æµè¯æ§è¯»åæä½
cat /proc/cpuinfo æ¾ç¤ºCPU infoçä¿¡æ¯
cat /proc/interrupts æ¾ç¤ºä¸æ
cat /proc/meminfo æ ¡éªå å使ç¨
cat /proc/swaps æ¾ç¤ºåªäºswap被使ç¨
cat /proc/version æ¾ç¤ºå æ ¸ççæ¬
cat /proc/net/dev æ¾ç¤ºç½ç»éé å¨åç»è®¡
cat /proc/mounts æ¾ç¤ºå·²å è½½çæ件系ç»
lspci -tv ç½å PCI 设å¤
lsusb -tv æ¾ç¤º USB 设å¤
date æ¾ç¤ºç³»ç»æ¥æ
cal æ¾ç¤ºå¹´çæ¥å表
date . 设置æ¥æåæ¶é´ - ææ¥æ¶åå¹´.ç§
clock -w å°æ¶é´ä¿®æ¹ä¿åå° BIOS
å ³æº (ç³»ç»çå ³æºãéå¯ä»¥åç»åº )
shutdown -h now å ³éç³»ç»(1)
init 0 å ³éç³»ç»(2)
telinit 0 å ³éç³»ç»(3)
shutdown -h hours:minutes & æé¢å®æ¶é´å ³éç³»ç»
shutdown -c åæ¶æé¢å®æ¶é´å ³éç³»ç»
shutdown -r now éå¯(1)
reboot éå¯(2)
logout 注é
æ件åç®å½
cd /home è¿å ¥ '/ home' ç®å½'
cd .. è¿åä¸ä¸çº§ç®å½
cd ../.. è¿åä¸ä¸¤çº§ç®å½
cd è¿å ¥ä¸ªäººç主ç®å½
cd ~user1 è¿å ¥ä¸ªäººç主ç®å½
cd - è¿åä¸æ¬¡æå¨çç®å½
pwd æ¾ç¤ºå·¥ä½è·¯å¾
ls æ¥çç®å½ä¸çæ件
ls -F æ¥çç®å½ä¸çæ件
ls -l æ¾ç¤ºæ件åç®å½ç详ç»èµæ
ls -a æ¾ç¤ºéèæ件
ls *[0-9]* æ¾ç¤ºå å«æ°åçæ件ååç®å½å
tree æ¾ç¤ºæ件åç®å½ç±æ ¹ç®å½å¼å§çæ å½¢ç»æ(1)
lstree æ¾ç¤ºæ件åç®å½ç±æ ¹ç®å½å¼å§çæ å½¢ç»æ(2)
mkdir dir1 å建ä¸ä¸ªå«å 'dir1' çç®å½'
mkdir dir1 dir2 åæ¶å建两个ç®å½
mkdir -p /tmp/dir1/dir2 å建ä¸ä¸ªç®å½æ
rm -f file1 å é¤ä¸ä¸ªå«å 'file1' çæ件'
rmdir dir1 å é¤ä¸ä¸ªå«å 'dir1' çç®å½'
rm -rf dir1 å é¤ä¸ä¸ªå«å 'dir1' çç®å½å¹¶åæ¶å é¤å ¶å 容
rm -rf dir1 dir2 åæ¶å é¤ä¸¤ä¸ªç®å½åå®ä»¬çå 容
mv dir1 new_dir éå½å/ç§»å¨ ä¸ä¸ªç®å½
cp file1 file2 å¤å¶ä¸ä¸ªæ件
cp dir/* . å¤å¶ä¸ä¸ªç®å½ä¸çæææ件å°å½åå·¥ä½ç®å½
cp -a /tmp/dir1 . å¤å¶ä¸ä¸ªç®å½å°å½åå·¥ä½ç®å½
cp -a dir1 dir2 å¤å¶ä¸ä¸ªç®å½
ln -s file1 lnk1 å建ä¸ä¸ªæåæ件æç®å½ç软é¾æ¥
ln file1 lnk1 å建ä¸ä¸ªæåæ件æç®å½çç©çé¾æ¥
touch -t file1 ä¿®æ¹ä¸ä¸ªæ件æç®å½çæ¶é´æ³ - (YYMMDDhhmm)
file file1 outputs the mime type of the file as text
iconv -l ååºå·²ç¥çç¼ç
iconv -f fromEncoding -t toEncoding inputFile > outputFile creates a new from the given input file by assuming it is 源码b站 源码 cidencoded in fromEncoding and converting it to toEncoding.
find . -maxdepth 1 -name *.jpg -print -exec convert "{ }" -resize x "thumbs/{ }" \; batch resize files in the current directory and send them to a thumbnails directory (requires convert from Imagemagick)
æ件æç´¢
find / -name file1 ä» '/' å¼å§è¿å ¥æ ¹æ件系ç»æç´¢æ件åç®å½
find / -user user1 æç´¢å±äºç¨æ· 'user1' çæ件åç®å½
find /home/user1 -name \*.bin å¨ç®å½ '/ home/user1' ä¸æ索带æ'.bin' ç»å°¾çæ件
find /usr/bin -type f -atime + æç´¢å¨è¿å»å¤©å æªè¢«ä½¿ç¨è¿çæ§è¡æ件
find /usr/bin -type f -mtime - æç´¢å¨å¤©å 被å建æè ä¿®æ¹è¿çæ件
find / -name \*.rpm -exec chmod '{ }' \; æ索以 '.rpm' ç»å°¾çæ件并å®ä¹å ¶æé
find / -xdev -name \*.rpm æ索以 '.rpm' ç»å°¾çæ件ï¼å¿½ç¥å 驱ãæ·ççå¯ç§»å¨è®¾å¤
locate \*.ps 寻æ¾ä»¥ '.ps' ç»å°¾çæ件 - å è¿è¡ 'updatedb' å½ä»¤
whereis halt æ¾ç¤ºä¸ä¸ªäºè¿å¶æ件ãæºç æmançä½ç½®
which halt æ¾ç¤ºä¸ä¸ªäºè¿å¶æ件æå¯æ§è¡æ件çå®æ´è·¯å¾
æè½½ä¸ä¸ªæ件系ç»
mount /dev/hda2 /mnt/hda2 æè½½ä¸ä¸ªå«åhda2çç - ç¡®å®ç®å½ '/ mnt/hda2' å·²ç»åå¨
umount /dev/hda2 å¸è½½ä¸ä¸ªå«åhda2çç - å ä»æè½½ç¹ '/ mnt/hda2' éåº
fuser -km /mnt/hda2 å½è®¾å¤ç¹å¿æ¶å¼ºå¶å¸è½½
umount -n /mnt/hda2 è¿è¡å¸è½½æä½èä¸åå ¥ /etc/mtab æ件- å½æ件为åªè¯»æå½ç£çå满æ¶é常æç¨
mount /dev/fd0 /mnt/floppy æè½½ä¸ä¸ªè½¯ç
mount /dev/cdrom /mnt/cdrom æè½½ä¸ä¸ªcdromædvdrom
mount /dev/hdc /mnt/cdrecorder æè½½ä¸ä¸ªcdrwædvdrom
mount /dev/hdb /mnt/cdrecorder æè½½ä¸ä¸ªcdrwædvdrom
mount -o loop file.iso /mnt/cdrom æè½½ä¸ä¸ªæ件æISOéåæ件
mount -t vfat /dev/hda5 /mnt/hda5 æè½½ä¸ä¸ªWindows FATæ件系ç»
mount /dev/sda1 /mnt/usbdisk æè½½ä¸ä¸ªusb æ·çæéªå设å¤
mount -t smbfs -o username=user,password=pass //WinClient/share /mnt/share æè½½ä¸ä¸ªwindowsç½ç»å ±äº«
ç£ç空é´
df -h æ¾ç¤ºå·²ç»æè½½çååºå表
ls -lSr |more 以尺寸大å°æåæ件åç®å½
du -sh dir1 ä¼°ç®ç®å½ 'dir1' å·²ç»ä½¿ç¨çç£ç空é´'
du -sk * | sort -rn 以容é大å°ä¸ºä¾æ®ä¾æ¬¡æ¾ç¤ºæ件åç®å½ç大å°
rpm -q -a --qf '%{ SIZE}t%{ NAME}n' | sort -k1,1n 以大å°ä¸ºä¾æ®ä¾æ¬¡æ¾ç¤ºå·²å®è£ çrpmå æ使ç¨çç©ºé´ (fedora, redhat类系ç»)
dpkg-query -W -f='${ Installed-Size;}t${ Package}n' | sort -k1,1n 以大å°ä¸ºä¾æ®æ¾ç¤ºå·²å®è£ çdebå æ使ç¨çç©ºé´ (ubuntu, debian类系ç»)
è¿å顶é¨ç´¢å¼ ^
ç¨æ·å群ç»
groupadd group_name å建ä¸ä¸ªæ°ç¨æ·ç»
groupdel group_name å é¤ä¸ä¸ªç¨æ·ç»
groupmod -n new_group_name old_group_name éå½åä¸ä¸ªç¨æ·ç»
useradd -c "Name Surname " -g admin -d /home/user1 -s /bin/bash user1 å建ä¸ä¸ªå±äº "admin" ç¨æ·ç»çç¨æ·
useradd user1 å建ä¸ä¸ªæ°ç¨æ·
userdel -r user1 å é¤ä¸ä¸ªç¨æ· ( '-r' æé¤ä¸»ç®å½)
usermod -c "User FTP" -g system -d /ftp/user1 -s /bin/nologin user1 ä¿®æ¹ç¨æ·å±æ§
passwd ä¿®æ¹å£ä»¤
passwd user1 ä¿®æ¹ä¸ä¸ªç¨æ·çå£ä»¤ (åªå 许rootæ§è¡)
chage -E -- user1 设置ç¨æ·å£ä»¤ç失ææé
pwck æ£æ¥ '/etc/passwd' çæä»¶æ ¼å¼åè¯æ³ä¿®æ£ä»¥ååå¨çç¨æ·
grpck æ£æ¥ '/etc/passwd' çæä»¶æ ¼å¼åè¯æ³ä¿®æ£ä»¥ååå¨ç群ç»
newgrp group_name ç»éè¿ä¸ä¸ªæ°ç群ç»ä»¥æ¹åæ°å建æ件çé¢è®¾ç¾¤ç»
è¿å顶é¨ç´¢å¼ ^
æ件çæé - ä½¿ç¨ "+" 设置æéï¼ä½¿ç¨ "-" ç¨äºåæ¶
ls -lh æ¾ç¤ºæé
ls /tmp | pr -T5 -W$COLUMNS å°ç»ç«¯ååæ5æ æ¾ç¤º
chmod ugo+rwx directory1 设置ç®å½çææ人(u)ã群ç»(g)以åå ¶ä»äºº(o)以读ï¼r ï¼ãå(w)åæ§è¡(x)çæé
chmod go-rwx directory1 å é¤ç¾¤ç»(g)ä¸å ¶ä»äºº(o)对ç®å½ç读åæ§è¡æé
chown user1 file1 æ¹åä¸ä¸ªæ件çææ人å±æ§
chown -R user1 directory1 æ¹åä¸ä¸ªç®å½çææ人å±æ§å¹¶åæ¶æ¹åæ¹ç®å½ä¸æææ件çå±æ§
chgrp group1 file1 æ¹åæ件ç群ç»
chown user1:group1 file1 æ¹åä¸ä¸ªæ件çææ人å群ç»å±æ§
find / -perm -u+s ç½åä¸ä¸ªç³»ç»ä¸ææ使ç¨äºSUIDæ§å¶çæ件
chmod u+s /bin/file1 设置ä¸ä¸ªäºè¿å¶æ件ç SUID ä½ - è¿è¡è¯¥æ件çç¨æ·ä¹è¢«èµäºåææè åæ ·çæé
chmod u-s /bin/file1 ç¦ç¨ä¸ä¸ªäºè¿å¶æ件ç SUIDä½
chmod g+s /home/public 设置ä¸ä¸ªç®å½çSGID ä½ - 类似SUID ï¼ä¸è¿è¿æ¯é对ç®å½ç
chmod g-s /home/public ç¦ç¨ä¸ä¸ªç®å½ç SGID ä½
chmod o+t /home/public 设置ä¸ä¸ªæ件ç STIKY ä½ - åªå 许åæ³ææ人å é¤æ件
chmod o-t /home/public ç¦ç¨ä¸ä¸ªç®å½ç STIKY ä½
è¿å顶é¨ç´¢å¼ ^
æ件çç¹æ®å±æ§ - ä½¿ç¨ "+" 设置æéï¼ä½¿ç¨ "-" ç¨äºåæ¶
chattr +a file1 åªå 许以追å æ¹å¼è¯»åæ件
chattr +c file1 å 许è¿ä¸ªæ件è½è¢«å æ ¸èªå¨å缩/解å
chattr +d file1 å¨è¿è¡æ件系ç»å¤ä»½æ¶ï¼dumpç¨åºå°å¿½ç¥è¿ä¸ªæ件
chattr +i file1 设置æä¸å¯åçæ件ï¼ä¸è½è¢«å é¤ãä¿®æ¹ãéå½åæè é¾æ¥
chattr +s file1 å 许ä¸ä¸ªæ件被å®å ¨å°å é¤
chattr +S file1 ä¸æ¦åºç¨ç¨åºå¯¹è¿ä¸ªæ件æ§è¡äºåæä½ï¼ä½¿ç³»ç»ç«å»æä¿®æ¹çç»æåå°ç£ç
chattr +u file1 è¥æ件被å é¤ï¼ç³»ç»ä¼å è®¸ä½ å¨ä»¥åæ¢å¤è¿ä¸ªè¢«å é¤çæ件
lsattr æ¾ç¤ºç¹æ®çå±æ§
è¿å顶é¨ç´¢å¼ ^
æå åå缩æ件
bunzip2 file1.bz2 解åä¸ä¸ªå«å 'file1.bz2'çæ件
bzip2 file1 å缩ä¸ä¸ªå«å 'file1' çæ件
gunzip file1.gz 解åä¸ä¸ªå«å 'file1.gz'çæ件
gzip file1 å缩ä¸ä¸ªå«å 'file1'çæ件
gzip -9 file1 æ大ç¨åº¦å缩
rar a file1.rar test_file å建ä¸ä¸ªå«å 'file1.rar' çå
rar a file1.rar file1 file2 dir1 åæ¶å缩 'file1', 'file2' 以åç®å½ 'dir1'
rar x file1.rar 解årarå
unrar x file1.rar 解årarå
tar -cvf archive.tar file1 å建ä¸ä¸ªéå缩ç tarball
tar -cvf archive.tar file1 file2 dir1 å建ä¸ä¸ªå å«äº 'file1', 'file2' 以å 'dir1'çæ¡£æ¡æ件
tar -tf archive.tar æ¾ç¤ºä¸ä¸ªå ä¸çå 容
tar -xvf archive.tar éæ¾ä¸ä¸ªå
tar -xvf archive.tar -C /tmp å°å缩å éæ¾å° /tmpç®å½ä¸
tar -cvfj archive.tar.bz2 dir1 å建ä¸ä¸ªbzip2æ ¼å¼çå缩å
tar -xvfj archive.tar.bz2 解åä¸ä¸ªbzip2æ ¼å¼çå缩å
tar -cvfz archive.tar.gz dir1 å建ä¸ä¸ªgzipæ ¼å¼çå缩å
tar -xvfz archive.tar.gz 解åä¸ä¸ªgzipæ ¼å¼çå缩å
zip file1.zip file1 å建ä¸ä¸ªzipæ ¼å¼çå缩å
zip -r file1.zip file1 file2 dir1 å°å 个æ件åç®å½åæ¶å缩æä¸ä¸ªzipæ ¼å¼çå缩å
unzip file1.zip 解åä¸ä¸ªzipæ ¼å¼å缩å
è¿å顶é¨ç´¢å¼ ^
RPM å - ï¼Fedora, Redhatå类似系ç»ï¼
rpm -ivh package.rpm å®è£ ä¸ä¸ªrpmå
rpm -ivh --nodeeps package.rpm å®è£ ä¸ä¸ªrpmå è忽ç¥ä¾èµå ³ç³»è¦å
rpm -U package.rpm æ´æ°ä¸ä¸ªrpmå ä½ä¸æ¹åå ¶é ç½®æ件
rpm -F package.rpm æ´æ°ä¸ä¸ªç¡®å®å·²ç»å®è£ çrpmå
rpm -e package_name.rpm å é¤ä¸ä¸ªrpmå
rpm -qa æ¾ç¤ºç³»ç»ä¸ææå·²ç»å®è£ çrpmå
rpm -qa | grep mand <> file1_in.txt_or_file1_out.txt general syntax for text manipulation using PIPE, STDIN and STDOUT
cat file1 | command( sed, grep, awk, grep, etc...) > result.txt å并ä¸ä¸ªæ件ç详ç»è¯´æææ¬ï¼å¹¶å°ç®ä»åå ¥ä¸ä¸ªæ°æ件ä¸
cat file1 | command( sed, grep, awk, grep, etc...) >> result.txt å并ä¸ä¸ªæ件ç详ç»è¯´æææ¬ï¼å¹¶å°ç®ä»åå ¥ä¸ä¸ªå·²æçæ件ä¸
grep Aug /var/log/messages å¨æ件 '/var/log/messages'ä¸æ¥æ¾å ³é®è¯"Aug"
grep ^Aug /var/log/messages å¨æ件 '/var/log/messages'ä¸æ¥æ¾ä»¥"Aug"å¼å§çè¯æ±
grep [0-9] /var/log/messages éæ© '/var/log/messages' æ件ä¸ææå å«æ°åçè¡
grep Aug -R /var/log/* å¨ç®å½ '/var/log' åéåçç®å½ä¸æç´¢å符串"Aug"
sed 's/stringa1/stringa2/g' example.txt å°example.txtæ件ä¸ç "string1" æ¿æ¢æ "string2"
sed '/^$/d' example.txt ä»example.txtæ件ä¸å é¤ææ空ç½è¡
sed '/ *#/d; /^$/d' example.txt ä»example.txtæ件ä¸å é¤ææ注éå空ç½è¡
echo 'esempio' | tr '[:lower:]' '[:upper:]' å并ä¸ä¸åå æ ¼å 容
sed -e '1d' result.txt ä»æ件example.txt ä¸æé¤ç¬¬ä¸è¡
sed -n '/stringa1/p' æ¥çåªå å«è¯æ± "string1"çè¡
sed -e 's/ *$//' example.txt å é¤æ¯ä¸è¡æåç空ç½å符
sed -e 's/stringa1//g' example.txt ä»ææ¡£ä¸åªå é¤è¯æ± "string1" 并ä¿çå©ä½å ¨é¨
sed -n '1,5p;5q' example.txt æ¥çä»ç¬¬ä¸è¡å°ç¬¬5è¡å 容
sed -n '5p;5q' example.txt æ¥ç第5è¡
sed -e 's/*/0/g' example.txt ç¨å个é¶æ¿æ¢å¤ä¸ªé¶
cat -n file1 æ 示æ件çè¡æ°
cat example.txt | awk 'NR%2==1' å é¤example.txtæ件ä¸çææå¶æ°è¡
echo a b c | awk '{ print $1}' æ¥çä¸è¡ç¬¬ä¸æ
echo a b c | awk '{ print $1,$3}' æ¥çä¸è¡ç第ä¸å第ä¸æ
paste file1 file2 å并两个æ件æ两æ çå 容
paste -d '+' file1 file2 å并两个æ件æ两æ çå 容ï¼ä¸é´ç¨"+"åºå
sort file1 file2 æåºä¸¤ä¸ªæ件çå 容
sort file1 file2 | uniq ååºä¸¤ä¸ªæ件ç并é(éå¤çè¡åªä¿çä¸ä»½)
sort file1 file2 | uniq -u å é¤äº¤éï¼çä¸å ¶ä»çè¡
sort file1 file2 | uniq -d ååºä¸¤ä¸ªæ件ç交é(åªçä¸åæ¶åå¨äºä¸¤ä¸ªæ件ä¸çæ件)
comm -1 file1 file2 æ¯è¾ä¸¤ä¸ªæ件çå 容åªå é¤ 'file1' æå å«çå 容
comm -2 file1 file2 æ¯è¾ä¸¤ä¸ªæ件çå 容åªå é¤ 'file2' æå å«çå 容
comm -3 file1 file2 æ¯è¾ä¸¤ä¸ªæ件çå 容åªå é¤ä¸¤ä¸ªæä»¶å ±æçé¨å
è¿å顶é¨ç´¢å¼ ^
å符设置åæä»¶æ ¼å¼è½¬æ¢
dos2unix filedos.txt fileunix.txt å°ä¸ä¸ªææ¬æ件çæ ¼å¼ä»MSDOS转æ¢æUNIX
unix2dos fileunix.txt filedos.txt å°ä¸ä¸ªææ¬æ件çæ ¼å¼ä»UNIX转æ¢æMSDOS
recode ..HTML < page.txt > page.html å°ä¸ä¸ªææ¬æ件转æ¢æhtml
recode -l | more æ¾ç¤ºææå 许ç转æ¢æ ¼å¼
è¿å顶é¨ç´¢å¼ ^
æ件系ç»åæ
badblocks -v /dev/hda1 æ£æ¥ç£çhda1ä¸çåç£å
fsck /dev/hda1 ä¿®å¤/æ£æ¥hda1ç£çä¸linuxæ件系ç»çå®æ´æ§
fsck.ext2 /dev/hda1 ä¿®å¤/æ£æ¥hda1ç£çä¸ext2æ件系ç»çå®æ´æ§
e2fsck /dev/hda1 ä¿®å¤/æ£æ¥hda1ç£çä¸ext2æ件系ç»çå®æ´æ§
e2fsck -j /dev/hda1 ä¿®å¤/æ£æ¥hda1ç£çä¸ext3æ件系ç»çå®æ´æ§
fsck.ext3 /dev/hda1 ä¿®å¤/æ£æ¥hda1ç£çä¸ext3æ件系ç»çå®æ´æ§
fsck.vfat /dev/hda1 ä¿®å¤/æ£æ¥hda1ç£çä¸fatæ件系ç»çå®æ´æ§
fsck.msdos /dev/hda1 ä¿®å¤/æ£æ¥hda1ç£çä¸dosæ件系ç»çå®æ´æ§
dosfsck /dev/hda1 ä¿®å¤/æ£æ¥hda1ç£çä¸dosæ件系ç»çå®æ´æ§
è¿å顶é¨ç´¢å¼ ^
åå§åä¸ä¸ªæ件系ç»
mkfs /dev/hda1 å¨hda1ååºå建ä¸ä¸ªæ件系ç»
mke2fs /dev/hda1 å¨hda1ååºå建ä¸ä¸ªlinux ext2çæ件系ç»
mke2fs -j /dev/hda1 å¨hda1ååºå建ä¸ä¸ªlinux ext3(æ¥å¿å)çæ件系ç»
mkfs -t vfat -F /dev/hda1 å建ä¸ä¸ª FAT æ件系ç»
fdformat -n /dev/fd0 æ ¼å¼åä¸ä¸ªè½¯ç
mkswap /dev/hda3 å建ä¸ä¸ªswapæ件系ç»
è¿å顶é¨ç´¢å¼ ^
SWAPæ件系ç»
mkswap /dev/hda3 å建ä¸ä¸ªswapæ件系ç»
swapon /dev/hda3 å¯ç¨ä¸ä¸ªæ°çswapæ件系ç»
swapon /dev/hda2 /dev/hdb3 å¯ç¨ä¸¤ä¸ªswapååº
è¿å顶é¨ç´¢å¼ ^
å¤ä»½
dump -0aj -f /tmp/home0.bak /home å¶ä½ä¸ä¸ª '/home' ç®å½çå®æ´å¤ä»½
dump -1aj -f /tmp/home0.bak /home å¶ä½ä¸ä¸ª '/home' ç®å½ç交äºå¼å¤ä»½
restore -if /tmp/home0.bak è¿åä¸ä¸ªäº¤äºå¼å¤ä»½
rsync -rogpav --delete /home /tmp åæ¥ä¸¤è¾¹çç®å½
rsync -rogpav -e ssh --delete /home ip_address:/tmp éè¿SSHéérsync
rsync -az -e ssh --delete ip_addr:/home/public /home/local éè¿sshåå缩å°ä¸ä¸ªè¿ç¨ç®å½åæ¥å°æ¬å°ç®å½
rsync -az -e ssh --delete /home/local ip_addr:/home/public éè¿sshåå缩å°æ¬å°ç®å½åæ¥å°è¿ç¨ç®å½
dd bs=1M if=/dev/hda | gzip | ssh user@ip_addr 'dd of=hda.gz' éè¿sshå¨è¿ç¨ä¸»æºä¸æ§è¡ä¸æ¬¡å¤ä»½æ¬å°ç£ççæä½
dd if=/dev/sda of=/tmp/file1 å¤ä»½ç£çå 容å°ä¸ä¸ªæ件
tar -Puf backup.tar /home/user æ§è¡ä¸æ¬¡å¯¹ '/home/user' ç®å½ç交äºå¼å¤ä»½æä½
( cd /tmp/local/ && tar c . ) | ssh -C user@ip_addr 'cd /home/share/ && tar x -p' éè¿sshå¨è¿ç¨ç®å½ä¸å¤å¶ä¸ä¸ªç®å½å 容
( tar c /home ) | ssh -C user@ip_addr 'cd /home/backup-home && tar x -p' éè¿sshå¨è¿ç¨ç®å½ä¸å¤å¶ä¸ä¸ªæ¬å°ç®å½
tar cf - . | (cd /tmp/backup ; tar xf - ) æ¬å°å°ä¸ä¸ªç®å½å¤å¶å°å¦ä¸ä¸ªå°æ¹ï¼ä¿çåææéåé¾æ¥
find /home/user1 -name '*.txt' | xargs cp -av --target-directory=/home/backup/ --parents ä»ä¸ä¸ªç®å½æ¥æ¾å¹¶å¤å¶ææ以 '.txt' ç»å°¾çæ件å°å¦ä¸ä¸ªç®å½
find /var/log -name '*.log' | tar cv --files-from=- | bzip2 > log.tar.bz2 æ¥æ¾ææ以 '.log' ç»å°¾çæ件并åæä¸ä¸ªbzipå
dd if=/dev/hda of=/dev/fd0 bs= count=1 åä¸ä¸ªå° MBR (Master Boot Record)å 容å¤å¶å°è½¯ççå¨ä½
dd if=/dev/fd0 of=/dev/hda bs= count=1 ä»å·²ç»ä¿åå°è½¯ççå¤ä»½ä¸æ¢å¤MBRå 容
è¿å顶é¨ç´¢å¼ ^
å ç
cdrecord -v gracetime=2 dev=/dev/cdrom -eject blank=fast -force æ¸ ç©ºä¸ä¸ªå¯å¤åçå çå 容
mkisofs /dev/cdrom > cd.iso å¨ç£çä¸å建ä¸ä¸ªå ççisoéåæ件
mkisofs /dev/cdrom | gzip > cd_iso.gz å¨ç£çä¸å建ä¸ä¸ªå缩äºçå çisoéåæ件
mkisofs -J -allow-leading-dots -R -V "Label CD" -iso-level 4 -o ./cd.iso data_cd å建ä¸ä¸ªç®å½çisoéåæ件
cdrecord -v dev=/dev/cdrom cd.iso å»å½ä¸ä¸ªISOéåæ件
gzip -dc cd_iso.gz | cdrecord dev=/dev/cdrom - å»å½ä¸ä¸ªå缩äºçISOéåæ件
mount -o loop cd.iso /mnt/iso æè½½ä¸ä¸ªISOéåæ件
cd-paranoia -B ä»ä¸ä¸ªCDå ç转å½é³è½¨å° wav æ件ä¸
cd-paranoia -- "-3" ä»ä¸ä¸ªCDå ç转å½é³è½¨å° wav æ件ä¸ï¼åæ°-3ï¼
cdrecord --scanbus æ«ææ»çº¿ä»¥è¯å«scsiéé
dd if=/dev/hdc | md5sum æ ¡éªä¸ä¸ªè®¾å¤çmd5sumç¼ç ï¼ä¾å¦ä¸å¼ CD
è¿å顶é¨ç´¢å¼ ^
ç½ç» - ï¼ä»¥å¤ªç½åWIFIæ 线ï¼
ifconfig eth0 æ¾ç¤ºä¸ä¸ªä»¥å¤ªç½å¡çé ç½®
ifup eth0 å¯ç¨ä¸ä¸ª 'eth0' ç½ç»è®¾å¤
ifdown eth0 ç¦ç¨ä¸ä¸ª 'eth0' ç½ç»è®¾å¤
ifconfig eth0 ..1.1 netmask ...0 æ§å¶IPå°å
ifconfig eth0 promisc 设置 'eth0' ææ··æ模å¼ä»¥å æ¢æ°æ®å (sniffing)
dhclient eth0 以dhcp模å¼å¯ç¨ 'eth0'
route -n show routing table
route add -net 0/0 gw IP_Gateway configura default gateway
route add -net ..0.0 netmask ..0.0 gw ..1.1 configure static route to reach network '..0.0/'
route del 0/0 gw IP_gateway remove static route
echo "1" > /proc/sys/net/ipv4/ip_forward activate ip routing
hostname show hostname of system
host www.example.com lookup hostname to resolve name to ip address and viceversa(1)
nslookup www.example.com lookup hostname to resolve name to ip address and viceversa(2)
ip link show show link status of all interfaces
mii-tool eth0 show link status of 'eth0'
ethtool eth0 show statistics of network card 'eth0'
netstat -tup show all active network connections and their PID
netstat -tupl show all network services listening on the system and their PID
tcpdump tcp port show all HTTP traffic
iwlist scan show wireless networks
iwconfig eth1 show configuration of a wireless network card
hostname show hostname
host www.example.com lookup hostname to resolve name to ip address and viceversa
nslookup www.example.com lookup hostname to resolve name to ip address and viceversa
whois www.example.com lookup on Whois database
GO TOP INDEX ^
Microsoft Windows networks (SAMBA)
nbtscan ip_addr netbios name resolution
nmblookup -A ip_addr netbios name resolution
smbclient -L ip_addr/hostname show remote shares of a windows host
smbget -Rr smb://ip_addr/share like wget can download files from a host windows via smb
mount -t smbfs -o username=user,password=pass //WinClient/share /mnt/share mount a windows network share