Linux Basic Command Learning

Source: Internet
Author: User
Tags create directory gz file save file iptables tomcat server

1. Execute File:

./File: Execute the file

SH startup.sh Execute the file

2. Vi Edit

VI Command:

: w save file but do not exit

: W file saves the modification to file and does not exit

: w! Force save, not eject

: Wq save File and exit

: wq! Force the file to be saved and exit

Q: Do not save file, exit

: q! Do not save file, Force quit

: e! Discard all changes and edit from the last time the file was saved

3. List Files

ll

Ls

4. Copying Files

Cp

CP afile Afile.bak Copy the file as a new file Afile.bak

CP afile/home/bible/Copy the file afile from the current directory to the /home/bible/ directory

5. file (move: rename + move)

MV A.txt b.txt renaming a.txt to b.txt

MV A.txt/home Move the a.txt under the current directory to the/home directory

6. Delete rm ( directory is not empty )

RM a.txt Delete a.txt

RM * Delete all files in the current directory (files not hidden)

RM-RF/HOME/ABC Delete the directory and all files and folders under it

Rmdir/home/dir Delete the directory (when the directory is empty)

7. Switch Directories

CD ~ switch to home directory

CD/TMP Switch to directory

CD dir switch to dir directory in current directory

CD/ switch to root directory

Cd.. switch to the top level directory

Cd.. /.. switch to the top level two directory

CD ~ switch to the user directory, such as the root user, then switch to /root

8. Create directory mkdir

mkdir ph

9. file content more than cat

More/home/logs Display Directory

More Catalina.out Display the contents of the File page display a page press the blank key to display the second page

Cat Merge Display

10. Search Content grep tail

grep ' Test ' AA bb cc display file AA bb cc with test in line search containing test

Tail-f c.txt Find tracking

11. finding files find

-name Search by name

-print Printing shows up

Find ~-name ". txt"-print look for a . txt file in the home directory and print

Find/etc-name "AB"-print find files starting with AB in the etc directory and show

Find. -name april* Find files starting with April in the current directory

12. Replace

Sed-i ' s/202.97.1.16/192.168.0.1/g ' a.txt

I replace

s replace: replace 202.97.1.16 , change to 192.168.0.1

G: Global

13. memory,CPU

Top

View current Path

Pwd

14. Compression and decompression

C: Create a compression

X: Unzip

Z: Whether to use gzip

V: Compress display Document

Compress tar-zcvf/home/file.tar.gz file to package file files to generate home directory File.tar.gz

Decompression TAR-ZXVF file.tar.gz/home/usr

15. Establish link Shortcuts

Ln-s/home/gamestat/gamestat

Ln-s file name link file name

16. Create an empty file touch

Touch a.txt Create an empty file

17. Login Information

who displays logged-in users

last logged in user

18. Process

Ps-ef|grep pid Viewing process

KILL-E pid Kill Process

Top Real-time display process status

19. Network

Ipconfig viewing network interfaces familiar

NETSTAT-LNTP View all listening ports

Route-n Viewing routes

Add the specified port to the firewall (/sbin/iptables)

Iptables-i input-p Protocol --dport port number -j ACCEPT

such as: iptables-i input-p tcp--dport 8080-j ACCEPT

lsof-i:8082 to see if the port is occupied

Ps-ef |grep 8082

Ps-ef|grep Tomcat

Linux under Tomcat configuration

20. Download The Tomcat compression Pack and place Linux under the

Apache-tomcat-7.0.tar.gz

Use FTP to place under Linux

21st. Unzip Unzip

TAR-ZXVF apache-tomcat-7.0.tar.gz/usr/local

Create a soft connection for version upgrade

Ln-s/usr/local/apache-tomcat-7.0/usr/local/tomcat

tar-zcvf/home/file.tar.gz file
package file file to generate home directory file.tar.gz)

Set Permissions

chmod +x/usr/local/tomcat

22. Configuring environment Variables

Vi/etc/profile

Export Tomcat_home=/usr/loacl/tomcat

Export Catalina_home=/usr/local/tomcat

Save and exit

: Wq

Source/etc/profile

23. Tomcat Directory

Enable Tomcat sh startup.sh or sh/usr/local/tomcat/bin/startup.sh

Tomcat Directory

Bin Storage launches a script to close Tomcat

Conf store different configuration files Server.xml Web. XML (port, IP)

Doc Storage Documentation

Lib holds the library file jar required for Tomcat operation

Logs storing the log file for Tomcat execution

SRC store Tomcat's source code

WebApps Tomcat's main Web publishing directory

Work stores the class file generated by the JSP compilation

24. Modify Configuration Modify Port

Cd/usr/local/apache-tomcat-7.0/conf

ll

VI server.xml(tomcat server boot port)

Connector port= "" Protocol= "http/1.1"

conectiontimeout= "20000"

: Wq(save exit)

Add the specified port to the firewall (/sbin/iptables)

Iptables-i input-p Protocol --dport port number -j ACCEPT

such as: iptables-i input-p tcp--dport 8080-j ACCEPT

Service Iptables Save

Service Iptables Restart

or directly modify the file /etc/sysconfig/iptables

Vi/etc/sysconfig/iptables

-A input-p tcp-m tcp--dport 8080-j ACCEPT

Servic iptables Restart

In the browser input HTTP://IP: port to see if it can be opened

modifying character settings UTF-8

Cd/usr/local/apache-tomcat-7.0/conf/server.xml

connectiontimeout= "20000"

Redirectport= "8443"

uriencoding= "UTF-8"/>

join the mysql connection pack

Tomcat under the Lib

Modify catalina.sh

The web system is larger to add Tomcat memory

Cat catalina.sh

Java_opts= "-server-xms1024m-xmx2048m-xx:permsize=128m-xx:maxnewsize=512m-xx:maxpermsize=256m- Djava.awt.headless=true "

VI catalilna.sh

25. start Tomcat

Go to the Bin directory to execute the./startup.sh boot

CD bin

./startup.sh

Enter logs to see if it has started normally

CD Logs/catalina.out

(Starting .... Server can access the console to see information)

26. To see if the port is occupied

lsof-i:8082

Java 2463 Root will appear ...

View by Process number

PS Axu|grep 2463 viewing process specific information

Shut down the Tomcat server./shutdown.sh

27. Configure Web Admin Account

Vi/usr/local/apache-tomcat-7.0/conf/tomcat-users.xml

28. set up tomcat boot up

/etc/rc.d/init.d to add Tomcat to start the file

Linux Basic Command Learning

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.