Basic Linux commands and basic linux commands
Learning Environment: Cent OS 6.5File Processing command:
Ls: list shows the directory file $ ls-l shows detailed information $ ls-ld shows the directory permission $ ls-I shows the I node number, indicating that the inode value equivalent to hard links such as pid is the same cd: change directory switch directory pwd: print working directory display working directory touch: create empty file mkdir: make directories create new directory cp: copy cp-r copy directory mv: move rm: remove delete file rm-r Delete directory cat: concatenate and display files show the content of the file is not displayed on pages, directly show all more: pagination show file content (Space) or f show next page (enter) show next row q or q exit head: show the first row of the file head-num [file name] tail: show the end Of the file num row of tail-num [file name] ln: create a soft link (similar to win shortcut) ln-s [source file] [target file] ln: Create a hard link (synchronous update, hot standby) ln [source file] [target file]
Permission management command:
Chmod: change the permissions mode of a file: chmod [{u/g/o} {+/-/=} {r/w/x}] [file or directory name] chmod [mode = 421] [file or directory] Permission value: r-4 w-2 x-1 # rwxr-xr -- convert to 4 + 2 + 1 4 + 1 4 that is 754 chown: change file ownership change the owner of a file or directory chown [user] [file or directory] example: $ chown nobody file1 change the owner of file file1 to nobodychgrp: change file group ownership change chgrp [user group] [file or directory] umask: display and set the default permissions of a file $ umask-s displays the permissions of the newly created file or directory in the form of rwx Default permission umask 0022 0-special permission bits 022-user permission bits. The permission mask value 777-022 = 755 indicates that the permission rwxr-xr-xrwx has different meanings in files and directories. The file has w write permission and does not mean that the file has the delete permission.
What is the difference between the permissions for processing files and directories! :
File:
R-cat,More,Head,Tail
W-echo,Vi
X-executableCommands and 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 searches for the file init in the/etc directory (by file name, wildcards * and? [Match a single character]) $ find/-size + 204800 search for files larger than MB in the root directory $ find/-user sam searches for files with sam owner in the root directory $ find/etc-ctime-l search for files and directories with attributes modified within 24 hours under the/etc directory $ find/etc + 163840-a-size-204800 find files with properties greater than 80 mb and less than MB in the/etc directory file $ find/etc-name inittab-exec ls-l {}\; search for the inittab file in/etc and display its details 1. connector-a and logic and-o or logic or 2. connector find ..... -Exec command {}\;{} is 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 escape files that are not easily deleted (file name escape) touch "a B" find-inum 27240-OK rm {}\; -type file type search f binary file l soft connection File d directory-user File owner-name file name search * match any character? Matching single character-size file size Search Unit is block data block 512 bytes = 0.5 kb, 100 mb =? Block 100 mb = 102400kb = 204800 blocks + greater than-less than = equal to search for 1, ctime, atime, and mtime in the unit of day 2, cmin, amin, and mmin in the unit of c -change indicates that the file property has been modified, owner, owner group, permission a-access m-modify modification indicates the file content has been modified-within-+ exceeds # find/etc-mmin-120 locate: list files in databases to list file-related files, you need to use updabedb to update database updatedb: update the slocate database to create the database grep for the entire system directory file: search for String Matching lines in the file and output grep [specified string] [source file] # grep ftp/etc/services all output of ftp contained in services
HELP command:
Man: manual get help information man [command or configuration information] man 5 passwdsinfo: information get help info [any keyword] whatis: directly view brief information makewhatis create a database
Compression and decompression commands:
Gzip: gnu zip: compressed file gzip [Option] [file] compressed file format. gzgunzip: gnu unzip decompressed. GZ compressed file gunzip [Option] [file] tar: Package directory tar [c/v/f/z] [Directory] compressed file format: .tra.gz tar-c .tar package file-v display details-f specify the compressed file name-z package and compress $ tar-zcvf dir1.tar.gz dir1tar: decompression syntax tar-x unpack. tar file-v show details-f specify compressed file-z decompress $ tar-zxvf dir1.tar.gz zip: zip compression [compressed file name] [file or directory] Compression Suffix :. zip-r compressed directory unzip: Decompress $ unzip test.zip bzip2: compressed file format :. bz2 $ bzip-k file1 after a compressed file is generated, the source file (-k) is retained. bunzip2: unzip $ bunzip-k file1.bz2 and then the source file is retained.
Network Communication commands:
Write [user name] sends a message to another user by pressing ctrl + d to end ping detection network connectivity ifconfig-a to display all network card information
System shutdown command:
Shutdown-h now immediately shutdown-r 1 restart rebot restart system