Linux introduction and Common commands

Source: Internet
Author: User
Tags create directory

Linux introduction and Common commands

Linux composition:

  • Kernel: it is the heart of the system and the core program for running programs and managing hardware devices such as disks and printers.
  • Shell: A system user interface that provides an interface for users to interact with the kernel. It receives user-input commands and sends them to the kernel for execution. It is a command interpreter. But it not only enables the command interpreter, but also advanced programming languages and shell programming.
  • File System: The file system is the organization method for storing files on disks and other storage devices. Linux supports multiple file systems, such as ext3, ext2, NFS, SMB, and iso9660.
  • Applications: standard Linux operating systems have a set of applications, such as X-Window and Open Office.

Linux directory structure: root directory/
  • Bin stores binary executable files (ls, cat, mkdir, etc)
  • Boot stores various files used for system boot.
  • Dev is used to store device files.
  • Etc stores system configuration files
  • Home: root directory for storing all User Files
  • Lib stores the shared libraries and kernel modules required for running programs in the file system.
  • Mnt System Administrator installation of Temporary File System
  • The location where the optional application package of opt is additionally installed
  • The proc Virtual File System stores the current memory ing.
  • Root Super User directory
  • Sbin stores binary executable files, which can only be accessed by the root user
  • Tmp sbin is used to store various temporary files.
  • Usr is used to store system applications. An important directory is the/usr/local administrator software installation directory.
  • Var is used to store files that need to change data during running.

Introduction to Common commands 1. File directory operation commands
  • Ls display file and directory lists
  • -L list detailed information about a file
  • -A: Lists All files in the current directory, including hidden files.
  • Mkdir create directory
  • -If the parent directory of p does not exist, the parent directory is used.
  • Cd switch directory
  • Touch generates an empty file
  • Echo generates a file with content
  • Cat and tac display text file content
  • Cp copy file or directory
  • Rm delete file
  • -R: delete all files in the directory at the same time.
  • -F force delete a file or directory
  • Mv moves a file or directory, file or
  • Mv aaa bbb changed aaa to bbb
  • Find finds the specified file in the file system
  • -Name: File name
  • Wc counts the number of lines, characters, and characters of a text document.
  • Grep searches for the specified string in the specified text file.
  • Rmdir Delete empty directory
  • Pwd displays the current working directory
  • Ln create a link file
  • More and less display text file content by PAGE
  • Head and tail display the beginning and end of the file respectively.
Ii. system management commands
  • Stat displays information about the specified file, which is more than the ls command.
  • Who and w show online login users
  • Whoami displays the user's identity
  • Hostname display Host Name
  • Uname: displays system information
  • Top displays the processes that consume the most resources in the current system.
  • Ps displays the Instantaneous Process status
  • Du displays the total disk space used by the specified file (directory ).
  • Df displays the disk space usage of the file system
  • Free displays the usage of the current memory and swap space
  • Ifconfig displays network interface information
  • Ping to test network connectivity
  • Netstat displays network status information
  • Man Command help Information Query
  • SET command alias in alias
  • Alias [alias] = ["command name"]
  • Clear Screen
  • Kill and kill Processes
Iii. Backup and compression commands
  • Gzip compression (decompress) file or directory. the ZIP file suffix is gz.
  • Bzip2: Decompress the file or directory. The suffix of the compressed file is bz2.
  • Pack (decompressed) files and directories

  • Gzip command
  • Command Format:
  • Gzip [Option] compressed (decompressed) file name
  • Parameters:
  • -D. decompress the compressed file.
  • -L for each compressed file, the size of the compressed file, the size of the uncompressed file, the compression ratio, and the name of the uncompressed file are displayed.
  • -V displays the file name and compression ratio for each compressed and decompressed file.
  • -Num uses the specified numeric num to adjust the compression speed.-1 or -- fast indicates the fastest compression method (low compression ratio), and-9 or -- best indicates the slowest compression method (high compression ratio ). The default value is 6.
  • Bzip2 command
  • Command Format:
  • Bzip2 [-cdz] File Name
  • Parameters:
  • -D: extracted Parameters
  • -Z: Compression Parameters
  • -Num uses the specified numeric num to adjust the compression speed.-1 or -- fast indicates the fastest compression method (low compression ratio), and-9 or -- best indicates the slowest compression method (high compression ratio ). The default value is 6.
  • Tar command
  • Command Format:
  • Tar [-cxzjvf] Name of the compressed packaging document to be backed up
  • Parameters:
  • -C: parameter commands for creating an archive file
  • -X: Unlock the parameter command of a compressed file!
  • -Z: Do I need gzip compression?
  • -J: Do I need to use bzip2 for compression?
  • -V: displays files during compression.
  • -F: use the file name. The file name must be followed immediately after f.
  • -Tf: view files in an archive file
4. Shutdown and restart command
  • Shutdown
  • R restarts immediately after shutdown.
  • H. Do not restart after Shutdown
  • Now shut down immediately
  • Turn off power after halt is turned off
  • Reboot restart

Linux pipeline: Simply put, a channel accepts the output of a tool software and then inputs that output to other tool software. Using the UNIX/Linux vocabulary, this channel accepts the standard output of a process and uses the standard output as the standard input of another process. If you do not redirect the output, it will be displayed on the screen. With one channel, you can redirect this output to the standard input of another tool software.
Example: grep-r "best"/home/* | more
V. Use of the VI Editor
  • VI Running Mode
  • Edit mode: Waiting for editing command input
  • Insert mode: In edit mode, enter I to insert mode and insert text information.
  • Command mode: In edit mode, enter ":" To run the command mode.
  • VI command
  • Q: Exit vi directly.
  • After wq is saved, exit vi and create a new file.
  • Q! Force exit
  • W file: Save the current content as a file
  • Set number: displays the row number in the editing file.
  • Set nonumber does not display the row number in the editing file.

Vi. File Permission Management
  • Three basic Permissions
  • R read permission
  • W write permission
  • X execution permission
  • Permission to view files and directories
  • Ls-l file name
  • The displayed information includes: file type (d directory,-common file, l link file), File Permission, number of hard links of directory subdirectories or files, and owner of the file, file Group, file size, file creation time, file name
  • -Rw-r -- 1 itcast users 2254 tt.htm
  • From the second character, rw indicates that the user has the read and write permissions and has no operation permissions. Then, r indicates that the user group users has only the read permission and has no operation permission, the final r indicates that other people (others) have only the read permission and have no write and operation permission.
Change Operation Permissions
Chmod [user in the group to which u belongs to the main g o all user a of other users] [+ add permissions-delete permissions = delete original permissions] [rwx] file or directory name
  • For example, chmod g + w file
  • -Perform the same permission operation on subdirectories under R
  • You can also use numbers to indicate permissions, such as chmod 777 file.
  • R 4 w 2x1
  • If you want the rwx attribute, 4 + 2 + 1 = 7;
  • If the rw-attribute is required, 4 + 2 = 6;
  • If the r-x attribute is required, 4 + 1 = 5;


What are common Linux commands?

Wenku.baidu.com/.?&od=0
Details

What are the common commands for comparison between LINUX and DOS?

Linux: ls ------------ dos: dir
Linux: cd ------------ dos: cd
Linux: mkdir --------- dos: md
Linux: rmdir --------- dos: rd
Linux: cp ------------ dos: copy
Linux: rm ------------ dos: del
Linux: mv ------------ dos: move
Linux: cat ----------- dos: type
Linux: more ---------- dos: more
Liuux: clear --------- dos: cls
Linux: man ----------- dos: help or /? Parameters
Linux: logout -------- dos: shutdown-l

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.