Simple Linux command

Start Terminal: ctr + alt + t
--------------------------------------------------------------------------------------
Terminal Font Size: ctr + shift + '+', the terminal reduction Font: ctr + '-'
--------------------------------------------------------------------------------------
mkdir -p can build a new directory can recursively create directories. 
 rmdir to delete empty folders
--------------------------------------------------------------------------------------
rm delete files or directories -i Interactive
   -f Force delete, ignore the file does not exist, without prompting
   -r recursively delete the contents of the directory, you must add this parameter when deleting a folder
   -d delete empty directories
--------------------------------------------------------------------------------------
cp file or directory to another file or directory
   When you copy a directory using -a, retains links, file attributes, and recursively copy the directory, simply, to keep the original file permissions.
   -i Interactive
   -r If the source file is given a directory file, then cp will copy recursively all directories and files in the directory, the target file must be a directory name.
   -v display the copy path described
--------------------------------------------------------------------------------------
mv -i interactive moving files or directories, to avoid mistakenly overwriting files
   -v displayed after the movement path described
--------------------------------------------------------------------------------------
1. redirect command:> such as: ls> test.txt (test.txt If not, create, exists overwrite its contents)
--------------------------------------------------------------------------------------
2. View or merge file contents: cat gedit
   cat ab> cc exist, covered c
   cat ab >> cc exist, appended to the c
--------------------------------------------------------------------------------------
3. The split-screen display: more
--------------------------------------------------------------------------------------
4. Pipeline: | ll | more write | read
--------------------------------------------------------------------------------------
5. Establish links file: ln 
   ln -s file link source file of the soft links: soft links do not take up disk space, delete the source file is a soft link failure. 
 
   ln source file link file hard links: hard link can only link a regular file, directory can not be linked.
--------------------------------------------------------------------------------------
6. Text Search: grep grep 'a' 1.txt
   -v negated
   -n display matching lines and line number
   -i ignore case
   grep searches string can be a regular expression.
   ^ A first row, the row beginning with m; grep -n '^ a' 1.txt
   ke $ end of line, end of line to ke; grep -n 'ke $' 1.txt
   [Ss] igna [Ll] matches a [] in the series of characters; grep -n '[Ss] igna [Ll]' 1.txt
   . (Point) matches a non newline character; matching eee, eae, eve, but does not match ee, eaae; grep -n 'ee' 1.txt
--------------------------------------------------------------------------------------
7. Find File: find
   find ./ -name test.sh find all the files under the current directory named test.sh
   find ./ -name '* .sh' Find all .sh suffix in the current directory for file
   find ./ -name "[AZ] *" finds all files with a capital letter at the beginning of the current directory
--------------------------------------------------------------------------------------
8. wildcard
 *: Represents 0 or more of any character
 ?: Represent any one character
 [Cited character]: the representative of any one character
--------------------------------------------------------------------------------------
9. packing and compression: tar tar [options] package file generated file name
   -c generate archive files, create a file package
   -v set out in detail the process of de-archive files, display progress
   -f specify archive file name, f must be behind the .tar file, it is necessary to finally put option
   -x unlock the archive
   -z compression
   1> gz compression formats: tar -zcvf file.tar.gz file 1 file 2 ...
      To extract the specified directory: -C (capital letter "C") tar -zxvf file.tar.gz -C zhaojie /
   
   2> bz2 compression formats Usage: tar -jcvf compressed file name bags
   Decompression Usage: tar -jxvf compression bag name
 
   3> zip compression format need not specify the destination file name extension through the zip file, the default extension zip.
   Compressed files: zip target file (no extension) source file
   Unzip the file: unzip -d after extracting archive file directory
--------------------------------------------------------------------------------------
10. Modify the file permissions: chmod
 If you want to add the same permissions recursively all directories, you need to add the parameter "-R". 
 Such as: chmod 777 test / -R recursively test all the files in the directory plus 777
--------------------------------------------------------------------------------------
11. Review the command position: which commands into the built-in commands and external commands
 Built-in command is loaded into memory when the system starts to perform high efficiency belong to the built-in cd command
 Outside command system software features loaded into memory when needed
--------------------------------------------------------------------------------------
12. The switch to an administrator account: sudo -s
--------------------------------------------------------------------------------------
14. Set User Password: passwd
--------------------------------------------------------------------------------------
15. Log account: exit
--------------------------------------------------------------------------------------
16. view all logged-in users: who the user to view information about all current login system.
--------------------------------------------------------------------------------------
17. The shutdown restart: reboot, shutdown
 reboot to restart the operating system
 shutdown -r now restart the operating system, shutdown will prompt other users
 shutdown -h now immediately shut down, which is now equivalent to the time of state 0
 system shutdown shutdown -h 20:25 will be in today's 20:25
 shutdown -h +10 system automatically shut down after ten minutes
--------------------------------------------------------------------------------------

Guess you like

Origin www.cnblogs.com/lab-zj/p/12166208.html