ϵͳÐÅÏ¢
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 2007 ÏÔʾ2007ÄêµÄÈÕÀú±í
date 041217002007.00 ÉèÖÃÈÕÆÚºÍʱ¼ä - ÔÂÈÕʱ·ÖÄê.Ãë
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 0712250000 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 encoded in fromEncoding and converting it to toEncoding.
find . -maxdepth 1 -name *.jpg -print -exec convert "{}" -resize 80x60 "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 +100 ËÑË÷ÔÚ¹ýÈ¥100ÌìÄÚδ±»Ê¹ÓùýµÄÖ´ÐÐÎļþ
find /usr/bin -type f -mtime -10 ËÑË÷ÔÚ10ÌìÄÚ±»´´½¨»òÕßÐ޸ĹýµÄÎļþ
find / -name \*.rpm -exec chmod 755 '{}' \; ËÑË÷ÒÔ '.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 FAT32Îļþϵͳ
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 '%10{SIZE}t%{NAME}n' | sort -k1,1n ÒÔ´óСΪÒÀ¾ÝÒÀ´ÎÏÔʾÒÑ°²×°µÄrpm°üËùʹÓõĿռä (fedora, redhatÀàϵͳ)
dpkg-query -W -f='${Installed-Size;10}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 2005-12-31 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 -jxvf archive.tar.bz2 ½âѹһ¸öbzip2¸ñʽµÄѹËõ°ü
tar -cvfz archive.tar.gz dir1 ´´½¨Ò»¸ögzip¸ñʽµÄѹËõ°ü
tar -zxvf archive.tar.gz ½âѹһ¸ögzip¸ñʽµÄѹËõ°ü
zip file1.zip file1 ´´½¨Ò»¸özip¸ñʽµÄѹËõ°ü
zip -r file1.zip file1 file2 dir1 ½«¼¸¸öÎļþºÍĿ¼ͬʱѹËõ³ÉÒ»¸özip¸ñʽµÄѹËõ°ü
unzip file1.zip ½âѹһ¸özip¸ñʽѹËõ°ü