1 File and Directory Operation Command 1.1 File Content Query Command Grep, FGREP, EGREP Syntax: GREP [Option] [Find Mode] [File Name 1, File Name 2, ...] Options: -e Each mode as an extension regular The expression is treated as a set of fixed strings as a set of fixed strings, not when the regular expression -i comparison is not distinguished, and the file name where the first match matching string is located and the woram is separated. When a matching string occurs in the file, no repeat display file name; -X only displays a row 1.2 file search command for the strict matching line 1.2 file search command, locate syntax: Find start directory lookup Conditions to find with name and file properties -Name 'String' Find File Name Match All Files of Wild Strings, can be used in wildcards * ,? []. -Lname 'string' Find file names match all symbolic link files of the given string, wildcards available in the string * ,? []. -Gid n Find all files for user groups belonging to the ID number N. -UID N looks out all files of users belonging to the ID number N. -Group 'String' looks into all files that belong to the user group name as the string. -User 'String' looks up all files belonging to the username as a given string. -Path 'string' finds all files that match the string of the string, and wildcards can be used in the string *, []. -Perm Permissions Find files and directories with specified permissions, and privileges may be as 711,644. -type x Find types of files, syntax: Locate related words 1.3 file copy, delete, and move command file copy command CP [Option] Source file or directory target file or directory option: - A usually used when copying directory - D Copy When the connection -f delete the existing target file without prompting -i and f option, the CP is also copied in addition to the content file content, and the time and access rights it is also copied to the new file - R If the source file given is a directory file, the CP will recursively copy all the subdirectory and files in the directory. At this point the target file must be a directory name; -L does not copy, just link file file mobile command MV [Options] Source File or Directory Target File or Directory -i Interactive Operation -F Prohibition Interactive Operation File Remove Command RM [Options] File ... -f ignores the unsuccessful file, never give a prompt -r indicator RM All directory and subdirectories listed in the parameters are recursively deleted -i interactive delete 1.4 file link command ln [option] target [link name] or ln [option] target directory option: - S build symbolic link 1.5 directory creation And delete the command MKDIR Create a directory syntax: mkdir [option] DIRNAME Options: - M Setting access to the new directory - P can be a path name. If some directories in the path do not exist, after adding this option, the system will automatically establish a directory that does not exist, that is, multiple directories can be created once. RMDIR Delete Air Direct Directory Syntax: RMDIR [Option] DIRNAME Options: - P Recursive Delete Directory DirName, which is also deleted when the child directory is empty after delete.
1.6 Change the working directory, display the directory content command 1, change the work directory: CD [Directory] 2, display the absolute path of the current work directory: PWD 3, display directory content: LS [option] [directory or file] option: - a Display all subdirectories and files in the specified directory, including hidden files; -c Follow the modification time Sort-C divided into multiple columns Display each item If the parameter is a directory, only the name is displayed without displaying the file -F In the directory name "/", the executable is marked "*", the symbol link is marked "@", the pipe (or FIFO) back tag "@", the pipe (or FIFO) is marked "=" later. -l The detailed information of the file is displayed in a long format -L, if the specified name is a symbolic link, the file -T display pointed to the link is displayed by the modification time rather than the name sort-U display. Time rather than Name Sort 4, change the access rights of the file or directory Command chmod [who] [ | - | =] [MODE] file name? WHO options: - u Represents the user, the owner of the file, and the directory indicates that the group user -o (other) indicates other users -a (all) means all user operation symbols: Add a certain permission - Cancel a permission = Give a given permissions and cancel all other permissions (if any) MODE options: - r Read -W can be written -X can perform chGRP [-r] group filename? Change the group of Chow to the list of directories or files. [- RV] User or Group File 1.7 Backup and Compression Command 1, TAR command Create a file syntax for file and directory: TAR [Profile Auxiliary Options] File or Directory U Home Option C Create a new file file. If the user wants to back up a directory or some files, select this R to append the files you want to archive to the end T list the contents of the file file, see which files have been backed up; u Update file x From the file file Release file; u-assist option B This option is set by the tape drive, followed by a number, used to explain the size of the block, the system preset value is 20 f to use the file or device, this option is usually necessary k Saves the already existing file.
For example, restore a file, in the process of restore, encounter the same file, not override; M When restoring the file, set the modification time of all files to the present; m Create a multi-volume file file so that Store in several disks; v detailed report TAR processing file information W Each step requires confirmation z to compress / decompress / decompress the file 2, gzip command compression / decompression command syntax: gzip [option] Compression (decompression) File Name Options: -c Write the output to the standard output and retains the original file -D to decompress the compressed file - the detailed information of each compressed file -R reclassified all the files that specify and compress it. Alternatively, the -T test, check if the compressed file is complete -V-V file, display file name and compression ratio 3, unzip command with MS Windows compression software WinZip compressed files to expand syntax under Linux system : UNZIP [Option] Compressed file name .zip option: -x file list unpack file, but does not include the specified file file -V to view the compressed file directory, but do not decompress the -T test file is damaged, but does not decompressing -D The catalog will solve the compressed file to the specified directory -z only displays the compressed files - N does not overwrite the existing file -O override existing files and does not require the user to confirm the directory structure of the document, put all files unzip To the same directory 1.8 Run the DOS command in the Linux environment The Linux system provides a set of portable tools called Mtools to read and write files and directories from the standard DOS floppy disk. MCD directory name Change the MSDOS directory MCOPY source file target file Copy file between MSDoS and UNIX; MDEL directory name Delete MSDOS Directory MDIR directory name Show MSDOS Directory MFormat Drive No. Create MSDOS file system RNLabel drive letter MSDOS Volume MMD Directory Name Delete MSDOS Directory MREN Source File Target File Renown MSDOS File MTYPE File Name Display MSDOS file 2 Device Management Command Linux Use the following form: / dev / hd [Drive] [Partition] SCSI hard disk uses the same mechanism to indicate: / dev / sd [Drive] [Partition] For a general Linux partition, you can format and generate file systems with MKFS, command as follows: MK2FS-C
Loading CD-ROM file system: mount -t iso9660 -r / dev / cdrom / mnt / cdrom loading floppy drive file system: mount -t msdos -rw / dev / fd0 / dev / mnt / floppy uninstall file system umount / mnt / cdrom Installation of tape devices should pay attention to the following points: 1. First select a unique SCSI ID number, then link the device to the appropriate position 2, select the driver. 3, generate device files. The main device number of the SCSI tape device is 9, and the secondary device number is 0. Device file name is usually / dev / nrst0 (non-supported tape device) or / dev / NST0 (supported tape device) Check if the tape device file exists, if not existed, use MKNOD -M 666 / DEV / NRST0 C 9 9 MKNOD -M 666 / DEV / RST0 C 9 0 Generates 4, can be set on block length, cache, tape density, etc., for example, MT SetBLK 20 specifies the block length to 20 mt. SetBLK 0 Specifies whether the degree of block is not limited5, and the system can determine if the new tape device is identified by checking the system's startup information. Use the DMESG command to see if there is information on the following: AHA274X: Target 4Now Synchronous at 4.4MB / S Vendor: Tandberg Model: TDC 3800 Rev: = 05: TYPE: SEQUENTIAL-Access Ansi SCSI Revision: 02 Detected SCSI Tape ST0 AT SCSI0 , ID4, LUN0 SCSI: Detected 1 SCSI TAPE 1 SCSI CROM 1 SCSI Disk Total 3 Package Management Command 3.1 Software Installation Steps to install software on Linux systems: 1, find the source file 2 of the software you want to install, The file is unproved in a directory, the command is as follows: TAR ZXVF
RPM-E / / Uninstall an RPM package RPM -QA / / View the package rpm -q -b is also available in bytes to use the Victorial (default in k byte) -k to use 1024 bytes as the unit column. -C finally coupled with a total (system default) -l calculated all file size, the hard link file, calculated multiple times. -X Skip directory on different file systems does not statistically. The DD command copies the specified input file into the specified output file and can be formatted during the copy. Syntax: DD [Option] if = Enter a file (or device name). OF = Output file (or device name). IBS = bytes read the bytes bytes at a time, that is, the number of bytes read into the buffer. Skip = Blocks Skip the IBS * Blocks block that reads into the buffer. OBS = bytes written to the BYTES byte, that is, the number of bytes written into the buffer. BS = BYtes simultaneously sets the number of bytes of the read / write buffer (equal to setting OBS and OBS). CBS = bytes transitions bytes bytes at a time. Count = Blocks only copies the input Blocks block. CONV = ASCII converts the EBCDIC code to the ASCII code. Conv = EBCDIC converts the ASCII code to an EBCDIC code. CONV = IBM converts the ASCII code to the Alternate EBCDIC code. CONV = Blick converts the change bit into a fixed character. CONV = Ublock converts the fixing into a change bit conv = ucase to change the letters from lowercase. CONV = LCase transforms the letters to lowercase. CONV = NOTRUNC is not cut off output file. CONV = Swab exchanges each pair of input bytes. CONV = NoError does not stop processing at an error. CONV = SYNC Tunes the size of each input record to the size of the IBS (filled with IBS). The fdformat commands the low formatting floppy disk. Format [-n] DEVICE-N will not be inspected after formatting. 4.5 Common Network Commands FTP Command Telnet Commands. NetStat Command -a Displays all Scoket, including listening and. -C is redisplayed every 1 second until the user interrupts it. -I Displays information on all network interfaces, with "ifconfig -e" -n replaces the name with network IP addresses, display also network connection scenarios. -r Displays the core routing table, the format is "Route -e :. -t Displays the connection of the TCP protocol. -u Displays the connection of the UDP protocol. -v Displays the working work. Nslookup command. Finger command, function is query Users' information. Ping command. (Users and groups can be used to use tools: Turbousercfg or Xturbousercfg.) 4.6 Related to processes and start AT [-v] [-q] [-f file name] [-mldbv] Time AT -C Job [Job ... The AT command startup process system only once. BATCH [-V] [-Q queue] [-f file name] [-MV] [Time] When the system is loaded, resources Perform the command when comparing. The cron command executes the command at a certain time interval. The crontab command is used to install, delete, or list a table for driving the Cron background process. The process looks at the who command. The w command is a command W-[husfv] [user] -h that is more powerful than the who command. -U ignores the username when the current process and the CPU time are listed. -S use short mode. The login time JCPU and PCPU are not displayed. -F switching display from item, which is the remote host name. -V Displays version information. User only shows the situation of the specified user. PS command. -E Displays all processes. -F full format -h does not display title. -L long format. -W wide output. A Displays all processes on the terminal, including processes for other users. R shows only the running process. X Displays the process without the control terminal. TOP command dynamically displays the current process and other conditions. 5 The startup process of the system. 5.1 Initial startup When the PC is started, the BIOS reads "Main Boot Record" (MBR) from the specified startup device. The MBR format is: address offset content size 00 h executable code (starting module) may change 1be h first partition entry 16 bytes 1CE H second partition entry 16 bytes 1de h Tripartic Area item 16 bytes 1ee H Qui Diamation 16 bytes 1FE H Executable Tag (AA55 H) 2 Byte Startup Module Contains code sufficient to load the operating system, or the second step loading The location of the code. The startup module needs to be loaded from disk calls from disk, and these interrupt calls, such as INT 13h, limit the maximum disk column number 1023. This is to say that the startup module needs to be loaded, such as the initial memory disk, kernel, startup time information, etc., must be stored within 1024 cylinders. Only four partition entries in the MBR, the format of each entry is as follows: Address offset content size 00h partition status: 00 represents the start position of the barted partition 1 byte 01H partition 1 Byte 02H partition start position Cylinder and sector 1 byte 04H partition Type 1 byte 05H partition end position head 1 byte 06h partition Attach Cylinder and sector 1 byte 08H The number of sectors in the main guiding area and the first sector of this partition 4 bytes 0CH sector 4 Number of sectors 4 bytes 5.2 LUNUX startup process 1 Started command line parameters When the Linux starts, it processes All command line parameters passed to it. This can affect the operational way of Linux. Command line parameters include: MEM = XXXM: The memory size that can be used in Linux. This is required when the user's computer system has more than 64MB of memory. Because the previous motherboard is only cached for the first 64MB of memory, the performance of more than 64MB will reduce the performance of the entire computer, and all memory is running in a cached speed. SINGLE: Make Linux to start in single user mode, the default method is multi-user mode. Root = / dev / xxx: Specifies that Linux is installed as a root file system. INIT = 2 INIT processes After initializing its own and found hardware devices, starting the process init (/ sbin / init), the init process number 1 runs in the background. There are many releases from the UNIX world, some are based on system V, some BSDs based on BSD. The most Linux version uses system V implementation methods, which is described herein. INIT is controlled by file / etc / inittab content and function, with startup mode is a single user or multiple users. Single user mode: The init process ignores the / etc / inittab file, call the / dev / console shell after performing a few script programs. In this way, the user can have a shell and can perform a certain limit. Multi-user mode: The init process brings the system to the run level specified by the / etc / inittab file. INIT enters a specified level by standard Linux method. 3. Level Linux is the same as other UNIX operating systems, can be at any time at any time. These run-level features are different, which is mainly due to the difference between the serving program (background daemon). Linux has 6 run levels. 0: Turn off the computer or terminate the computer, this level is the system stops running. 1: Single user starts level, there is only one user, which is root, the user logs in in the console. 2: Multi-user runs level, but no network function. In this run level, the network function does not start, but the system allows multiple users to log in, and can pass through the virtual console or serial line. 3: Multi-user mode, there is a network function. All standard network services are started in this run level. 4: There is currently no realization. 5: X11 Run level, running in this running level, X server software, provides a login method of graphics interface. 6: The system is restarted. Query the current Run Level: Runlevel; 4 The script running during the startup process is running at the init process, which is responsible for viewing the default run level and enter the run level. This is implemented by running the script running in the /etc/rc.d/rcx.d directory, where x represents the level of the run, that is, a run level corresponds to a directory. Different letters have different roles. Among them: The scriptor starting with K is executed when the system leaves a certain run level, and the role is to stop some kind of service. When the system becomes other levels from a certain support level, all K programs corresponding to the original run level are first. Script programs starting with S are executed when the system enters a run level, and the role is to start a service. When the system changes to a run level, all S procedures corresponding to the new run level are run. 5 Increasing Start Script Program Users may have some specific hardware devices to initialize, or you need to initialize some other applications when system startup, users can increase their initialization scripts to complete these work. The usual step is to copy an existing script that allows you to get a universal frame format. Modify this script to complete your own needs, pay attention to make the program can handle the startup and closing parameters, although it is not necessary to shut down the process. Use this limb to copy to the /etc/rc.d/init.d directory, named "Serv". Create a running control link in the appropriate directory as follows: ln -s ../init.d/serv/etc/rc.d/rc3.d/s99 serv is tested. 6 LILO and other startup modules To start Linux, the startup module is necessary. The startup module typically used for Linux is LILO, LILO replaces the general main boot area with its own main boot area. LILO can be configured by modifying /etc/lilo.conf file content, and updates to the boot area through the lilo command. Here is a lilo.conf file that is also a computer with a computer with DOS, Turbolinux3.4.0 and RedHat 5.2 system. The digital reference in the example is the user plus and wants to explain in detail in the text. [Root @fred / root] # more /etc/lilo.conf boot = dev / had map = / boot / map instll / boot / boot.b prompt indicates that the boot disk is / dev / had, this is the main IDE hard drive. Timeout = 50 means that the time waiting for the user to enter is 50 seconds. Default = tl3.4 other = dev / hda1 Indicates that if there is no input within the above time, the default startup system is TL3.4, that is, TurboLinux 3.4.0 label = dos table = dev / had indicates that if you prompt users in LILO When the system starts the system, the user presses the