"DAY3" shell programming and other Linux settings learn notes

Source: Internet
Author: User
Tags gz file

Shell programming

------------------

-lt//less than <

-GT//greater than >

=//equivalent

-eq//equals=

$#//extract number of parameters

$//First parameter

$n//extraction of nth parameters

$//extract command

$? //Store The result of the last execution command, 0 indicates success, not 0 failure.

[Email protected] //Output all parameters


-e//exists determine if file (clip) exists

-D//Determine if it is a directory


Help if//View If assistance information

Help for

Help while


Shift//move parameter


Output all script parameters, each line

----------------------------

[Test.sh]

#!/bin/bash

count=$#;

If [$count-lt 1]; Then

Echo No args!

Else

For ((i=0;i< $count; i++));

Do

echo $;

shift; #将参数向左移动1个位置, flush out the left argument.

Done

Fi


At the command line Terminal test-e-f-D

----------------------------

$>[-e/xx/xx]//-d-f-E

$>echo $?


Netcat

----------------------------

1.nc-l 1234 &//boot server, listening port 1234

2.jobs//view jobs running in the background

3.kill%n//kills a specified number of jobs

4.NC-L 1234


Ubuntu modified software Source (domestic mirror version)

-----------------

1. Back up the original software source

$>cd/etc/apt

$>CP sources.list Sources.list.bak

2. Situation sources.list File

$>echo "" > Sources.list

3. Copy the 163 domestic software source address into the Sources.list file. (The source is older and currently does not support version 16)

[/etc/apt/sources.list]

Deb Http://mirrors.163.com/ubuntu/precise main Universe restricted multiverse

DEB-SRC http://mirrors.163.com/ubuntu/precise main Universe restricted multiverse

Deb Http://mirrors.163.com/ubuntu/precise-security Universe main Multiverse restricted

DEB-SRC http://mirrors.163.com/ubuntu/precise-security Universe main Multiverse restricted

Deb Http://mirrors.163.com/ubuntu/precise-updates Universe main Multiverse restricted

Deb Http://mirrors.163.com/ubuntu/precise-proposed Universe main Multiverse restricted

DEB-SRC http://mirrors.163.com/ubuntu/precise-proposed Universe main Multiverse restricted

Deb Http://mirrors.163.com/ubuntu/precise-backports Universe main Multiverse restricted

DEB-SRC Http://mirrors.163.com/ubuntu/precise-backports Universe main Multiverse restricted

DEB-SRC Http://mirrors.163.com/ubuntu/precise-updates Universe main Multiverse restricted

4. Performing Updates and Upgrades

$>sudo apt-get Update//Retrieve the list of latest software packages

$>sudo apt-get Upgrade//upgrade Package




Ubuntu modified software source (self-made repositories)

------------------------------

1. Back up the original software source

$>cd/etc/apt

$>CP sources.list Sources.list.bak

2. Situation sources.list File

$>echo "" > Sources.list

3. Mount the ISO file to/mnd/cdrom.

4. Modify the software source, point to/mnd/cdrom

[/etc/apt/sources.list]

Deb File:/mnt/cdrom./

5. Updates and Upgrades

$>sudo apt-get Update

$>sudo Apt-get Upgrade

6. Install Ubuntu desktop software

$>sudo Apt-get Install Ubuntu-desktop

7. Restart

$>sudo reboot



Virtual Machine Enhancements

-----------------------------

1.vmware Menu--Virtual machine--install VMware's enhanced tools

2. Automatically press the Linx.iso file in the CDROM and open the optical drive automatically.

3. Copy the vmwaretools-993.xxx.tar.gz file from the optical drive to the Ubuntu desktop

4. Right click on the tar.gz file and select extract here.

5. Generate the VMware Tool folder on the desktop

6. Program to open Ubuntu Terminal (Terminal)

7. Go to the Desktop folder

CD ~/desktop

8. Executive vmwareinstall.pl

$>sudo./vmwareinstall.pl

9. Return all the way.


Set up a virtual machine

--------------------------

1. Increase content capacity

2. Set the screen resolution to the host resolution

3. Enable copy-and-paste.

4. Share the folder.


Installing the JDK on Ubuntu

------------------

1. Download jdk-8u65-linux-x64.tar.gz

2. jdk-8u65-linux-x64.tar.gz File tar

$>TAR-XZVF jdk-8u65-linux-x64.tar.gz

3. Move the Tar-open JDK directory to/soft

$>MV Jdk1.8.0_65/soft

4. Test Installation Success

$>cd/soft/jdk-1.8.0_65/

$>./java-version

5. If Java version information appears, the JDK installation is successful.


Configuring Environment variables

-------------------

1. Edit/etc/environment

[/etc/environment]

Java_home=/soft/jdk

Path= "....:/soft/jdk/bin"

2. Let the environment file take effect in the current session

$>source/etc/environment

3. Restart the client, yes reboot

$>sudo reboot


Configuring the Eclipse workspace

------------------

1. Create a directory/home/ubuntu/workspace

2. Open Eclipse and specify a workspace for the above directory.

3. There is no permission issue, Ubuntu has full read and write access to the folder.


Package operations

----------------------

1. Query which packages are installed

$>sudo dpkg-l


Cloning a virtual machine

--------------------

1. Right-click the appropriate virtual machine management-clone in the virtual machines state.


Text mode and desktop mode switching

--------------------

1.ctrl + ALT + F6//Switch to text mode

2.ctrl + ALT + F7//Switch to desktop mode


"DAY3" shell programming and other Linux settings learn notes

Related Article

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.