Linux Basics
A, linux applications
- Based on linux enterprise server: Many companies use Linux as a server system
- Embedded applications: Andrews, smart home, banking system
- 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
- 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)
- mkdir: -p (recursively created, you can create an intermediate directory does not already exist)
- pwd: Print directory path
- rmdir: delete empty directories; -r ()
- CP : CP source destination directory ;-p (saved file attributes, such as the modification time); - r (catalog copy);
- mv : moving, moving directories do not add the -r option
- RM: -r (remove directory); - f (force deletion);
- touch: create a file
- cat: view the file; -n (when viewing the display line numbers)
- more: View files, carriage return (next page); spaces (newline); q (quit)
- less: view a file, you can page up
- head: to view the file hean -n 20 filename (20 lines before viewing)
- tail: and head similar to the end of the View Files
2. Change the file permissions
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)
chown: change the owner of the file. chown user file or directory (the files of all this to the new owner)
chgrp: change the owning group of the file. chown user group file or directory;
umask: view the default file creation, directory permissions
3. File Search Command
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
- -name: matching conditions for the file name, * matches any string? Matches any single character,
locate: like everything
- -i: not case sensitive
- updatdb: update files repository
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
man: Help command
- man ls: View the help information ls