Self-taught Linux-3 basic system operations

Source: Internet
Author: User

Learn Linux by yourself-3 basic system operations 1. switch host operation # shutdown command-t sec:-t followed by the number of seconds, that is, "shut down after a few seconds"-k: not to actually shut down, just send a warning message-r: after the system service is stopped, restart-h: After the system service is stopped, immediately shut down-n: without going through the init program, directly shutdown-f: after shutdown and startup, force skip fsck disk check-F: After the system restarts, force fsck disk check-c: Example of canceling the shutdown command that is already in progress: shutdown-h now shut down immediately, now is equivalent to shutdown-h 20:25 system shutdown at today shutdown-h + 10 system shutdown after 10 minutes now the system immediately restarts shutdown-r + 30 'the system will reboot 'The system restarts after 30 minutes, and the following information is displayed: shutdown-k now: the system does not shut down, only issuing a warning message # reboot now restarts the computer # startx enters the desktop # logout user logout 1. linux File directory 1.1 file name requirements:. length: a maximum of 256 characters, compatible with UNIX. It is recommended that the length be less than 14 characters. B. Composition: it is usually composed of letters, numbers, periods, underlines, and minus signs. 1.2 file type and its representative characters common file-directory file d link file l block Device File B character device file c pipeline file p 1.3 file type corresponding color general file -------------------- white directory file -------------------- blue symbolic link file -------------- purple Device File -------------------- yellow Executable File ----------------- green image file ---------------------- pink compressed file --------------------- absolute path of the red 1.4 path: start with the root directory. Relative Path: start with the current directory. "." And "...": "." Current directory. [Note] When you access a file, you must provide the path of the file. Paths are classified into relative paths and absolute paths. Absolute path refers to the path starting from "root", also known as full path; relative path refers to the path starting from the user's working directory. It should be noted that there is only one absolute path and relative path to a specified file in the tree directory structure. The absolute path remains unchanged, while the relative path changes with the change of the user's working directory. When you want to access a file, you can reference it using the path name. In addition, you can reference the file to be accessed based on the relative location of the user's working directory, without listing the complete path name of the file. 1.5 directory structure root Super User Directory includes desktop management and other home user directories including user information and other bin execution directories to store executable files, including common commands sbin execution directory to store commands not provided to users boot Guide directory stores various files used by the boot system. etc configuration directory when the system is configured, use the dev Device directory to access the peripheral mnt installation directory administrator device temporary installation point opt installation directory administrator software package place point lib Library when executing the directory command, use the usr shared directory to store shared files of all users in the system. var data directory. When the system is running, modify the data tmp temporary directory. proc virtual directory. Fictitious file system memory. No hard disk lost is saved. + fount empty directory 2. common Linux Command analysis 2.1 List objects: ls-a,-all list all objects in the directory, including. the implicit file-A starts with-a, but does not list ". "(indicating the current directory) and" .. "(indicating the current directory Parent directory ). -L in addition to the file name, the File Permission, owner, file size, and other information are listed in detail. -S and-size are used to list the sizes of all objects in the unit of block size.-S is sorted by file size. [note]: ". "indicates the current directory" .. "indicates the upper-level directory"/"system root directory" ~" User Dedicated directory 2.2 switch directory: cd (change directory) 2.3 create directory: mkdir (make directory) 2.4 Delete directory: rmdir (remove directory) 2.5 copy file: cp (copy) # cp-afp [source file or directory] [target file or directory] parameters: -a: Copy all directories and contain subdirectories-f: Force copy file-p: retain original file date-I: Ask the user-v: Display Command Execution Process-r recursive copy 2.6 Delete file or directory: rm (remove) # rm-irf [file or directory] example: # rm * "*" indicates deleting all files in the current directory # rm file:-f: force delete file-I: interactive mode. Confirm again before deletion-r: delete directories one after another-v: Display deletion process 2.7 display screen pause: more space flip page, available separately. For example: # more data.txt 2.8 can browse files: less can be used separately. For example: # less data.txt can not only flip pages with spaces, but can also be used to scroll up and down the file; Q exits the 2.9 connection file: cat (concatenate) it can display the file content or combine a file into a file, for example, # cat data.txt displays the content of data.txt. # Cat data1.txt data2.txt> data.txt combines data1.txtand data2.txtinto data.txt 2.10 to move or change the file and directory name: mv (move) # mv-if [source file or directory] [target file or directory] Move the file and directory to another directory or change the name of the file and directory, for example, # mv a.txt .. move the.txt file to the upper-level directory # mv z1.txt z3.txt change z1.txtto z3.txt 2.11 to display the current directory: pwd 2.12 lookup program and manual: whereis 2.13 can be used to find the source code, binary program, user manual and other files, for example: # whereis string to be searched 2.14 search file: find specify search directory Chinese will be located in the location 2.15 display file type: file example: # file * display all file types in the current directory. 2.16 search string: grep search for a specific string and display It is usually used to filter previous results, for example: # grep text *. conf: Search for the file extension in the current directory. conf and contains the "text" string 2.17 to display information about the current operating system and machine # uname-a to display all information # uname-p to display the processor type # uname-m to display machine hardware information 2.18 to display machine name # hostname 2.19 Change User Password # passwd 2.20 view date # date 2.21 view a month # cal 5 2004 2.22 view users on the system # who (information from files/var/run/ utmp) all login information is stored in/var/log/wtmp # id Uid = 318 (hawkeye) gid = 300 (users) 2.23 The number of bytes in the statistics file, number of words and lines # wc-c number of bytes # wc-l number of lines # wc-w Number of words 2.24 establish a symbolic connection: # ln-s source target [note]: (important) There are differences between a symbolic connection and a hard connection. 1) Use the command # ln-s source object hard connection command # ln 2): After the symbolic connection is deleted, the original file is still in, deleting one of the hard connections will affect the other. 3) Symbolic connections can be used across file systems, however, the hard connection cannot run the 2.25touch command # touch test_file across the file system to change the date of the file test_file to the current date. If the file does not exist, it is created. # Touch file1 new_file creates an empty file 2.26 disk management command that is the same as file1 date # df (display the space used by the file system) [note ]: differences between file systems and directories 2.27 load command: # mount-a-t device name directory name-a mount defines all the partitions in/etc/fstab-t specifies the file system format (ext2, msdos, vfat, iso9660) common File System Format Linux: ext3 OS/2: hpfsDos: msdos CDROM: iso9660Windows 9x: vfat FreeBSD: ufsWindows NT: ntfs SunOS: sysv example: # mount-t iso9660/dev/hdb/mnt/cdrom mounting disc # mount-t vfat/dev/fd0/mnt/floppy mounting floppy disk # umount/mnt/cdrom # umount/mnt /floppy/etc/fstab file profiling Partition name mount point File System Format option dump fsck/dev/hda1/ext2 defaults 1 1 1/dev/hda2/usr ext2 defaults 1 2/dev/ cdrom/mnt/cdrom iso9660 noauto, ro 0 0 None/proc defaults 0 0 default is the set Option of the mount command to automount and read/write 3. in Linux, you can export the result of a command to a file by means of redirect. The command can be ">"> "or"> ": you can output the results to a file, and the original content of the file will be deleted ">": the results will be appended to the file, and the original content will not be cleared, for example: # ls-al> dir.txt # cat data1.txt> the data2.txt pipe "|" (pipe) can output the result of a command to another command, for example: # ls | grep conf search and display the line containing the "conf" string in the ls command result

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.