Linux Learning Note 2

Source: Internet
Author: User
Tags clear screen php script syslog touch command

Recommendations for beginners in 2016-09-26 All commands are lowercase, strictly case-insensitive, and do not prefix file types, but we write manually to help identify them. Zip package:. gz/.bz2/.tar.bz2/.tgz binary package:. RPM Web file:. html/.php script file:. SH profile:. conf All content is saved as a file, including      Hardware, configuration. All devices must be mounted after the user can use, such as hard drives, USB drives, and discs cannot directly run the Windows Program Server Management and maintenance recommendations/bin/the directory where the system commands are stored, both normal and Superuser can execute.      However, commands placed under the bin can also be executed in single-user mode.      /sbin/Save and system environment settings related commands, only superuser can use these commands for system environment settings, but some commands are allowed to be viewed by ordinary users. /usr/bin/the directory where the system commands are stored, both normal and Superuser can execute.      These commands are unrelated to system startup and cannot be performed in single-user mode (equivalent to the Windows security mode, minimized mode). /usr/sbin/Store root file system unnecessary system administration commands, such as most service programs. Only super users can use it.      The commands that Linux saves in all sbin directories are available only to superuser, and can be used by all users saved in the bin. /boot/system startup directory, save the system startup related files.      such as kernel files and boot boot programs, grub files, etc.      /dev/device File save location. /etc/the location where the configuration file is saved.      All service profiles in the system that use the default installation method (RPM installation) are stored in this directory, such as user accounts and passwords, and service startup scripts. /home/home directory for ordinary users. Each user is created with a default login location, which is the user's home directory. The home directory for all ordinary users is to create a directory with the same user name under//. If the user Userl home directory is the/home/userl/lib/system call function library save location/lost+found/when the system crashes unexpectedly or the machine unexpectedly shuts down, and produces some file fragment to put here. When the system starts, the Fsck tool checks here and repairs the corrupted file system. This directory only appears in each partition, such as/lost+fOund is the backup recovery directory for the root partition, and/boot/lost/found is the backup recovery directory/media/mount directory for the/boot partition.      System recommendations are used to mount media devices, such as floppy disks and discs. /mnt/mount directory. There is only this mount directory in early Linux, and there is no subdivision.      Now this directory system is recommended to mount additional devices such as USB flash drives, removable hard disks and other operating system partitions. /misc/mount directory. System recommendations are shared directories that are used to mount NFS services. We have just explained the mount and should know that as long as an empty directory has been established, it can be used as a mount point. Then the system prepared three default mount directories/media,/mnt,/misc, but in which directory to mount what device can be determined by the administrator. For example, in the previous Linux default mount directory only/mnt one, so developed in the/mnt under the different directory to mount different devices of the habit.      such as/mnt/cdrom Mount CD,/MNT/USB mount USB drive. /opt/Third party installation software save location. Manual installation of the source code package software to this directory.      But someone is used to putting the software in the/usr/local/directory. /proc/the virtual file system, the data in this directory is not saved to the hard disk. Instead, it is stored in memory. The main storage system kernel, process, external device status and network status lights.      If the/proc/cpuinfo is to save the CPU information,/proc/devices is to save the device driver list,/proc/filesystems is to save the file system list,/proc/net is to save the network protocol information. /sys/virtual file system. Similar to the/proc directory.      are stored in memory, primarily to preserve kernel-related information. /root/home directory for super users.      The normal user home directory is under/home, and the Superuser user's family directory is directly under/under. /srv/Service Data Catalog.      After some system services are started, you can save the required data in this directory. /tmp/Temp directory. The directory where the system holds temporary files. All users in this directory can be accessed and finalized.      It is recommended that you do not save important data in this directory, and each boot is recommended for emptying. /usr/system software Resource directory. Note that USR is not a user abbreviation, but a UNIX softwre resourct abbreviation. So the user data is not stored.      Most of the software installed in the system is stored here. /var/Dynamic Data Save location.    It mainly saves the files generated by the cache, log, and software operation.     Server Considerations The remote server does not allow shutdown and can only be restarted.      You should close the service before restarting. Do not run a high load (big data decompression, scan, copy) command to remotely configure the firewall (filter data using IP, packet data, Mac, port, etc.) in the server Access Peak (8 o'clock in the evening, 3-5 hours in the morning) do not kick yourself out of the server specify reasonable password specifications and regularly update reasonable distribution rights Limit (less the better) regularly back up important data and log Linux common commands clear or ctrl+l, clear screen.      CTRL + C terminates execution. Command format: command [-options] [parameters] For example: LS-LA/ETC Description: The option is to select the function of the command, the action object of the parameter command.        [] delegates are optional.  1 individual commands used do not follow this format 2 when there are multiple options that can be written together, you can swap the position 3 with the complete options, such as the-a equals--all directory processing command: LS command name: ls Command English original: List command path:/bin/ls Execute permissions: All user function Description: Display directory file syntax: LS option [-ald] [file or directory]-a all show all files, package Hidden files, which start with a. dot in Linux.          The hidden meaning is not to make the user invisible, but to tell the user that this is a system file.            -L Long details are displayed, as the following command results. [[email protected] ~]# ls-l total dosage 44-rw-------. 1 root root 1208 September 00:05 anaconda-ks.cfg-rw-r--r--. 1 root root 24772 September 00:05 install.log-rw-r--r--.      1 root root 7690 September 00:04 install.log.syslog [[email protected] ~]# ls-l/etc/grub.conf      lrwxrwxrwx. 1 root root 22 September 00:05/etc/grub.conf.                The/boot/grub/grub.conf is divided into 7 parts: The 1th part, with 10 characters.                The 1th character-Indicates the file type (-binary file, D directory, l software link file, r read, w write, x execution), and each of the following 2 characters represents the corresponding permissions for three users. As-rw-r--r---Indicates that this is a binary file rw-represents the use rights of the U owner for RW. Why does the owner not have x Execute permission but have RW permission? Because previously said, the authority is not much, enough is good. Normal files do not require execute permissions, so no.                  When it is used as a script executable file.              r--means that the G-owned group's use rights are R r--means o other people's use rights are R 2nd, reference count: 1 refers to the file reference count, which means that the file has been referenced or called several times.              3rd, file and user relationship: 1. Owner U (default is creator, only one, can change), 2. Owning Group G (only one group, same type of user), 3. Other people o.              Part 4th, the first root is the owner, and the second root is the name of the owning group. The 5th part, the file size, defaults to bytes.              You can use-LH to display sizes in different units. The 6th part, the creation time. (Xiaowen think: The video said that Windows did not create a time to say?) And I think there is. Only in the Windows Column properties are not displayed by default, but can be in the Column Name column right-click, display, full of dozens of total properties. )-D View Directory properties [[email protected] ~]# ls-ld/etc drwxr-xr-x. 102 root root 12288 September 16:35/etc-h to fit unitsDisplay size-i display file ID Summary: ls-a-l-d-h-i Directory processing command: mkdir command name: mkdir Command English original: Make direct  ories command path:/bin/mkdir Execute permissions: All user syntax: mkdir-p [directory name] Function Description: Create a new directory-P recursive creation example: Mkdir-p/tmp/a/b Use the P option to create a directory and create a B directory under the A directory mkdir/tmp/a/c/tmp/a/d both the C and D two directories under the A Directory Processing command: CD command        Name: cd command English original: Change Directory command path: Shell built-in command execution permissions: All user syntax: cd[directory] Function Description: Switch directory Example: cd/tmp/a/b switch to the specified directory CD. Back to the top level directory, two:      Point, A. dot represents the current directory. Directory processing command: PWD command name: pwd Command English original: Print working directory command path:/BIM/PWD Execute permissions: All user syntax: P WD Feature Description: Show current directory example: PWD directory processing command: rmdir (xiaowen: File processing command on video) command name: RmDir Command English Original: Remove empty di      rectories command path:/bin/rmdir Execute permissions: All user syntax: rmdir[directory name] Function Description: Delete Empty directory example: rmdir/tmp/a Directory processing command: CP command name: CP Command English original: Copy command path:/bin/cP Execute permissions: All user syntax: CP-RP [Original file or directory] [target directory]-r copy directory-p reserved File properties Description: Copy file or directory example: CP               /etc/grub.conf/tmp #复制文件到tmp下 cp/root/install.log/root/install.log.syslog/tmp #复制多个文件到tmp下 Cp-r/tmp/a/tmp/b #复制目录a到目录b下 cp-r/tmp/a/tmp/b/a2 #复制目录a到目录b下并改名为a2 cp-rp/tmp/a/tmp/ C #复制目录a到目录c下并保持目录属性 Directory processing command: MV command name: MV Command English original: Move command path:/BIN/MV Execute permissions: all user languages Method: MV [original file or directory] [target directory] function Description: Cut (move) file, rename example: mv/tmp/a/tmp/b directory processing command: RM command name: RM Command English Original:  Remove command path:/BIN/RM Execute permissions: All user syntax: RM-RF [file or directory]-r Delete directory-F enforcement Function Description: Delete file directory processing command: MV command name: MV Command English original: Move command path:/BIN/MV Execute permissions: All user syntax: MV [original file or directory]      [Target directory] function Description: Cut (move) file, renaming example: mv/tmp/a/tmp/b Summary: mkdir-p CD pwd rmdir cp-r-P RV Rm-r-F Directory processing commands: Touch lifeMake name: Touch command English Original: command path:/bin/touch Execute permissions: All user syntax: touch [filename] Function Description: Create an empty file example: Touch A.list If you need to create a file name with spaces, use quotation marks. In Linux except the slash/can't do the name of the other can be.      But not recommended. File processing commands: Cat command name: Cat Command English Original: command path:/bin/cat Execute permissions: All user syntax: cat [filename] Function Description: Display File Content-N Display line number example: Cat/etc/issue cat-n/etc/issue file Processing command: TAC command name: TAC Life English: Command path:/USR/BIN/TAC Execute permissions: All user syntax: TAC [file name] function Description: Show file contents (reverse list) Example: tac/etc/is          Sue file Processing command: More command name: More command English Original: command path:/bin/more Execute permissions: All user syntax: more [filename]        (space) or F-page (carriage return) line change Q or Q Exit Function Description: Distribution Display file Content example: More/etc/services file processing command: Less Command name: Less command English Original: command path:/usr/bin/less Execute permissions: All user syntax: less [filename] Function Description: Display the contents of the file (you can Page up)/keyword search keyword example: less/etc/services file processing command: HEAD Command name: Head Command English Original: command path:/usr/bin/head Execute permissions: All user syntax: head [filename] Function Description: Display text      Example: Head-n 20/etc/services Displays the first 20 lines of the file, or no options, the default is 10 rows.        File processing command: Tail command name: Tail command English Original: command path:/usr/bin/tail Execute permissions: All user syntax: tail [filename]  Function Description: Displays the last few rows of the file-n specifies the number of rows-F dynamic display after a few lines change example: Tail-n 20/etc/services Summary: Touch cat-n TAC         More less head-n tail-n-F file processing command: LN command name: LN command English original: Link command path:/BIN/LN Execute permissions: All Users Syntax: ln-s [Original file] [target file]-s Create soft connect function Description: Generate Link File example: #创建文件/etc/issue soft link/tmp/issue.          soft [[email protected] ~]# ln-s/etc/issue/tmp/issue.soft #创建文件/etc/issue Hard Links/tmp/issue.hard [[email protected] ~]# ln/etc/issue/tmp/issue.herd #查看原文件信息 [[email protected] ~]# Ls-l/etc/issue 131148-rw-r--r--. 2 root root 47 June 2012/etc/issue #查看软链接信息 [[email protected] ~]# ls-l/tmp/issue.soft. 1 root root 10 September 12:16/tmp/issue.soft-/etc/issue #查看硬链接信息 [[email protected] ~]# ls-l /tmp/issue.herd 131148-rw-r--r--. 2 root root 47 June 2012/tmp/issue.herd Soft link feature: Similar to Windows shortcut 1, lrwxrwxrwx l soft link, soft link actual permissions actual file decision, there is a corresponding logo          Hard link feature: compare like Cp-p + synchronous update, real-time update with real file (file ID is same as original file), but no------------No, cross partition, not support directory.          After the hard link is established, the hard link of the original file is modified synchronously, but deleting the original file does not affect the hard link.          The file ID of the hard link is the same as the original file, so it can be changed synchronously. Hard links are not used in real-world applications, and are available when multiple users modify a file at the same time.

Linux Learning Note 2

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.