Closing days of the experiment platform Day4

Linux Basics

A, linux applications

  1. Based on linux enterprise server: Many companies use Linux as a server system
  2. Embedded applications: Andrews, smart home, banking system
  3. Linux in the film entertainment industry

Second, the commonly used commands

Command basic format: command [- Option] [parameters], for example: ls -la / usr

When there are multiple options, you can write together

1. directory, file processing command

  1. LS : -l (Long, show details); - h (human, size press kb, MB display); - a (Show hidden files); - d (display information files under the directory itself is not)
  2. mkdir: -p (recursively created, you can create an intermediate directory does not already exist)
  3. pwd: Print directory path
  4. rmdir: delete empty directories; -r ()
  5. CP : CP source destination directory ;-p (saved file attributes, such as the modification time); - r (catalog copy);
  6. mv : moving, moving directories do not add the -r option
  7. RM: -r (remove directory); - f (force deletion);
  8. touch: create a file
  9. cat: view the file; -n (when viewing the display line numbers)
  10. more: View files, carriage return (next page); spaces (newline); q (quit)
  11. less: view a file, you can page up
  12. head: to view the file hean -n 20 filename (20 lines before viewing)
  13. tail: and head similar to the end of the View Files

2. Change the file permissions

  1. chmod: read r, write w, x execute three permission by the numeral 4,2,1, such as chmod 777 filename, it means that all users have all permissions

    Permissions for files and directories are different meanings: For a file write w is to modify the file, the directory is written w is deleted to create a directory in the directory (file)

  2. chown: change the owner of the file. chown user file or directory (the files of all this to the new owner)

  3. chgrp: change the owning group of the file. chown user group file or directory;

  4. umask: view the default file creation, directory permissions

3. File Search Command

  1. Find: Find [Search] [matching conditions]

    • -name: matching conditions for the file name, * matches any string? Matches any single character,find /etc -name init
    • -iname: case-insensitive file names
    • -size: + n (greater than the file size), - n (file size less than), = n (equal to the file size)
    • -amin: matching conditions for access time, look for the file to be accessed within five minutes in the / etc directory find /etc -amin -5
    • -mmin: matching condition is modified, the modified look over 30 minutes `find files in the / etc directory / etc -mmin -30
    • -type: matching condition file type, f denotes a file, d indicates a directory
    • -a: when a plurality of query conditions, using -a connection, and represents
    • -o: when a plurality of query conditions, use -o connection, or represents
  2. locate: like everything

    • -i: not case sensitive
    • updatdb: update files repository
  3. grep: Find the file contents

    • sudo grep mysql /root/install.log
    • -v: exclude lines that match the characters, such as the exclusion of the line starting with # (ie, a comment line)grep -v ^# mysql /root/install.log
  4. man: Help command

    • man ls: View the help information ls

Guess you like

Origin www.cnblogs.com/zhuobo/p/10928312.html