Linux命令行大全

以下是转载:

Linux的命令行操作简洁效率高,就是数量有点多.

linuxguide.it整理了多达350条以上的Linux命令行命令,并给出了相应的说明可供您速查用.

无论是Linux新手还是老鸟都应该留一份备用,毕竟日常工作中我们不能带着参考书走.

收藏分享

[fly]深度会员专用博客[/fly]

メGo▪Vistaメ爱好者聚集处我要加入メ重装深度精简系统前的必备工作:驱动备份!教你制作驱动自动安装包上自己的网,让别人去说吧!

gdh

*发短消息

*加为好友

gdh当前离线

daybyday

精华

6

积分

1474

阅读权限

80

来自

メGo▪Vistaメ

最后登录

2010-5-3

查看个人网站查看详细资料



本人妖不在,留言给我当前离线

UID:13751

发帖:6805(6)

威望:1151点

RO币:3074RO

失踪天数:147天

在线时间:2028小时

注册时间:2006-2-12

最后登录:2010-5-3

深度一等功臣勋章深度建设者勋章

沙发

发表于2008-1-703:23|只看该作者

LinuxCommandsLine-v1.0

COMMANDDESCRIPTION

Systeminformation

archshowarchitectureofmachine

uname-rshowusedkernelversion

dmidecode-qshowhardwaresystemcomponents-(SMBIOS/DMI)

hdaparm-i/dev/hdadisplaysthecharacteristicsofahard-disk

hdparm-tT/dev/sdaperformtestreadingonahard-disk

cat/proc/cpuinfoshowinformationCPUinfo

cat/proc/interruptsshowinterrupts

cat/proc/meminfoverifymemoryuse

cat/proc/swapsshowfile(s)swap

cat/proc/versionshowversionofthekernel

cat/proc/net/devshownetworkadptersandstatistics

cat/proc/mountsshowmountedfilesystem(s)

lspci-tvdisplayPCIdevices

lsusb-tvshowUSBdevices

dateshowsystemdate

cal2007showthetimetableof2007

date041217002007.00setdateandtime-MonthDayhoursMinutesYear.Secondi

clock-w

savechangesonBIOS

Shutdown,RestartofasystemandLogout

shutdown-hnowshutdownsystem

init0

shutdown-rhours:minutes&plannedshutdownofthesystem

shutdown-ccancelaplannedshutdownofthesystem

shutdown-rnowreboot

reboot

logoutleavingsession

FilesandDirectory

cd/homeentertodirectory'/home'

cd..gobackonelevel

cd../..gobacktwolevels

cdgotohomedirectory

cd~utentegotohomedirectory

cd-gotopreviousdirectory

pwdshowthepathofworkdirectory

lsviewfilesofdirectory

ls-Fviewfilesofdirectory

ls-lshowdetailsoffilesanddirectory

ls-ashowhiddenfiles

ls*[0-9]*showfilesanddirectorycontainingnumbers

lstreeshowfilesanddirectoriesinatreestartingfromroot

mkdirdir1createadirectorycalled'dir1'

mkdirdir1dir2createtwodirectoriessimultaneously

mkdir-p/tmp/dir1/dir2createadirectorytree

rm-ffile1deletefilecalled'file1'

rmdirdir1deletedirectorycalled'dir1'

rm-rfdir1removeadirectorycalled'dir1'andcontentsrecursively

rm-rfdir1dir2removetwodirectoriesandtheircontentsrecursively

mvdir1new_dirrename/moveafileordirectory

cpfile1file2copyingafile

cpdir/*.copyallfilesofadirectorywithinthecurrentworkdirectory

cp-a/tmp/dir1.copyadirectorywithinthecurrentworkdirectory

cp-adir1dir2copyadirectory

ln-sfile1lnk1createasymboliclinktofileordirectory

lnfile1lnk1createaphysicallinktofileordirectory

touch-t0712250000fileditestmodifytimestampofafileordirectory-(YYMMDDhhmm)

[fly]深度会员专用博客[/fly]

メGo▪Vistaメ爱好者聚集处我要加入メ重装深度精简系统前的必备工作:驱动备份!教你制作驱动自动安装包上自己的网,让别人去说吧!

TOP

gdh

*发短消息

*加为好友

gdh当前离线

daybyday

精华

6

积分

1474

阅读权限

80

来自

メGo▪Vistaメ

最后登录

2010-5-3

查看个人网站查看详细资料



本人妖不在,留言给我当前离线

UID:13751

发帖:6805(6)

威望:1151点

RO币:3074RO

失踪天数:147天

在线时间:2028小时

注册时间:2006-2-12

最后登录:2010-5-3

深度一等功臣勋章深度建设者勋章

藤椅

发表于2008-1-703:24|只看该作者

Filesearch

find/-namefile1searchfileanddirectoryintorootfilesystemfrom'/'

find/-useruser1searchfilesanddirectoriesbelongingto'user1'

find/home/user1-name*.binsearchfileswith'.bin'extensionwithindirectory'/home/user1'

find/usr/bin-typef-atime+100searchbynaryfilesarenotusedinthelast100days

find/usr/bin-typef-mtime-10searchfilescreatedorchangedwithin10days

find/-name*.rpm-execchmod755{};searchfileswith'.rpm'extensionandmodifypermits

find/-name*.rpm-xdevsearchfileswith'.rpm'extensionignoringremovablepartitionsascdrom,pen-drive,etc.…

locate*.psfindfileswiththe'.ps'extension-firstrun'updatedb'command

whereishaltshowlocationofabinaryfile,sourceorman

whichhaltshowfullpathtoabinary/executable

linuxcommandslinev1.0-LinuxGuide.it

MountingaFilesystem

mount/dev/hda2/mnt/hda2mountdiskcalledhda2-verifyexistenceofthedirectory'/mnt/hda2'

umount/dev/hda2unmountdiskcalledhda2-exitfrommountpoint'/mnt/hda2'first

fuser-km/mnt/hda2forceumountwhenthedeviceisbusy

umount-n/mnt/hda2runumountwithoutwritingthefile/etc/mtab-usefulwhenthefileisread-onlyortheharddiskisfull

mount/dev/fd0/mnt/floppymountafloppydisk

mount/dev/cdrom/mnt/cdrommountacdrom/dvdrom

mount/dev/hdc/mnt/cdrecordermountacdrw/dvdrom

mount/dev/hdb/mnt/cdrecordermountacdrw/dvdrom

mount-oloopfile.iso/mnt/cdrommountafileorisoimage

mount-tvfat/dev/hda5/mnt/hda5mountaWindowsFAT32filesystem

mount/dev/sda1/mnt/usbdiskmountausbpen-driveorflash-drive

mount-tsmbfs-ousername=user,password=pass//winclient/share/mnt/sharemountawindowsnetworkshare

linuxcommandslinev1.0-LinuxGuide.it

DiskSpace

df-hshowlistofpartitionsmounted

ls-lSr|moreshowsizeofthefilesanddirectoriesorderedbysize

du-shdir1estimatespaceusedbydirectory'dir1'

du-sh*|sort-rnshowsizeofthefilesanddirectoriessortedbysize

rpm-q-a--qf'%10{SIZE}\t%{NAME}\n'|sort-k1,1nshowspaceusedbyrpmpackagesinstalledsortedbysize(fedora,redhatandlike)

dpkg-query-W-f='${Installed-Size;10}\t${Package}\n'|sort-k1,1nshowspaceusedbydebpackagesinstalledsortedbysize(ubuntu,debianandlike)

linuxcommandslinev1.0-LinuxGuide.it

UsersandGroups

groupaddgroup_namecreateanewgroup

groupdelgroup_namedeleteagroup

groupmod-nnew_group_nameold_group_namerenameagroup

useradd-c"NomeCognome"-gadmin-d/home/user1-s/bin/bashuser1createanewuserbelongs"admin"group

useradduser1createanewuser

userdel-ruser1deleteauser('-r'eliminateshomedirectory)

usermod-c"UserFTP"-gsystem-d/ftp/user1-s/bin/nologinuser1changeuserattributes

passwdchangepassword

passwduser1changeauserpassword(onlybyroot)

chage-E2005-12-31user1setdeadlineforuserpassword

pwckcheckcorrectsyntaxandfileformatof'/etc/passwd'andusersexistence

grpckcheckcorrectsyntaxandfileformatof'/etc/group'andgroupsexistence

newgrpgroup_namelogintoanewgrouptochangedefaultgroupofnewlycreatedfiles

aliashh='history'setanaliasforacommand-hh=history

linuxcommandslinev1.0-LinuxGuide.it

PermitsonFile-use"+"tosetpermissionsand"-"toremove

ls-lhshowpermits

ls/tmp|pr-T5-W$COLUMNSdivideterminalinto5columns

chmodugo+rwxdirectory1setpermissionsreading(r),write(w)and(x)accesstousersowner(u)group(g)andothers(o)

chmodgo-rwxdirectory1removepermitsreading(r),write(w)and(x)accesstousersgroup(g)andothers(or

chownuser1file1changeownerofafile

chownuser1-Rdirectory1changeuserownerofadirectoryandallthefilesanddirectoriescontainedinside

chgrpgruppo1file1changegroupoffiles

chownuser1:gruppo1file1changeuserandgroupownershipofafile

find/-perm-u+sviewallfilesonthesystemwithSUIDconfigured

chmodu+s/bin/file_eseguibilesetSUIDbitonabinaryfile-theuserthatrunningthatfilegetssameprivilegesasowner

chmodu-s/bin/file_binariodisableSUIDbitonabinaryfile

chmodg+s/home/publicsetSGIDbitonadirectory-similartoSUIDbutfordirectory

chmodg-s/home/publicdisableSGIDbitonadirectory

chmodo+t/home/comunesetSTIKYbitonadirectory-allowsfilesdeletiononlytolegitimateowners

chmodo-t/home/comunedisableSTIKYbitonadirectory

[fly]深度会员专用博客[/fly]

メGo▪Vistaメ爱好者聚集处我要加入メ重装深度精简系统前的必备工作:驱动备份!教你制作驱动自动安装包上自己的网,让别人去说吧!

TOP

gdh

*发短消息

*加为好友

gdh当前离线

daybyday

精华

6

积分

1474

阅读权限

80

来自

メGo▪Vistaメ

最后登录

2010-5-3

查看个人网站查看详细资料



本人妖不在,留言给我当前离线

UID:13751

发帖:6805(6)

威望:1151点

RO币:3074RO

失踪天数:147天

在线时间:2028小时

注册时间:2006-2-12

最后登录:2010-5-3

深度一等功臣勋章深度建设者勋章

板凳

发表于2008-1-703:24|只看该作者

SpecialAttributesonfile-use"+"tosetpermissionsand"-"toremove

chattr+afile1allowswriteopeningofafileonlyappendmode

chattr+cfile1allowsthatafileiscompressed/decompressedautomaticallybythekernel

chattr+dfile1makessurethattheprogramignoresDumpthefilesduringbackup

chattr+ifile1makesitanimmutablefile,whichcannotberemoved,altered,renamedorlinked

chattr+sfile1allowsafiletobedeletedsafely

chattr+Sfile1makessurethatifafileismodifiedchangesarewritteninsynchronousmodeaswithsync

chattr+ufile1allowsyoutorecoverthecontentsofafileevenifitiscanceled

lsattrshowspecialsattributes

linuxcommandslinev1.0-LinuxGuide.it

Archivesandcompressedfiles

bunzip2file1.bz2decompressafilecalled'file1.bz2'

bzip2file1compressafilecalled'file1'

gunzipfile1.gzdecompressafilecalled'file1.gz'

gzipfile1compressafilecalled'file1'

gzip-9file1compresswithmaximumcompression

rarafile1.rartest_filecreateanarchiverarcalled'file1.rar'

rarafile1.rarfile1file2dir1compress'file1','file2'and'dir1'simultaneously

rarxfile1.rardecompressrararchive

unrarxfile1.rardecompressrararchive

tar-cvfarchive.tarfile1createauncompressedtarball

tar-cvfarchive.tarfile1file2dir1createanarchivecontaining'file1','file2'and'dir1'

tar-tfarchive.tarshowcontentsofanarchive

tar-xvfarchive.tarextractatarball

tar-xvfarchive.tar-C/tmpextractatarballinto/tmp

tar-cvfjarchive.tar.bz2dir1createatarballcompressedintobzip2

tar-xvfjarchive.tar.bz2decompressacompressedtararchiveinbzip2

tar-cvfzarchive.tar.gzdir1createatarballcompressedintogzip

tar-xvfzarchive.tar.gzdecompressacompressedtararchiveingzip

zipfile1.zipfile1createanarchivecompressedinzip

zip-rfile1.zipfile1file2dir1compressinzipseveralfilesanddirectoriessimultaneously

unzipfile1.zipdecompressaziparchive

linuxcommandslinev1.0-LinuxGuide.it

RPMPackages-Fedora,RedHatandlike

rpm-ivhpackage.rpminstallarpmpackage

rpm-ivh--nodeepspackage.rpminstallarpmpackageignoringdependenciesrequests

rpm-Upackage.rpmupgradearpmpackagewithoutchangingconfigurationfiles

rpm-Fpackage.rpmupgradearpmpackageonlyifitisalreadyinstalled

rpm-epackage_name.rpmremovearpmpackage

rpm-qashowallrpmpackagesinstalledonthesystem

rpm-qa|grephttpdshowallrpmpackageswiththename"httpd"

rpm-qipackage_nameobtaininformationonaspecificpackageinstalled

rpm-qg"SystemEnvironment/Daemons"showrpmpackagesofagroupsoftware

rpm-qlpackage_nameshowlistoffilesprovidedbyarpmpackageinstalled

rpm-qcpackage_nameshowlistofconfigurationfilesprovidedbyarpmpackageinstalled

rpm-qpackage_name--whatrequiresshowlistofdependenciesrequiredforarpmpacket

rpm-qpackage_name--whatprovidesshowcapabilityprovidedbyarpmpackage

rpm-qpackage_name--scriptsshowscriptsstartedduringinstallation/removal

rpm-qpackage_name--changelogshowhistoryofrevisionsofarpmpackage

rpm-qf/etc/httpd/conf/httpd.confverifywhichrpmpackagebelongstoagivenfile

rpm-qppackage.rpm-lshowlistoffilesprovidedbyarpmpackagenotyetinstalled

rpm--import/media/cdrom/RPM-GPG-KEYimportpublic-keydigitalsignature

rpm--checksigpackage.rpmverifytheintegrityofarpmpackage

rpm-qagpg-pubkeyverifyintegrityofallrpmpackagesinstalled

rpm-Vpackage_namecheckfilesize,permissions,type,owner,group,MD5checksumandlastmodification

rpm-Vacheckallrpmpackagesinstalledonthesystem-usewithcaution

rpm-Vppackage.rpmverifyarpmpackagenotyetinstalled

rpm2cpiopackage.rpm|cpio--extract--make-directories*bin*extractexecutablefilefromarpmpackage

rpm-ivh/usr/src/redhat/RPMS/`arch`/package.rpminstallapackagebuiltfromarpmsource

rpmbuild--rebuildpackage_name.src.rpmbuildarpmpackagefromarpmsource

linuxcommandslinev1.0-LinuxGuide.it

YUMpackagesupdater-Fedora,RedHatandlike

yuminstallpackage_namedownloadandinstallarpmpackage

yumupdateupdateallrpmpackagesinstalledonthesystem

yumupdatepackage_nameupgradearpmpackage

yumremovepackage_nameremovearpmpackage

yumlistlistallpackagesinstalledonthesystem

yumsearchpackage_namefindapackageonrpmrepository

yumcleanpackagescleanuprpmcacheerasingdownloadedpackages

yumcleanheadersremoveallfilesheadersthatthesystemusestoresolvedependency

yumcleanallremovefromthecachepackagesandheadersfiles

linuxcommandslinev1.0-LinuxGuide.it

DEBpackages-Debian,Ubuntuandlike

dpkg-ipackage.debinstall/upgradeadebpackage

dpkg-rpackage_nameremoveadebpackagefromthesystem

dpkg-lshowalldebpackagesinstalledonthesystem

dpkg-l|grephttpdshowallrpmpackageswiththename"httpd"

dpkg-spackage_nameobtaininformationonaspecificpackageinstalledonsystem

dpkg-Lpackage_nameshowlistoffilesprovidedbyapackageinstalledonsystem

dpkg--contentspackage.debshowlistoffilesprovidedbyapackagenotyetinstalled

dpkg-S/bin/pingverifywhichpackagebelongstoagivenfile

linuxcommandslinev1.0-LinuxGuide.it

APTpackagesupdater-Debian,Ubuntuelike

apt-getinstallpackage_nameinstall/upgradeadebpackage

apt-cdrominstallpackage_nameinstall/upgradeadebpackagefromcdrom

apt-getupdateupdatealldebpackagesinstalledonsystem

apt-getremovepackage_nameremoveadebpackagefromsystem

apt-getcheckverifycorrectresolutionofdependencies

apt-getcleancleanupcachefrompackagesdownloaded

linuxcommandslinev1.0-LinuxGuide.it

Viewfilecontent

catfile1viewthecontentsofafilestartingfromthefirstrow

tacfile1viewthecontentsofafilestartingfromthelastline

morefile1viewcontentofafilealong

lessfile1similarto'more'commandbutwhichallowsbackwardmovementinthefileaswellasforwardmovement

head-2file1viewfirsttwolinesofafile

tail-2file1viewlasttwolinesofafile

tail-f/var/log/messagesviewinrealtimewhatisaddedtoafile

linuxcommandslinev1.0-LinuxGuide.it

TextManipulation

catfile_test|[operation:sed,grep,awk,grep,etc]>result.txtsyntaxtoelaboratethetextofafile,andwriteresulttoanewfile

catfile_originale|[operazione:sed,grep,awk,grep,etc]>>result.txtsyntaxtoelaboratethetextofafileandappendresultinexistingfile

grepAug/var/log/messageslookupwords"Aug"onfile'/var/log/messages'

grep^Aug/var/log/messageslookupwordsthatbeginwith"Aug"onfile'/var/log/messages'

grep[0-9]/var/log/messagesselectfromfile'/var/log/messages'alllinesthatcontainnumbers

grepAug-R/var/log/*searchstring"Aug"atdirectory'/var/log'andbelow

grepAug/var/log/messageswriteresultofasearchwithinafile

sed's/stringa1/stringa2/g'example.txtreplace"string1"with"string2"inexample.txt

sed'/^$/d'example.txtremoveallblanklinesfromexample.txt

sed'/*#/d;/^*$/d'example.txtremovecommentsandblanklinesfromexample.txt

echo'esempio'|tr'[:lower:]''[:upper:]'convertfromlowercaseinuppercase

sed-e'1d'result.txteliminatesthefirstlinefromfileexample.txt

sed-n'/stringa1/p'viewonlylinesthatcontaintheword"string1"

sed-e's/*$//'example.txtremoveemptycharactersattheendofeachrow

sed-e's/stringa1//g'example.txtremoveonlytheword"string1"fromtextandleaveintactall

sed-n'1,5p;5q'example.txtviewfrom1thto5throw

sed-n'5p;5q'example.txtviewrownumber5

sed-e's/00*/0/g'example.txtreplacemorezeroswithasinglezero

cat-nfile1numberrowofafile

catexample.txt|awk'NR%2==1'removeallevenlinesfromexample.txt

echoabc|awk'{print$1}'viewthefirstcolumnofaline

echoabc|awk'{print$1,$3}'viewthefirstandthirdcolumnofaline

pastefile1file2mergingcontentsoftwofilesforcolumns

paste-d'+'file1file2mergingcontentsoftwofilesforcolumnswith'+'delimiteronthecenter

sortfile1file2sortcontentsoftwofiles

sortfile1file2|uniqsortcontentsoftwofilesomittinglinesrepeated

sortfile1file2|uniq-usortcontentsoftwofilesbyviewingonlyuniqueline

sortfile1file2|uniq-dsortcontentsoftwofilesbyviewingonlyduplicateline

comm-1file1file2comparecontentsoftwofilesbydeletingonlyuniquelinesfrom'file1'

comm-2file1file2comparecontentsoftwofilesbydeletingonlyuniquelinesfrom'file2'

comm-3file1file2comparecontentsoftwofilesbydeletingonlythelinesthatappearonbothfiles

[fly]深度会员专用博客[/fly]

メGo▪Vistaメ爱好者聚集处我要加入メ重装深度精简系统前的必备工作:驱动备份!教你制作驱动自动安装包上自己的网,让别人去说吧!

TOP

gdh

*发短消息

*加为好友

gdh当前离线

daybyday

精华

6

积分

1474

阅读权限

80

来自

メGo▪Vistaメ

最后登录

2010-5-3

查看个人网站查看详细资料



本人妖不在,留言给我当前离线

UID:13751

发帖:6805(6)

威望:1151点

RO币:3074RO

失踪天数:147天

在线时间:2028小时

注册时间:2006-2-12

最后登录:2010-5-3

深度一等功臣勋章深度建设者勋章

地板

发表于2008-1-703:25|只看该作者

CharactersetandFormatfileconversion

dos2unixfiledos.txtfileunix.txtconvertatextfileformatfromMSDOStoUNIX

unix2dosfileunix.txtfiledos.txtconvertatextfileformatfromUNIXtoMSDOS

recode..HTML<page.txt>page.htmlconvertatextfiletohtml

recode-l|moreshowallavailableformatsconversion

linuxcommandslinev1.0-LinuxGuide.it

FilesystemAnalysis

badblocks-v/dev/hda1checkbadblocksindiskhda1

fsck/dev/hda1repair/checkintegrityoflinuxfilesystemondiskhda1

fsck.ext2/dev/hda1repair/checkintegrityofext2filesystemondiskhda1

e2fsck/dev/hda1repair/checkintegrityofext2filesystemondiskhda1

e2fsck-j/dev/hda1repair/checkintegrityofext3filesystemondiskhda1

fsck.ext3/dev/hda1repair/checkintegrityofext3filesystemondiskhda1

fsck.vfat/dev/hda1repair/checkintegrityoffatfilesystemondiskhda1

fsck.msdos/dev/hda1repair/checkintegrityofdosfilesystemondiskhda1

dosfsck/dev/hda1repair/checkintegrityofdosfilesystemsondiskhda1

linuxcommandslinev1.0-LinuxGuide.it

FormataFilesystem

mkfs/dev/hda1createafilesystemtypelinuxonhda1partition

mke2fs/dev/hda1createafilesystemtypelinuxext2onhda1partition

mke2fs-j/dev/hda1createafilesystemtypelinuxext3(journal)onhda1partition

mkfs-tvfat32-F/dev/hda1createaFAT32filesystem

fdformat-n/dev/fd0formatafloppydisk

mkswap/dev/hda3createaswapfilesystem

linuxcommandslinev1.0-LinuxGuide.it

SWAPfilesystem

mkswap/dev/hda3createaswapfilesystem

swapon/dev/hda3activatinganewswappartition

swapon/dev/hda2/dev/hdb3activatetwoswappartitions

linuxcommandslinev1.0-LinuxGuide.it

Backup

dump-0aj-f/tmp/home0.bak/homemakeafullbackupofdirectory&#39;/home&#39;

dump-1aj-f/tmp/home0.bak/homemakeaincrementalbackupofdirectory&#39;/home&#39;

restore-if/tmp/home0.bakrestoringabackupinteractively

rsync-rogpav--delete/home/tmpsynchronizationbetweendirectories

rsync-rogpav-essh--delete/homeip_address:/tmprsyncviaSSHtunnel

rsync-az-essh--deleteip_addr:/home/public/home/localsynchronizealocaldirectorywitharemotedirectoryviasshandcompression

rsync-az-essh--delete/home/localip_addr:/home/publicsynchronizearemotedirectorywithalocaldirectoryviasshandcompression

ddbs=1Mif=/dev/hda|gzip|sshuser@ip_addr&#39;ddof=hda.gz&#39;makeabackupofalocalharddiskonremotehostviassh

tar-Pufbackup.tar/home/usermakeaincrementalbackupofdirectory&#39;/home/user&#39;

(cd/tmp/local/&&tarc.)|ssh-Cuser@ip_addr&#39;cd/home/share/&&tarx-p&#39;copycontentofadirectoryonremotedirectoryviassh

(tarc/home)|ssh-Cuser@ip_addr&#39;cd/home/backup-home&&tarx-p&#39;copyalocaldirectoryonremotedirectoryviassh

tarcf-.|(cd/tmp/backup;tarxf-)localcopypreservingpermitsandlinksfromadirectorytoanother

find/home/user1-name&#39;*.txt&#39;|xargscp-av--target-directory=/home/backup/--parentsfindandcopyallfileswith&#39;.txt&#39;extentionfromadirectorytoanother

find/var/log-name&#39;*.log&#39;|tarcv--files-from=-|bzip2>log.tar.bz2findallfileswith&#39;.log&#39;extentionandmakeanbziparchive

ddif=/dev/hdaof=/dev/fd0bs=512count=1makeacopyofMBR(MasterBootRecord)tofloppy

ddif=/dev/fd0of=/dev/hdabs=512count=1restoreMBRfrombackupcopysavedtofloppy

linuxcommandslinev1.0-LinuxGuide.it

CDROM

cdrecord-vgracetime=2dev=/dev/cdrom-ejectblank=fast-forcecleanarewritablecdrom

mkisofs/dev/cdrom>cd.isocreateanisoimageofcdromondisk

mkisofs/dev/cdrom|gzip>cd_iso.gzcreateacompressedisoimageofcdromondisk

mkisofs-J-allow-leading-dots-R-V"LabelCD"-iso-level4-o./cd.isodata_cdcreateanisoimageofadirectory

cdrecord-vdev=/dev/cdromcd.isoburnanISOimage

gzip-dccd_iso.gz|cdrecorddev=/dev/cdrom-burnacompressedISOimage

mount-oloopcd.iso/mnt/isomountanISOimage

cd-paranoia-BripaudiotracksfromaCDtowavfiles

cd-paranoia--"-3"ripfirstthreeaudiotracksfromaCDtowavfiles

cdrecord--scanbusscanbustoidentifythechannelscsi

linuxcommandslinev1.0-LinuxGuide.it

Networking-LANandWiFi

ifconfigeth0showconfigurationofanethernetnetworkcard

ifupeth0activateaninterface&#39;eth0&#39;

ifdowneth0disableaninterface&#39;eth0&#39;

ifconfigeth0192.168.1.1netmask255.255.255.0configureIPAddress

ifconfigeth0promiscconfigure&#39;eth0&#39;inpromiscuousmodetogatherpackets(sniffing)

dhclienteth0activeinterface&#39;eth0&#39;indhcpmode

route-nshowroutingtable

routeadd-net0/0gwIP_Gatewayconfiguradefaultgateway

routeadd-net192.168.0.0netmask255.255.0.0gw192.168.1.1configurestaticroutetoreachnetwork&#39;192.168.0.0/16&#39;

routedel0/0gwIP_gatewayremovestaticroute

echo"1">/proc/sys/net/ipv4/ip_forwardactivateiprouting

hostnameshowhostname

hostwww.linuxguide.itlookuphostnametoresolvenametoipaddressandviceversa

iplinkshowshowlinkstatusofallinterfaces

mii-tooleth0showlinkstatusof&#39;eth0&#39;

ethtooleth0showstatisticsofnetworkcard&#39;eth0&#39;

netstat-tupshowallactivenetworkconnectionsandtheirPID

netstat-tuplshowallnetworkserviceslisteningonthesystemandtheirPID

tcpdumptcpport80showallHTTPtraffic

iwlistscanshowwirelessnetworks

iwconfigeth1showconfigurationofawirelessnetworkcard

linuxcommandslinev1.0-LinuxGuide.it

MicrosoftWindowsnetworks-SAMBA

nbtscanip_addrnetbiosnameresolution

nmblookup-Aip_addrnetbiosnameresolution

smbclient-Lip_addr/hostnameshowremotesharesofawindowshost

smbget-Rrsmb://ip_addr/sharelikewgetcandownloadfilesfromahostwindowsviasmb

mount-tsmbfs-ousername=user,password=pass//winclient/share/mnt/sharemountawindowsnetworkshare

linuxcommandslinev1.0-LinuxGuide.it

IPTABLES-firewall

iptables-tfilter-Lshowallchainsoffilteringtable

iptables-tnat-Lshowallchainsofnattable

iptables-tfilter-Fclearallrulesfromfilteringtable

iptables-tnat-Fclearallrulesfromtablenat

iptables-tfilter-Xdeleteanychainscreatedbyuser

iptables-tfilter-AINPUT-ptcp--dporttelnet-jACCEPTallowtelnetconnectionstoinput

iptables-tfilter-AOUTPUT-ptcp--dporthttp-jDROPblockHTTPconnectionstooutput

iptables-tfilter-AFORWARD-ptcp--dportpop3-jACCEPTallowPOP3connectionstoforwardchain

iptables-tfilter-AINPUT-jLOG--log-prefix"DROPINPUT"loggingsullachaindiinputLoggingonchaininput

iptables-tnat-APOSTROUTING-oeth0-jMASQUERADEconfigureaPAT(PortAddressTraslation)oneth0maskingoutboundpackets

iptables-tnat-APREROUTING-d192.168.0.1-ptcp-mtcp--dport22-jDNAT--to-destination10.0.0.2:22redirectpacketsaddressedtoahosttoanotherhost

linuxcommandslinev1.0-LinuxGuide.it

Monitoringanddebugging

topdisplaylinuxtasksusingmostcpu

ps-eafwdisplayslinuxtasks

ps-e-opid,args--forestdisplayslinuxtasksinahierarchicalmode

pstreemostraunalberodeiprocessisistemaShowsatreesystemprocesses

kill-9ID_Processoforceclosureoftheprocessandfinishit

kill-1ID_Processoforceaprocesstoreloadconfiguration

lsof-p$$displayalistoffilesopenedbyprocesses

lsof/home/user1displaysalistofopenfilesinagivenpathsystem

strace-cls>/dev/nulldisplaysystemcallsmadeandreceivedbyaprocess

strace-f-eopenls>/dev/nulldisplaylibrarycalls

watch-n1&#39;cat/proc/interrupts&#39;displayinterruptsinreal-time

lastrebootshowhistoryreboot

lsmoddisplaykernelloaded

free-mdisplaysstatusofRAMinmegabytes

smartctl-A/dev/hdamonitoringreliabilityofahard-diskthroughSMART

smartctl-i/dev/hdacheckifSMARTisactiveonahard-disk

tail/var/log/dmesgshoweventsinherenttotheprocessofbootingkernel

tail/var/log/messagesshowsystemevents

linuxcommandslinev1.0-LinuxGuide.it

Otherusefulcommands

mkbootdisk--device/dev/fd0`uname-r`createabootfloppy

gpg-cfile1encryptafilewithGNUPrivacyGuard

gpgfile1.gpgdecryptafilewithGNUPrivacyGuard

wget-rwww.example.comdownloadanentirewebsite

wget-cwww.example.com/file.isodownloadafilewiththeabilitytostopthedownloadandresumelater

echo&#39;wget-cwww.example.com/files.iso&#39;|at09:00startadownloadatanygiventime

lddsshshowsharedlibrariesrequiredbysshprogram

相关推荐