Shell review notes ---- user management, shell ---- user management

Source: Internet
Author: User

Shell review notes ---- user management, shell ---- user management

$ Who can know the number of logins to the System

 

$ Who | wc-l: calculate the number of users

Note: | it is a pipeline symbol. pipeline can be established between two programs (pipeline): the output of who is the wc input. The result listed by wc is the number of logged-on users.

The pipeline is converted into an independent command by entering this command into a common file, and then using chmod to set the execution permission for the file.

#! /Bin/sh when a file contains the first two characters #! The kernel will scan the remaining parts of the line to see if there is a complete path available for executing the program's interpretation. the kernel will reference the interpreter with a straight-forward option, and then use the other part of the command line. generally, shell scripts start #! /Bin/sh.

$ Cat> nusers creates a file and uses cat to copy the input from the terminal.

Who | content of the cw-l program

^ D Ctrl-D indicates end-of-file

$ Chmod + x nusers grant the File Execution permission

$./Nusers run the test

6. Possible output test results

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.