Linux running .sh file

  

A medium-level Linux user must execute the .sh file frequently. Of course, you can double-click the file directly under the graphical interface, but it is a waste of time.

Now introduce the first method: (under ubuntu)

First you have to open a terminal. Then type sudo su and enter the password. This gives the root user rights. Then find the file (of course, use the command in the terminal to find, you can not open a file manager.) Execute the ./sh file name.

For example, if you have a sh file called 1.sh, this file is in the /tmp directory of the hard disk. To execute it, you should do this:
C code

  • $ sudo su
    < Li> pass your password: (You can't see the input when you enter the password, but it has already been entered.)
  • #cd /tmp
  • #./1. sh

    $ sudo supass your password :( password is entered here when not see what the input, but it has been entered into it.) # cd /tmp #. /1.sh

    this It’s OK. The SH file is a similar batch file in the Linux system, so you may need to enter some information after running the sh file. This depends on the content of the sh file.

    The second method:

    sh xx.sh

    Last suggestion: Use
    C code:

    man sh to see the introduction of sh~



  • Copyright © Windows knowledge All Rights Reserved