Learning Environment: Cent OS 6.5
file processing commands:
Ls:list Display the catalog file $ls –l show details $ls –ld Show directory Permissions $ls –i Display i-node numbers represent the same inode value as a hard link such as a PID Cd:change Directory switch Directories pwd:print working directory display working directory touch: Create an empty file Mkdir:make directories create a new directory cp:copy copy cp–r copy directory Mv:mo ve move rm:remove Delete a file rm–r delete a directory cat:concatenate and display files show the contents of the file is not paged, directly show all more: page shows the contents of the file (space) or F display under A page (enter) shows the next line Q or Q exits head: Displays the previous num line of the file head–num [filename]tail: Displays the end of the file num lines Tail–num [ File name]ln: Create soft Link (like win shortcut) ln–s [source file] [destination file]ln: Create Hard link (synchronize update, hot spare) ln [source file] [target file]
Rights Management Commands:
Chmod:change the permissions mode of a file changes the files or directory permissions example: chmod [{u/g/o} {+/-/=} {r/w/x}] [file or directory name] chmod [mode=421] [file or directory] permissions correspond to values: R–4 w-2 x–1 #rwxr-xr-- converted to numeric 4+2+1 4+1 4 i.e. 754chown:change File ownership change the owner of the files or directories chown [user] [file or directory] example: $ chown Nobody file1 change the owner of the file file1 to NOBODYCHGRP: Change file group ownership changes the owning group chgrp [user Group] [file or directory]umask: Display, set default permissions for files $ umask–s Show default permissions for new files or directories as rwx umask 0022 0-special permission bit 022-user rights bit, permission mask value 777-022=755 is permission rwxr-xr-xrwx The meanings in the files and directories are different. The file has a W Write permission and does not represent a delete permission
The difference in permissions when working with files and working with directories! :
File:
R–cat , More , Head , Tail
W–echo , VI
X-The executable commands, Scripts
Directory:
R–ls
W–touch mkdir RM
X–cd
File Search command:
Which: Displays the directory where the system command is located which [command name]find: Find a file or directory find [search path] [search keyword] Example: $find/etc–name init in directory/etc Find file init (according to the text Name lookup, you can use the wildcard characters * and? [Match a single character]) $find/-size +204800 find files larger than 100MB in the root directory $find/-user Sam look for files with the owner of Sam under the root directory $find/etc–ctime–l Find files and directories in the/etc directory that have been modified for 24 hours $find/etc +163840–a–size-204800 in/etc directory looking for more than 80MB Files less than 100mb $find/etc–name inittab–exec ls–l {} \; Find the Inittab file under/etc and display its details 1, connector-A and logic with-O or logic or 2, connector find .... –exec command {} \; {} The result of the find query \ is the escape character find/etc–name init *-a–type–f–exec ls–l {} \; can be used to delete an escaped file that is not easy to delete (file name escape) Touch "a B "Find–inum 27240–ok rm {} \; -type file type find F binary file l Soft Connect file D directory-user file owner-name filename Lookup * matches any character? Match a single character -size File Size Lookup unit is block data block 512 bytes = 0.5 kb, 100mb=?block 100mb=1 02400kb=204800 blocks + greater than-less than = equals to find 1, CTime, Atime, mtime in days, 2, Cmin, Amin, mmin in minutes c-change change the representation of the file property to be Modified, owner, owning group, permission a-access Access m-modify modification means that the contents of the file have been modified-within + more than #find/etc–mmin-120locate:list files in Databas ES lists file-related files that need to be updated with Updabedb to update the database updatedb:update the Slocate database to establish the entire system catalog file grep: Search for string matching lines in the file and output grep [Specify string] [source file] #grep ftp/etc/services contains FTP output in services
help command:
Man:manual Getting Help information man [command or configuration information] man 5 passwdsinfo:information get help info info [any keyword]whatis: view short information directly Makewhatis establishing a database
Compress unzip Command:
Gzip:gnu Zip: Compressed file gzip [options] [file] Compressed file format. GZGUNZIP:GNU unzip unzip. GZ compressed file gunzip [options] [File]tar: Package directory tar [c/v/f/z] [catalog] Pressure Shrink file format:. tra.gz tar–c generates. tar package file- v displays details -F Specifies the compressed file name- z package simultaneously compresses $tar –ZCVF dir1.tar.gz Dir1tar: Decompression syntax tar–x unpack. tar file- v display details- f Specify compressed file- z decompression $tar –ZXVF dir1.tar.gz Zip: Compressed zip [compressed file name] [file or directory] compression suffix:. zip zip–r Compressed directory unzip: Unzip $unzip TEST.ZIPBZIP2: Compressed file format:. bz2 $bzip –k file1 generate a compressed file after saving source (-K) Bunzip2: Extract $bunzip –k file1.bz2 Extract Preserve source file
Network communication Instructions:
Write [username] Send message to another user with Ctrl + D end Ping Detect network connectivity Ifconfig–a display all NIC information
System Shutdown Instructions:
Shutdown–h now shutdown shutdown–r 1 Restart rebot Restart system
Linux basic Commands