Click here to load reader

Linux 基础知识

  • View
    165

  • Download
    2

Embed Size (px)

DESCRIPTION

Linux 基础知识. 一、常用基本命令. Bash Shell 常用控制符. ENTER/Ctrl m : 当前行结束 Ctrl d :终端的输入结束 Ctrl g :控制终端响铃 Ctrl h :退格键,用于改正输入的错误 DELETE/BREAK/Ctrl c :强行终止程序. Linux 常用命令. Linux 的命令(也包括文件名等等): 对大小写是敏感的 xxx --help :显示 xxx 的帮助 xxx --version :显示 xxx 的版本号 - PowerPoint PPT Presentation

Text of Linux 基础知识

  • Linux

  • Bash ShellENTER/Ctrl mCtrl dCtrl gCtrl hDELETE/BREAK/Ctrl c

  • LinuxLinux xxx --helpxxxxxx --versionxxxmanmanualhelp--help Tab

  • ls (list)dirDOSdirls-1-a-all.-A -a "." ".."-c-x-F*/-l-hk M G-L-r-R-S-t-u-X

  • cd (change directory) $ cd /mnt/harddisk/Program Filescd ~ = cd...-

  • cp (copy)-a-b~-d-f-i-l-p-r-R-s-u-xcp

  • mv (move)-b-backup-f -force-i-interactive-u -update

  • rm (remove)-r-d0fsck-f -i-i -f-r

  • mkdir (make directories)-mLinux-p

  • rmdir (remove directory)-p --ignore-fail-on-non-empty

  • tar [-xzvf] [] []-c-f-v-x-zgzipungzip-j bzipunzip.zip

  • gzipLinux.gz-c-d-I -r-t

  • 1ifconfigIPIRQI/O[] [IP]IPdownupnetmask[]eth0

  • 2talk$ talk user [tty-name]$ talk [email protected]$ write user [tty]$ msg [y/n]wall$ wall [messages]

  • Linux

  • cat (concatenate)1DOStype$ cat file1 file2 file1,file2-b-E$-n-s-TTab^I-vLFD^ASCII>127M--A = -vET-e = -vE-t =-vT

  • cat2cat$ catLinux is interesting!! ENTERLinux is interesting!!

  • cat3shell>>>e.g. file1file2file3$ cat file1 file2 > file3file3>>>> >

  • catcat > file1 Ctrl+cCtrl+dfile1file1

  • Linux-rw-r--r-- 1 root root 15228 2003-01-25 a2ps.cfg-rw-r--r-- 1 root root 2562 2003-01-25 a2ps-site.cfg-rw-r--r-- 1 root root 47 12 26 23:39 adjtimedrwxr-xr-x 2 root root 4096 2005-05-16 aep-rw-r--r-- 1 root root 688 2003-02-04 aep.conf

  • Linux-dbcpsmrWx-

  • find [] [] [] -name -type dc l -userwhereis locate

  • more/lessmorelessmorelessclearpwdtail tail f /var/log/exp 10 tail 30 /var/log/exphead head 10/var/log/exp

  • grep--i-I-L-r-v-w-x

  • wcword countwc-c-l-w

  • chmodusergroupothers124rwx4+2+1=7 rw-4+2=6 r-x4+1=5chown-R

  • lnln [] []ln [] ln[]

  • () Symbolic Linkln -s HardLinkln /inodels -i

  • Linux

  • 1login/logoutdmesg ( shift+PageUpshift+PageDown )su root root passwdpasswd [userid] : userid

  • 2shutdown$ shutdown $ shutdown h now ()halt$ shutdown r now ()$ shutdown h +10 System will reboot after ten minwhowhoamichsh shellchfnchownchgrpchmod

  • mount fdisk -l /dev/hda df -h du -sh uname -a Linuxecho $SYMBOL SYMBOL$ echo $PATH

  • mountmountLinux/etc/fstabumountmount mount -a/etc/fstab-n/etc/mtab-oman-r-t man

  • mountWindowsLinuxmountmountMission impossibleLinuxermount/etc/mtab

  • mountmount fat32 mount -o codepage=936, iocharset=cp936 /dev/hda7 /mnt/cdrom

    mount iso mount -o loop /ex.iso /mnt/cdrom

    mount mount /dev/fd0 /mnt/floppy

    mountmount -t iso9660 /dev/cdrom /mnt/cdrom

    mount USB mount /dev/sda1 /mnt/cdrom

    mount Sambamount -t smbfs -o codepage=cp936 //192.168.0.123/smbshare /home/usr/smb

  • umount-a/etc/mtab-n/etc/mtab-r-t

  • Linux

  • /etcLinuxx passwdfstabhostslilo.confprofileservicesshadowshells

  • passwd shadow /man{passwd} manual page

  • fstabmount a/etc/rcswapon amountmanual page

  • hostsipDNSip 127.0.0.1 localhost.localdomain localhost

  • lilo.conf LILO Tab

  • /etc/profileBourne ShellPATHUSERcroe

  • services inetdtelnettcpdump C

  • shadowshadow /etc/passwd/etc/shadowpwconvpwunconv shadowroot

  • shellsshellchshshellshellsshellFTPftpdshell/etc/shells

  • Linux/proc

  • /proc /proc ./proc

  • 1/proc/xx/proc/proc/cpuinfo/proc/devices/proc/dmaDMA/proc/filesystemsLinux

  • 2/proc/interrupts/proc/ioportsI/O/proc/kcore/proc/kmsgsyslog/proc/ksyms

  • 3/proc/loadavg/proc/meminfoswap/proc/modules/proc/net/proc/stat/proc/uptime

  • /proc/sys

  • /proc/sys/kernelthreads-max ctrl-alt-del 1 sysrq 1Alt-SysRq ostype hostname domainname modprobe

  • Linuxvi

  • vi

    viLinuxviCommand modeviInsert mode~ESCLast line mode

  • Insert modei : , a : , o : hjkl-+n- n n+ n Ctrl f Ctrl bCtrl d : Ctrl u : G

  • Last line modeset nu ---- /string ---- string?string ---- string:help ---- vi vi Command mode ':' Last line modew filename () wq ( vi) q! ()Ctrl z ---- vi shellfg ---- shell fg vi

  • XDelete ---- x ---- #x ---- # 5xd ---- D ---- dd ---- #dd ---- :n,md ---- n ~ m

  • yw ---- #yy/#Y ---- #P ---- p ----:n1,n2 m n3 ---- n1 ~ n2 move n3 :n1,n2 c n3 ---- n1 ~ n2 n3 v ---- V ---- Ctrl V ---- y ----

  • r ---- R ---- :s/string1/string2 ---- string1 string2:s/string1/string2/g ---- :%s/string1/string2/g ---- :n1,n2s/string1/string2/g ---- n1 ~ n2 string1string2

  • Linux

  • ps (process status)killaux-e/-A-fUIDPPIPCSTIME-w

  • ps2ps aux --- USER%CPU(CPU)%MEM()VSZ( )RSS( )TTYSTAT SR

  • killkillSIGTERM (15)psSIGKILL(9)-l-sSIGkill PIDkill -s 9 PID

  • LinuxGNUgcc

  • GNUGNUGNUs Not Unixguh-NEWGNUasgccldgccGNU Compiler CollectionGNUCANSI Cgcc

  • gcc$ cat >hello.c #include int main(void) { printf (Hello world, Linux programming!\n); return 0; } $ gcc hello.c -o hello $ ./hello Hello world, Linux programming

  • gcc(Pre-Processing) (Compiling) (Assembling) (Linking)

  • gcc-cobj-ogcca.out-ggdb-O-O2-O-Wallgcc-ldirname gcc foo.c I/home/chen/include o foo-Ldirname(.so.a)gcc foo.c L/home/chen/lib lfoo o foo

    20233141453