《Linux学习笔记——整理自马哥Linux运维》完了待ち

6954 ワード

ls
	-l:   
		-:    (f)
		d:    
		b:     (block)
		c:      (character)
		l:      (symbolic link file)
		p:    (pipe)
		s:     (socket)

		    :9 , 3   ,  :rwx    ,      -  

		        
		    (owner)
		     (group)
		    (size),       
		   (timestamp),          
			  :access
			  :modify。        。
			  :change。metadata,   ,    。

	-h:human readable,     
	-a:   .       
		.    
		..          
	-A:      ,    . ..
	-d:        
	
	-i:     
		index node, inode
	-r:    
	-R:  (recursive)  
	
cd:change directory
	    ,     ,home directory
	cd ~USERNAME:          
	cd -:                   

    :
	    (shell  )
	    :                           
	
    :       
	    
	path:         
	o(1):           ,      ,      
	
	
type:          
date:    
Linux:rtc,real time clock
	    
	    
	
ntp:      

         :
    :
	help COMMAND
    :
	COMMAND --help
    :manual
man COMMAND:       
whatis COMMAND:        
   :     8 
	1.    (/bin, /usr/bin, /usr/local/bin)
	2.    
	3.   
	4.    (    )
	5.    (       )
	6.  
	7.  :miscellaneous
	8.    (/sbin, /usr/sbin, /usr/local/sbin)

<>:      
[]:   
|:   
{}:  ,      

man:
	name:           
	synopsis:    ,      
	description:         ,             
	options:          
	files:          
	bugs:
	examples:    
	see also:    
  :
	    :space
	    :b
	    :enter
	    :k
	
  :
	/keyword:    
	?keyword:    
	n:   
	N:   
	  / ? n N     
	q:  

hwclock -w           
hwclock -s           

    :
info COMMAND
   /usr/share/doc

cal:calender  

echo       
printf        

file      :

Windows:PE     
Linux:ELF        

    :
rootfs:     ,      ,           。

FHS:        
	/boot:        ,   、initrd、  grub(bootloader)
	/dev:    
			   :    ,           ,   
			    :    ,           ,      
			   :    (major)      (minor)
	/etc:    
	/home:      ,              /home/USERNAME
	/root:       
	/lib:   
		   :.a
		   :.dll,.so(shared object)
		      (/lib/modules)
	/media:     ,    
	/mnt:     ,         
	/misc:  
	/opt:    ,          
	/proc:     ,      
	/sys:     ,              ,   
	/tmp:    
	/var:      
	/bin:     ,    
	/sbin:    
	
	/usr:universal shared read-only
		/usr/bin
		/usr/sbin
		/usr/lib
		
		/usr/local:          
			/usr/local/bin
			/usr/local/sbin
			/usr/local/lib
    :
	1.      255   
	2.    /    
	3.       
	
    :
    :

    
	
    
	ls
	cd
	pwd
	mkdir:     ,                   
		-p:    
		-v:verbose    
		mkdir -pv /mnt/test/{x/m,y}
	     :
		{a,b}_{c,d}     a_c,a_d,b_c,b_d
		  (a+b)*(c+d)
		
	rmdir(remove directory):     (       )
		-p:       
	tree:     
	        
		touch:       ,              
			-c:     
			-a:      
			-m:      
			-t:    
		             
			nano:
		rm:    
			-i:   
			-f:    
			-r:    
	       
	cp:copy
		SRC DEST
		         
		         
		              
		             
		       ,         
		       ,          
		      ,       
		          
		-r/-R         
		-p:              ,  
		-a:          ,    ,     
		    ,            
		-P:      
		-i:
		
	mv SRC DEST
		-f:      
		-t:  ,   
	install:        
		-d:    ,-d DIRECTORY...
		SRC DEST:    ,             
		-m:    
		-t:    ,    
		      
		
	stat:              
	
   :
	Fedora, Redhat(Centos), SUSE, Debian(Ubuntu, Mint), Gentoo, LFS(Linux From Scratch)

                   
    :cat, more, less, head, tail, cut, sort, uniq, grep

    :
	cat、tac、more、less、head、tail
	
	cat:     
		-n:    
		-E:      
		
	tac:    
	
	    :
	more:       ,b   ,  :          
	less:         , q   
	
	head:      n 
	tail:      n ,    
		-f:      ,   ,                
	
    :
	cut,join,sed,awk
	
	cut:
		-d:     ,    
		-f:        ,
			-f 1,3
			-f 1-3
	    :
		sort:     ascii  ,  
			-n:    
			-r:  
			-t:     
			-k:           
			-u:         
			-f:      
		 sort uniq ,                 ,      ,      
		uniq:
			-c:         
			-d:       
	    :wc(word count
		wc:
			-l:     
			-c:   
			-m:   
			-L:           
	      :
		tr:       
			tr charset1 charset2
			      ,         
			    :
				tr 'a-z' 'A-Z'
			-d:              
bash    :
	shell:  
	GUI:Gnome,KDE,Xfce
	CLI:sh,csh,ksh,bash,tcsh,ksh,zsh
linux          ,shell     
  :       ,               
        ,          


      :
bash:
	#
	$
	1.    ,    
	2.  、   
	3.    
	4.     
	5.     
	6.     
	7.  
	8.  
	
	     :
		      :
			ctrl+a:   
			ctrl+e:   
			ctrl+d:
			ctrl+u:          
			ctrl+k:          
			ctrl+l:  
	    :
		history:      
			-c:      
			-d:         
				-d 510 3: 510       
			-w:           ,        .bash_history     
		
		    :
			!n:        n   
			!-n:           n   
			!!:       
			!string:                  
			!$:              
			esc,.:    
			alt+.:    ,       
	    :
		  :path        ,      ,    ,    tab              
		
		    :       ,        
		
	    :
		alias CMDALIAS='COMMAND [options] [arguments]'
		        ,    
		         shell       
		      ,    bash     
		    :
			unalias CMDALIAS
		      ,\COMMAND
	    :$(COMMAND)    `COMMAND`,          
		                    
		cmd1 [] [] $(cmd2)
		touch /file$(date +%F-%H-%M-%S)
	bash     :
	``:    
	"":   ,        
	'':   ,       

	     :globbing
	*:           
	?:        
	[]:              
		[abc],[a-m],[a-zA-Z],[0-9]
	[^]:              
	[:space:]:    
	[:punct:]:    
	[:lower:]:    
	[:upper:]:    
	[:alpha:]:     
	[:digit:]:  
	[:alnum:]:        
	
	

	    :
		path:      
		HISTSIZE:      ,   1000 
	
			
		
shell:
	 shell,   pstree  
	    shell:exit
	            
	
    :
	ctrl+c
	shift+pageup/down:  

    
    
    
    
    

  、 、  
     (secure context)
  :
	r,w,x
	  :
		r:  ,      cat       
		w:  ,          
		x:   ,exacutable,                    
	  :
		r:       ls          
		w:          
		x:    cd      ,     ls -l           
	rwx:
		r--:  
		r-x:    
		---:   
	0 000,---:   
	1 001,--x:  
	2 010,-w-: 
	3 011,-wx:    
	4 100,r--:  
	5 101,r-x:   
	6 110,rw-:  
	7 111,rwx:    

  :uid, /etc/passwd
 :gid, /etc/group

    : /etc/shadow
 : /etc/gshadow

    :
	   :uid:0
	    :uid:1-65535
		    :uid:1-499,     
		    :uid:500-60000
     :
	   :      
	   :   ,         
	   (     ,            ,               ,    )
	    :
	   :
		   :
		   :


account:   
password:  
uid:  id
gid:   id
comment:  
home dir:     
shell:     shell



/etc/shadow
	account:   
	encrypted password:     
	   ;  ;           ;      ;      ;    ;     ;    

    :
	    :            
	    :         ,     (secret key),     (public key)
	    :    ,       
		1.    :         ,          
		2.    :
			md5:Message Digest,128     
			sha1:Secure Hash Algorithm,160     

    :
	useradd USERNAME
	groupadd GRPNAME
	useradd, userdel, usermod, passwd, chsh, finger, id, chage
	
		useradd [options] USERNAME
			-u uid 
			-g gid(   )
			-G GID...(   )
			-c "COMMENT"
			-d /path/to/somewhere
			-s /etc/shells/???
				/etc/shells:            shell
			-m -k
    :
	PATH
	HISTSIZE
	SHELL
   :
	groupadd, groupdel, groupmod, gpasswd
    :
	chown, chgrp, chmod, umask

  :