iOS Development Common shell commands

Source: Internet
Author: User

1. What is the shell? A: (1) The shell is a program with special functions, which is an interface between the user and the core program (kernel) of the Unix/linux operating system. (2) In order to shield the user from the complexity of the kernel, but also in order to protect the kernel to prevent user misuse caused damage, built a shell around the kernel (shell). The user requests the shell and the shell interprets and passes the request to the kernel. (3) The use of a wider shell has standard bourne?shell? (SH), Korn Shell (Ksh), C?shell? (CSH), Bourne Again Shell (bash), and so on. For example, to view the Shell:echo used in the current environment $SHELL (4) Another important feature of the shell is that it is itself an interpreted programming language, and the Shell programming language supports most of the program elements that can be seen in high-level languages, such as functions, variables, arrays, and program-control structures. The Shell programming language is easy to learn, and any command that can be typed at the prompt can be placed into an executable shell program. (5) In essence, the shell script is a simple combination of command-line commands into a file. The shell is basically a command interpreter, similar to a DOS Command.com. It receives the user command and then invokes the appropriate application. 2, Shell features: (1) The proper combination of the existing commands to form a new command, and the composition is very simple (2) provides a file name extension so that a single string can match more than one file name (3) can directly use the shell's built-in commands, without the need to create a new process (4) The shell allows for flexible use of data streams, providing mechanisms such as wildcards, input/output redirects, and pipe breaks to facilitate pattern matching, I/O processing, and data transfer. (5) Structured program module provides sequential process Control, branch process control, cycle flow control, etc. (6) The shell provides the ability to execute commands in the background (&) (7) The shell provides a configurable environment that allows users to create and modify commands, command prompts, and other system behaviors (8) The shell provides an advanced command language that allows users to create programs from simple to complex. 3, Shell User Management command: 1. After creating a new user (user add) Useradd UserName, a folder named UserName is created under the/home directory, and the user is automatically positioned under the folder each time they log on. 2. Change the password for the user (password) passwd UserName3. Delete users (user delete) Userdel UserName use the-p option toDelete files in the user directory and other files associated with the user. 4. New group Add Groupadd GroupName5. Delete the group delete Groupdel GroupName6. User Identity WhoAmI 7. View login user who [option]-a displays all information for all users -H Display column header 8. View user's actions W a moment the user's behavior 9. Switching between users (substitute user) Su UserName such as: su or su root switch to root user su Haison switch to user 4 named Haison, Shell directory Management Command: 1. Create directory (make directory) mkdir DirectoryName2. Remove directory (remove directory) rmdir DirectoryName3. Display working directory (print working directory) pwd4. Display directory contents (list) LS [options] option:-A displays all files in the current directory, including files that begin with. -L displays a list of files in the form of a long list, such as:-rw-r--r--1 Haison haison 2 10:10 haison.c5. Changing the current directory (change directory) CD or CD ~ Enter the home directory CD at Login Go to the root directory CD: Go to the top level directory Cd/home Enter the system home directory CD home into the current directory in the home directory 6. Directory rename (move) MV Sourcedirecname TargetDirecName7. Directory copy (copy) CP Source Direc targetdirec-r files, subdirectories and subdirectories under the Copy directory file 5, Shell file Management commands 1. Create a new file >filename or touch FileName or vi FileName2. Delete file (remove fil e) RM [options] FileName option:-I system prompts if you really want to delete the file-F to delete the file without prompting for any confirmation message-R recursively deletes the contents of all subdirectories under the directory 3. Copy of the file (copy) CP sourcefile TargetFile4. File Link (l Ink) ln–s sourcefile targetfile Create a file link, ls–l view, you will see TargEtfile->sourcefile5. display file contents More filename One time one screen display file content, space or carriage return display the next screen less FileName display file content of one screen, space or carriage return display the next screen cat filename Display the contents of a file all at once cat File1 File2>file3 writes file1, file2 content to File3, overwriting file3 original content cat File1>>file2 appends file1 content to File2, File2 original Content The head filename only shows the first 10 lines of the file head–n filename displays the first n rows of the file tail filename only shows the last 10 lines of the file tail–n filename shows the last n rows of the file tail–f F Ilename Check the log file that is being changed, will display the last content of filename in the screen, and not only refresh, so that you see the latest file content. NL FileName Displays the contents of the file all at once in numbered form, ignoring blank lines 6. File Move/rename (move) MV SourceFile targetfile move one or more files to another directory, or rename one file to another file. 7. Find finds find [path] [options] such as: Find/-name test.txt-print 8. File content Lookup (grep) such as: grep main haison.c grep-i main haison.c #忽略大小 Write Grep–n main haison.c #输出行号 grep-v main haison.c #反检索, showing only rows that do not match 9. File Type command ls–l displays the type of file as a long list, such as:-rw-r--r--

iOS Development Common shell commands

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.